syntax highlighting is incorrect #23

Open
nf opened this Issue Oct 22, 2012 · 4 comments

3 participants

@nf
nf commented Oct 22, 2012

String literals are highlighted in green. Keywords and some pre-declared identifiers are reddish. The issue I have is with the "some". Highlighting should be consistent.

Here is the list of predeclared identifiers from the spec:
http://golang.org/ref/spec#Predeclared_identifiers
And keywords:
http://golang.org/ref/spec#Keywords

I suggest that either pre-declared identifiers should not be highlighted at all (as they may be shadowed by some other declaration), or that they should all be highlighted in a different color to keywords.

@mmcgrana
Owner

Yep I agree that consistency would be good, thanks for the report @nf.

To start I changed the toolchain to use the most recent version of Pgyments, which has helped some. In particular more tokens including boolean constants and previously-unrecognized predclareds are now recognized. There is a tradeoff now between having a different color for everything and having too many colors. I'm not thrilled about the current scheme but I think it's correctness is strictly better than the previous version.

I'll leave the issue open while we continue to think about this.

@dlintw

@nf
I"ve use pygment to generate to dlin.github.com/gobyexample, please check if it correct for you.

@nf
nf commented Sep 11, 2014

@dlintw I guess it's okay. The distinction between pre-declared identifiers (int, string) and keywords (func, var) isn't very strong int hat case, though.

@dlintw

Well, I don't want to deep into modify this problem, just call the system pygment. If there is good Go library, maybe I'll learn how to put it in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment