Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty lines are considered "uncommented" for toggle-comment sakes #114

Open
molenzwiebel opened this issue May 8, 2022 · 1 comment
Open
Labels
C-Enhancement Category: enhancement. Improvement P-Low Priority: low. Should yield priority to high and non-prioritized

Comments

@molenzwiebel
Copy link
Contributor

Summary

Consider the following snippet:

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 389964a5
@molenzwiebel molenzwiebel added C-Bug Category: bug. Not working as expected C-Enhancement Category: enhancement. Improvement and removed C-Bug Category: bug. Not working as expected labels May 8, 2022
@Gohla
Copy link
Member

Gohla commented May 11, 2022

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.

@Gohla Gohla added the P-Low Priority: low. Should yield priority to high and non-prioritized label May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Enhancement Category: enhancement. Improvement P-Low Priority: low. Should yield priority to high and non-prioritized
Projects
None yet
Development

No branches or pull requests

2 participants