-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/tools/gopls: Highlight the symbols in comments, and support jump to the definition of symbols #64648
Comments
I don't think that GoLand does the right thing either. Only |
I see this feature request is relevant to a couple of different functionalities gopls is offering.
|
@gophun Yes, I know that's the "[Name]" or "[pkg.Name]" are valid doc links (https://tip.golang.org/doc/comment#doclinks), because that's only way to accurately and quickly identify a link for package doucments. Golang recommand simplie. Most comments do not use "[]" intentionally, but types or functions often appear in comments. |
I hope "textDocument/definition" is also supported, because I hope to use one shortcut key to jump to the corresponding definition In code and comments.
The "doccumentation" modifier is suitable, bu it seems that many themes in vscode do not highlight this. |
Change https://go.dev/cl/553836 mentions this issue: |
Change https://go.dev/cl/554915 mentions this issue: |
Just to double check: will this will work with any comment, or just with godoc comments? Even if non-godoc comments don't get rendered as godoc and don't strictly speaking have support for links, I still use this format in them for the sake of consistency and clarity when I refer to a Go identifier, particularly from another package. |
@mvdan This decision is still open to discussion, although I might personally prefer not to work with any comments. |
After some discussion, due to consistency and performance considerations, it only takes effect for doc links. More details can be found in CL https://go.dev/cl/553836 |
As long as |
@mvdan Ok, now it's exactly what you expected. |
Code comments contain many references to identifiers, highlighting these references will make reading easier. Due to consistency and performance considerations, only doc links are supported this time. Subsequent changes will support hover and definition. Updates golang/go#64648 Change-Id: I6b32075d703c03d06aaa16028cf55012d2e52c3c Reviewed-on: https://go-review.googlesource.com/c/tools/+/553836 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Reviewed-by: Robert Findley <[email protected]>
Just used this for the first time, and it's so great! |
gopls version
v14.2
go env
What did you do?
unimportant
What did you expect to see?
In Golang, documentation is maintained in code comments. The comment contain a lot of symbols, Highlighting these symbols will make reading clearer. When reading the documentation, you may want to look at the definition of the commit object, so improving the ability to jump would be great.
These feature are already implemented in Goland.
Goland
Vscode
What did you see instead?
unimportant
Editor and settings
No response
Logs
No response
The text was updated successfully, but these errors were encountered: