-
Notifications
You must be signed in to change notification settings - Fork 0
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] Block comment command behaves unpredictably near line comments #2233
Comments
Comment by peterflynn Here's a strawman: I know Sublime has somewhat fancier heuristics -- for example, if there's a selection containing (parts of) multiple line comments and whitespace, but nothing else, all the line comments are removed. You could imagine being fancier still and doing something similar with multiple block comments too. But all that feels like overkill to me. And the fancier the rules, the more unpredictable it feels: for example, in Sublime if I select a block comment plus some uncommented code on either side, it uncomments unless the selection spans multiple lines. If my selection includes two block comments, it will sometimes uncomment one while leaving the other untouched (though which one will vary), or sometimes ignores them and wrap the selected range in a new block comment... I still can't figure out what rules predict that. |
Comment by TomMalbran The problems with the differences come from using the heuristics from line comment to uncomment. So since line comment doesn't uncomment the line comment from the first line, it creates differences in block comment. I am still finding wrong that it does a block comment when the selection reaches the end of the line but the starts is still inside a line comment. The idea right now is to uncomment when there is only one block comment inside a selection, complete or partial,and uncomment when the selection is inside a block comment. I like how it uncomments, because you don't need to worry about the selection to uncoment the block comment. At first it inserted block comment on invalid selection, like being part inside one block comment and part inside another, but I was told that was better not to do this, so it does nothing in those cases, some happens when the selection starts in a line comment, but it doesn't end in one or one of the middle lines wasn't a line comment. But should be pretty easy to remove this and let the user do invalid comments. |
Comment by redmunds
I disagree with your comments on 11/12, and 13/14 because adding a block comment causes commented text to become uncommented. If you want to do that, then maybe the code should not check for validity in any case -- just blindly add a block comment around whatever is selected. cc: |
Comment by TomMalbran /Yes. 6/7 and 9/10 sounds like bugs to me too, introduced on my last push to solve the adobe/brackets#2118. Will look into that and see what is the problem. Okay. I got a possible fix for the 6/7 and 9/10 inconsistency. Anything else I should add/do? |
Comment by peterflynn
|
Comment by TomMalbran
|
Comment by peterflynn Yep, good point Tom -- I should have remembered that we no-op on selections spanning multiple block comments (especially considering I wrote a unit test to check that case :-P) |
Comment by peterflynn Fix verified, and covered by unit tests in pull #2362. Here's the new behavior for all the cases above:
Much more consistent! |
Issue by peterflynn
Wednesday Dec 12, 2012 at 08:28 GMT
Originally opened as adobe/brackets#2337
Consider the following code:
Try invoking Toggle Block Comment with the following selections:
Result:
Expected:
Not sure yet, but the above feels pretty muddled. In particular, it seems wrong that the pairs 6/7, 9/10, 11/12, and 13/14 differ.
The text was updated successfully, but these errors were encountered: