github-linguist / linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
MIT License
12.34k stars 4.27k forks source link

Fix syntax highlighting of Clojure code #1721

Closed qerub closed 10 years ago

qerub commented 10 years ago

It has gotten really bad after https://github.com/github/linguist/pull/1707.

vmg commented 10 years ago

I'm afraid this is not a very good issue report. Can you please post specific details? Screenshots of issues when highlighting would be ideal. Thanks!

qerub commented 10 years ago

Sure. Here are three examples:

screen shot 2014-11-16 at 14 59 13

  1. 42 shouldn't be red.
  2. foo->bar should be lexed as a single token.
  3. EXPLODE-VERY-LOUDLY! should also be lexed as a single token.

@technomancy: Have you got some more examples?

(I was feeling grumpy when I filed the issue and the problems seemed "obvious" in the moment. Sorry.)

qerub commented 10 years ago

Here's another one found in the wild:

screen shot 2014-11-16 at 15 22 43

technomancy commented 10 years ago

While the new color choices are questionable, it's mostly the hideous red background that makes me cringe.

https://github.com/ztellman/cambrian-collections/blob/master/project.clj#L13-L15

Racket is affected by this too; arguably even worse, since square brackets may be used interchangably with regular parens:

https://github.com/technomancy/atreus/blob/master/atreus.rkt#L223-226

vmg commented 10 years ago

Thanks for the feedback, guys. I definitely agree that TextMate's Clojure grammar (i.e. the one recommended in the official Clojure documentation) is lacking compared to the old syntax highlighting.

I've spent my morning iterating on the grammar on a fork (https://github.com/vmg/textmate-clojure/compare/vmg/fixes?expand=1) and will continue do it as reports keep coming in. I'll try to deploy this later today or tomorrow so you can see the progress. I believe I have fixed all the issues reported in this thread, but will keep digging in.

Again, the TextMate grammar is open-source and Pull Requests are very appreciated. The more the grammar improves, the better Clojure support we'll have for GitHub, and for TextMate, and for Sublime Text, and for Atom, and the open-source community will be richer and candy will literally rain from the skies and so on.

Thanks again, and please bear with us while we polish this new syntax highlighting.

hiredman commented 10 years ago

as a data point, in the 2014 state of clojure survey, 4.03% of responders chose "Other" as their editor/ide while 3.96% chose "Sublime Text" https://cognitect.wufoo.com/reports/state-of-clojure-2014-results/

(it shouldn't be surprising that the textmate grammar isn't good)

aroben commented 10 years ago

The examples that @technomancy pointed out are fixed now. Please feel free to open new issues if you discover more problems.

qerub commented 10 years ago

The issues I had observed are gone now as well. Thanks! :+1: