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

[CLOSED] If first line in selection is a line comment, Block Comment does nothing #2044

Open
core-ai-bot opened this issue Aug 29, 2021 · 6 comments

Comments

@core-ai-bot
Copy link
Member

Issue by peterflynn
Thursday Nov 15, 2012 at 01:47 GMT
Originally opened as adobe/brackets#2118


  1. Find some JS where there's a block of code with a single-line comment above it
  2. Select the whole block including the line comment
  3. Edit > Toggle Block Comment

Result: nothing happens

Expected: code is wrapped in a block comment

This also happens if the first line(s) are whitespace -- as long as the first non-whitespace line is a line comment, Block Comment won't do anything.

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Thursday Nov 15, 2012 at 01:53 GMT


I think Block Comment may be trying to be overly clever with line comments. For example, if I select a single line-comment, Block Comment actually uncomments it (it does the same thing as Line Uncomment). If I select two consecutive line comments (and nothing else), then Block Comment no-ops. Or the above case: if I select a bunch of uncommented code that includes line-comments, depending on what the first line is Block Comment will either no-op or wrap in a block comment.

It seems like the command might be more predictable, and the implementation simpler, if Block Comment just totally ignores the presence of line comments...

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Thursday Nov 15, 2012 at 06:38 GMT


I knew i was missing some cases on the implementation. I'll try to fix those.

I do like the idea of having block-comment to uncomment line comments, is actually how Sublime Text 2 does it. Even removing this, it might still not make it that easier, since the Tokenizer only gives information about a comment and not if it is a line or a block-comment, so then we need to know in a line comment if we are inside a block comment or nor in some way, which is how it does it now.

What I think is missing is having the line-comment uncomment a block-comment, so that it works similar to block-comment.

@core-ai-bot
Copy link
Member Author

Comment by pthiess
Thursday Nov 15, 2012 at 17:50 GMT


Reviewed, assigned to@peterflynn to work with Tom.

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Wednesday Dec 05, 2012 at 19:48 GMT


Nominating for Sprint 18

@core-ai-bot
Copy link
Member Author

Comment by redmunds
Wednesday Dec 05, 2012 at 23:31 GMT


I guess this never got marked as Fix in Progress. Oh, well, FBNC back to@peterflynn .

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Friday Dec 14, 2012 at 03:01 GMT


I can confirm this one is fixed now. Note that there are still a few inconsistencies remaining in block comment behavior, tracked in #2337.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant