-
Notifications
You must be signed in to change notification settings - Fork 645
Semantic Highlighting #3134
Comments
The syntax highlighting is done outside of this extension. cc: @jeff-hykin @stamblerre For LSP side, maybe we need to keep an eye on the progress of microsoft/vscode-languageserver-node#367 and |
@appleton TextMate (the language-agnostic engine VS Code uses) is a very primitive parser, it will never be capable of matching GoLand. Language servers however (while slower and language-specific) can match GoLand, but building a language server is beyond my knowledge. Typescript has a somewhat unfair advantage because it is the language the VS Code team uses for everything. Naturally it is going to be prioritized over everything else, and the language server for it has had a lot of work and optimizations put into it. Here's what can be done right now with the TextMate grammar
Also be aware your theme can make a notable difference. Here's (basically) the same code on a different theme. |
Thank you for the thorough response @jeff-hykin, I appreciate it! I've cloned your syntax repo and will try to add support for the tokens you've listed as possible. I understand the language server restriction for the others. Aside: what theme is that in your screengrab? I like it! |
@appleton No problem 👍 As for cloning the repo. It might be kinda tough to contribute at the moment just because TextMate grammars are notoriously messy and hard to contribute to. However, it is much easier with a guide, and I'm happy to help be that guide. Another guy and I have been working on a library for over a year now that makes TextMate grammars manageable. He finished the inline documentation about a month ago and I have been working on a tutorial posts titled "Make a TextMate grammar (without wanting to kill yourself)". I'll probably be posting it on Medium in the next month and that should be able to jumpstart any contributions and explanations of the codebase. Well, the exact theme actually doesn't exist haha. There is a very close theme: XD Theme made by yours truly. For the screenshot I edited the theme to show what could be colored. If you want to you can add the following to your settings to recreate the screenshot. In general you can customize whatever you'd like following this brief guide. {
"editor.tokenColorCustomizations" :
{
"[XD Theme]": {
"textMateRules": [
{
"name": "green",
"scope": [
"source.go storage.type",
"source.go storage.type.string",
],
"settings": {
"foreground": "#4EC9B0",
"fontStyle": "none"
}
},
]
}
}
} |
Closing this issue as there are no next steps from the extension's side to solve the problem here. For further discussions, please log an issue at https://github.com/jeff-hykin/better-go-syntax/issues Thanks all! |
Is your feature request related to a problem? Please describe.
The syntax highlighting for Go is rather sparse by comparison to other languages (e.g. TypeScript) and other editors (e.g. GoLand).
VSCode:
GoLand:
VSCode (TypeScript):
At a glance I can see that compared to GoLand, VSCode is missing tokens for:
I'm sure there's more that I'm missing.
Describe the solution you'd like
I'd love to see VSCode's Go syntax highlighting get up to parity with other editors. I wonder if Go can make use of the new Semantic Highlighting feature added in v1.43?
Describe alternatives you've considered
I've followed a number of other issues similar to this which tend to reference other issues which tend to end up closed without resolution. I have not been able to find a currently active issue tracking this, hence opening this.
The text was updated successfully, but these errors were encountered: