atom / language-clojure

Clojure package for Atom
Other
49 stars 48 forks source link

Coloring/Italics for #_-based comments #83

Closed peter-lyons-kehl closed 5 years ago

peter-lyons-kehl commented 5 years ago

Thank you for language-clojure. So pleasant.

As you may know, #_ is a special reader combination for in-line comments (https://clojure.org/guides/weird_characters#_discard). It comments out the next token, which may be separated by an optional whitespace. The benefit (over commenting with a semicolon ;) is that #_ applies to blocks (and inner blocks), even on multiple lines, as far as they're well-structured. That allows to "turn on/off" parts of code, but compared to (comment ...) using #_ protects indentation/structure.

I love how currently language-clojure keeps parsing & highlighting the code after #_. That would help a user if they intentionally change such code, while keeping it commented out (perhaps as in-code comment, or for the future use). That makes it easy to keep such a comment well-formed.

However, when browsing over the code, it would help to indicate that it's a comment. Could you, please

while still keeping highlighting.

seancorfield commented 5 years ago

This feels like a duplicate of #72 to me.

peter-lyons-kehl commented 5 years ago

While similar to #72, this asks to preserve parsing & same/similar highlighting of code within #_-commented out blocks.

mattly commented 5 years ago

It's been a while since I've poked at Atom, but my understanding is that controlling if something is italic or not depends on the user's theme, not the designation by the language's grammar. Really what we need is some sort of grammar token like "example" or "non-functioning code" that themes can then choose to highlight how they want, but then I think Clojure is the only language that really has the notion of what #_ does built-in.

peter-lyons-kehl commented 5 years ago

Hi Matthew,

Thank you for explaining.

You made me realize: For the user, it's very easy to temporarily remove #_, if they need to see highlighting in the commented-out block. Hence, I admit that this feature request is not worth it.

Thank you for Atom.