Replies: 3 comments
-
To my understanding, this would have to be addressed in https://github.com/tree-sitter/tree-sitter-go and I don't think there's an easy way to do so as of now. All comments are captured by the same group and ther wouldn't be a way to distinguish docstrings and regular comments. Furthermore, while it is the general practice in Go it is not enforced and/or mandatory so it might not always be the case that the comment starts with the symbol name. A while back I experimented with doing the same for
where |
Beta Was this translation helpful? Give feedback.
-
If doc documents are separate syntax nodes in go then this could be solved trough an injection parser (similar to how we highlight |
Beta Was this translation helpful? Give feedback.
-
@pascalkuthe when you say syntax node, do you mean in tree-sitter? If it is, then I'd be happy to draw up a PR if this is a feature that would be fit for master. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In Go, the standard idiom is to begin docstrings with the name of the symbol being described, like so:
I propose that, similar to Goland from Jetbrains, the first term of a Go docstring be highlighted slightly differently, a bright color perhaps. I'm not sure if this would be a treesitter function or a theme function, but I personally would enjoy it, and thought others may as well.
Beta Was this translation helpful? Give feedback.
All reactions