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] Add Toggle Comment support for several more languages #2875

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

[CLOSED] Add Toggle Comment support for several more languages #2875

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

Comments

@core-ai-bot
Copy link
Member

Issue by peterflynn
Thursday Mar 07, 2013 at 00:12 GMT
Originally opened as adobe/brackets#3056


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:

  • CoffeeScript supports block comments via ###, but Toggle Block Comment behaves badly (I think because the open/close delimiters are identical). So I've only included lineComment for now. Filed [CLOSED] Active line highlight doesn't disappear in unfocused editor #3057 on this.
  • I wasn't clear on whether Ruby officially supports block comments. I've seen mention of =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.
  • Clojure supposedly supports line comments, but people seem to use ; 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.

peterflynn included the following code: https://github.com/adobe/brackets/pull/3056/commits

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Friday Mar 08, 2013 at 21:47 GMT


@peterflynn Want me to review this now or after #3057 is fixed, so that you can add block comments for CoffeScript?

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Wednesday Mar 13, 2013 at 08:13 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by miketheman
Saturday Feb 01, 2014 at 23:52 GMT


@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!

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Sunday Feb 02, 2014 at 00:00 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Sunday Feb 02, 2014 at 00:05 GMT


I guess I could also fix that in this one and merge it

@core-ai-bot
Copy link
Member Author

Comment by miketheman
Sunday Feb 02, 2014 at 00:08 GMT


@TomMalbran I was looking for yaml today, hence the ping on this issue. :)

@core-ai-bot
Copy link
Member Author

Comment by ahuth
Thursday Feb 06, 2014 at 13:58 GMT


@peterflynn The rules for ruby's block comments are:

  • the =begin and =end have to be on their own lines
  • the =begin and =end have to be at the beginning of their respective line (no spaces or tabs)

As you observed, though, these are almost never used. It's probably safe to leave them out.

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Sunday Feb 16, 2014 at 23:25 GMT


Wasn't able to merge with master because of some issues with the submodules, so I did a manual merge: adobe/brackets@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.

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