Open jeff-hykin opened 4 years ago
Atom upgraded (not without issues) to the Tree-Sitter parser written by Max Brunsfeld who has done an awesome job. The tree sitter is an objectively more powerful parser and is order of magnitudes more efficient than the old standard: TextMate grammar parsers. Not to mention the design and documentation is great, while TextMate does not have any official documentation at all and contains multiple design shortfalls. (TM grammars are used well-beyond their creators intended scope).
Someone has written a tree-sitter go lang grammar, which is what Atom uses.
VS Code is working on switching to tree sitter parsers https://github.com/Microsoft/vscode/issues/50140 However, the TextMate grammar parser is heavily heavily heavily integrated into VS Code. Its going to be hard to switch. I've done some work myself with George Fraser (CEO of Fivetran) and Max Burnfelds to get experimental Tree Sitter support for VS Code via an extension.
AFAIK this repo better-go-syntax
is the most up to date Go lang TextMate grammar at this time, which is what VS Code is using. I'm not a Microsoft dev or part of the vs code dev team. I wrote a library/wrapper that makes TM usable so that I could start fixing the C++ TextMate syntax (and some other syntaxes). I maintain this repo to make sure anyone who wants to fix something can fix it, and can fix it without seriously breaking other things. I do not even write Go code (although I respect the design of the Go language).
Most-up-to-date grammar isn't saying much because this is a relatively simple/primitive TextMate grammar.
First, you probably want to get a theme that colors operators like *
. I suggest Material Theme with the high-contrast option.
Next, coloring aspects like thing.member1.member2
isn't too difficult using TM.
Coloring aspects like CircleDiameter float64
could be difficult depending on the Go syntax, which I do not know enough about. In C++ struct highlighting is nearly impossible, but C++ has a very convoluted syntax.
We can break issue into feature request issues, but in TextMate things like struct definitions and struct-type usage will be separate problems and struct-type usage will likely be broken into several more sub-problems, some of which may be unsolvable.
@Jacalz If you're interested in improving the Go Syntax let me know and I can help walk you through what needs to be done.
@Jacalz If you're interested in improving the Go Syntax let me know and I can help walk you through what needs to be done.
Thanks for the offer. I would definitely be interested in helping out in any way that I can. Perhaps not right now because I have a lot to do, but in a couple weeks maybe :)
I just started using Go in vscode and started searching for this exact problem. Are there no solutions yet for this problem? Some struct heavy code I'm writing looks almost like writing without syntax highlighter :)
Originally posted on https://github.com/microsoft/vscode/issues/89288