You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a command that cycles between no comment, double-slash, triple-slash #4255
If I press Ctrl+/ (Toggle Line Comment) on a Dartdoc line, currently the line gets transformed from:
/// Dartdoc line
to:
/Dartdoc line
Even though it'd be asymmetric with adding a comment, I think it'd be nice if uncommenting removed either //or///. This would be particularly useful if I'm writing a Dartdoc comment, press Enter, which automatically adds /// to the next line, but don't actually want the next line to be a Dartdoc comment.
Unfortunately "Toggle Line Comment" is entirely a VS Code feature that's driven by a static language configuration we provide it that only supports a single set of comment markers. I've an open issue with VS Code about extending this here (which you can 👍!):
We have added a Toggle Dartdoc Comment command that does similar for triple-slashes in the meantime (although now I'm wondering if there's value in a single command that just goes through all three states - no comment, double slash, triple slash, so you don't need two keybindings 🤔).
I'm wondering if there's value in a single command that just goes through all three states - no comment, double slash, triple slash, so you don't need two keybindings
I think a command that cycles through those three states would be great.
changed the title [-]Toggle Line Comment could be smarter about uncommenting Dartdoc lines[/-][+]Add a command that cycles between no comment, double-slash, triple-slash[/+]on Nov 8, 2022
Yeah, not sure why I didn't do that previously. This command is already doing the work to figure out what the current comments across the selection look like. I'll re-purpose this issue to add a command that cycles through them. Thanks!
I've done this, and it works fine, though I'm now wondering whether cycling through three is the best option or whether it should just be a replacement for Toggle Line Comment (eg. only ever adds double slashes), it is just smarter about removing the triple slashes (which was your original request).
I'm wondering if there's much call to add triple-slashes to existing uncommented/double-slashed code or whether it's mostly just used for commenting/uncommenting chunks with double-slashes.
Thoughts? (we could ofc add both, but giving descriptive names to them might be harder... "Cycle Line Comment" vs "Toggle Line Comment"?)
Activity
DanTup commentedon Nov 8, 2022
Unfortunately "Toggle Line Comment" is entirely a VS Code feature that's driven by a static language configuration we provide it that only supports a single set of comment markers. I've an open issue with VS Code about extending this here (which you can 👍!):
microsoft/vscode#64659
We have added a Toggle Dartdoc Comment command that does similar for triple-slashes in the meantime (although now I'm wondering if there's value in a single command that just goes through all three states - no comment, double slash, triple slash, so you don't need two keybindings 🤔).
jamesderlin commentedon Nov 8, 2022
I think a command that cycles through those three states would be great.
[-]Toggle Line Comment could be smarter about uncommenting Dartdoc lines[/-][+]Add a command that cycles between no comment, double-slash, triple-slash[/+]DanTup commentedon Nov 8, 2022
Yeah, not sure why I didn't do that previously. This command is already doing the work to figure out what the current comments across the selection look like. I'll re-purpose this issue to add a command that cycles through them. Thanks!
DanTup commentedon Nov 10, 2022
I've done this, and it works fine, though I'm now wondering whether cycling through three is the best option or whether it should just be a replacement for Toggle Line Comment (eg. only ever adds double slashes), it is just smarter about removing the triple slashes (which was your original request).
I'm wondering if there's much call to add triple-slashes to existing uncommented/double-slashed code or whether it's mostly just used for commenting/uncommenting chunks with double-slashes.
Thoughts? (we could ofc add both, but giving descriptive names to them might be harder... "Cycle Line Comment" vs "Toggle Line Comment"?)
Add a command to cycle through line comment types