-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Add Toggle Comment support for several more languages #3056
Conversation
…n core already): Java, CoffeeScript, Perl, Ruby, Python, SASS, Lua, Markdown, YAML, Haxe.
@peterflynn Want me to review this now or after #3057 is fixed, so that you can add block comments for CoffeScript? |
@peterflynn I tested the commenting for each new language and it doesn't quite work with Lua. Block uncomment will just remove the first "--" if those are at the start of the string (without considering spaces). The problem is for the same reason line and block comments for CoffeScript don't work, the line comment is the prefix of the block comment prefix. There is also another problem. Line uncomment on a block comment that covers the entire line will just remove the first "--" leaving an invalid string. The same thing will happen in CoffeScript. This is not as bad, but maybe line comment should check with the block prefix too and do nothing if it finds it at the start of any line, or at least go to comment mode, instead of uncomment. |
@TomMalbran This has been open for a while, and looks like there have been multiple PRs/Commits since then for individual languages - but not all of the ones specified here. @peterflynn Any chance you'd make a pass at closing these out by providing the differentials? Thanks! |
@miketheman There is a bug for Lua block/line comments, since the line ones are prefix of the block ones. This should have been fixed by #3057, but was never merged. Feel free to make a new PR for all the other languages except Lua. |
I guess I could also fix that in this one and merge it |
@TomMalbran I was looking for yaml today, hence the ping on this issue. :) |
@peterflynn The rules for ruby's block comments are:
As you observed, though, these are almost never used. It's probably safe to leave them out. |
Wasn't able to merge with master because of some issues with the submodules, so I did a manual merge: 3a12c21. (I hope that is ok) I haven't added the comments for CoffeeScript and Lua, since those don't work well yet. But I will add them when I redo the comments fix. |
Toggle Line and/or Block Comment support for: Java, CoffeeScript, Perl, Ruby, Python, SASS, Lua, Markdown, YAML, Haxe. All these languages were included in core already.
I hit a few snags while working on this:
###
, but Toggle Block Comment behaves badly (I think because the open/close delimiters are identical). So I've only included lineComment for now. Filed Toggle Block Comment doesn't work if the open/close delimiters are the same #3057 on this.=begin
and=end
but couldn't find any real-world code that uses this (and I'm not clear what the "rules" are -- e.g. do those delimiters have to be alone on a line?). So I only included lineComment for now.;
and;;
equally. We'd probably want uncomment to fully strip either flavor, which we don't support yet. But Clojure being functional, toggling line comments also seems very rare -- toggling block comments might be useful, except it seems Clojure doesn't offer block comments. So I've left Clojure out for now.