-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: enhance read/write access distinction in document highlighting for symbols #64579
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
Comments
@pjweinb Is the |
no,only variable reassign is considered write in pylance,clangd and rust-analyzer. |
The documentation says nothing about the meaning of the 'modification' modifier, and gopls doesn't use it. I suspect the uses would vary widely by language, but I don't know what would be useful (and practical) in Go. |
The easiest definition to implement is the variable/value distinction (which C calls lvalue/rvalue). For example:
But I have no idea if that's actually what people want. As @hyangah points out with the |
I think the easiest way is what most people won't feel uncomfortable, and io.Copy example can wait for future improvement |
The simplest way is to reference the highlighting style of GoLand. |
I have a plan to implement this feature, and want to know if it is acceptable. The definition of 'write access' is same as it in GoLand. Some examples are The algorithm to find write access is same as it in jdt (Java LSP), by A darft version of implementation is here and the preview of the feature in VSCode is: |
Thanks @zhzhsx! TIL that this read/write distinction can be marked using |
… for symbols The definition of 'write access' is same as it in GoLand. Some examples are access to variables in declaration, assignment(left value), self increasing, channel sending and composite literal. The algorithm to find write access is same as it in jdt (Java LSP), by visiting every write statement in ast traversal and collecting the positions of access to variables. Fixes golang/go#64579
… for symbols The definition of 'write access' is same as it in GoLand. Some examples are access to variables in declaration, assignment(left value), self increasing, channel sending and composite literal. The algorithm to find write access is same as it in jdt (Java LSP), by visiting every write statement in ast traversal and collecting the positions of access to variables. Fixes golang/go#64579
… for symbols The definition of 'write access' is same as it in GoLand. Some examples are access to variables in declaration, assignment(left value), self increasing, channel sending and composite literal. The algorithm to find write access is same as it in jdt (Java LSP), by visiting every write statement in ast traversal and collecting the positions of access to variables. Fixes golang/go#64579
Change https://go.dev/cl/597675 mentions this issue: |
gopls version
0.14.2
go env
What did you do?
What did you expect to see?
vscode distinguishs write access and read access, most lsp implementations have it such as clangd and rust-analyzer

an rust example:
see the different color of scoped_interpreter
What did you see instead?
no color difference
Editor and settings
No response
Logs
No response
The text was updated successfully, but these errors were encountered: