rules
// foo :: string -> string
// foo: a -> a
bar :: string -> string
bar: _ -> "x"
If you now select the commented out section, but also include the empty line above (selection range indicated by [ and ]):
rules
[
// foo :: string -> string
// foo: a -> a]
bar :: string -> string
bar: _ -> "x"
And hit CTRL+/, you end up receiving a second set of comments:
rules
//
//// foo :: string -> string
//// foo: a -> a
bar :: string -> string
bar: _ -> "x"
This is in my opinion surprising behavior, since I would expect it to ignore the empty line and instead uncomment the selection. Other editors (VS Code, IntelliJ) act as expected.
Should be trivially solvable by ignoring empty/space/tab-only lines when determining whether a section is already commented.
Context
Spoofax version: devenv with spoofax-pie metaborg/spoofax-pie@389964a5
This can be solved by modifying the ToggleCommentHandler class in spoofax.eclipse. This class was copied from the Eclipse JDT plugin, and can probably be improved to support this.
Summary
Consider the following snippet:
If you now select the commented out section, but also include the empty line above (selection range indicated by
[
and]
):And hit CTRL+/, you end up receiving a second set of comments:
This is in my opinion surprising behavior, since I would expect it to ignore the empty line and instead uncomment the selection. Other editors (VS Code, IntelliJ) act as expected.
Should be trivially solvable by ignoring empty/space/tab-only lines when determining whether a section is already commented.
Context