There's no quick way to comment or uncomment lines of code. You have to manually type // or # at the start of each line. When debugging, you often want to quickly comment out a block of code and uncomment it later.
What should happen
Ctrl+/ toggles a comment on the current line
- If there's an active selection, it toggles comments on all selected lines
- If the line is already commented, it removes the comment prefix. If not, it adds one
- The comment prefix should match the current language (
// for C++/Java/JS/Go/Rust, # for Python/Ruby, -- for SQL, etc.)
Things to consider
- The current language is tracked in
problem_detail.py and passed to the editor. You'll need the language info to determine the correct comment syntax
- Comment prefixes per language are straightforward. Add a mapping in
constants.py next to the existing LANG_SLUGS and LANG_EXTENSIONS maps
- When toggling on multiple lines, check if ALL selected lines are commented before deciding to comment or uncomment. If they're mixed, comment all of them
- This should integrate with undo/redo so Ctrl+U reverses the toggle
There's no quick way to comment or uncomment lines of code. You have to manually type
//or#at the start of each line. When debugging, you often want to quickly comment out a block of code and uncomment it later.What should happen
Ctrl+/toggles a comment on the current line//for C++/Java/JS/Go/Rust,#for Python/Ruby,--for SQL, etc.)Things to consider
problem_detail.pyand passed to the editor. You'll need the language info to determine the correct comment syntaxconstants.pynext to the existingLANG_SLUGSandLANG_EXTENSIONSmaps