Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

If first line in selection is a line comment, Block Comment does nothing #2118

Closed
peterflynn opened this issue Nov 15, 2012 · 6 comments
Closed
Assignees
Milestone

Comments

@peterflynn
Copy link
Member

  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.

@peterflynn
Copy link
Member Author

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...

@TomMalbran
Copy link
Contributor

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.

@ghost ghost assigned peterflynn Nov 15, 2012
@pthiess
Copy link
Contributor

pthiess commented Nov 15, 2012

Reviewed, assigned to @peterflynn to work with Tom.

@peterflynn
Copy link
Member Author

Nominating for Sprint 18

@redmunds
Copy link
Contributor

redmunds commented Dec 5, 2012

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

@peterflynn
Copy link
Member Author

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants