x/tools/gopls: add codelens for references to symbols #40862
Comments
I believe that this feature is supported in GOPATH mode, but is not yet available via the language server. I have been hesitant to add it, since users should just be able to call "Find References" on a symbol to get this information. I would be curious to hear input from others before we move forward with this. |
@stamblerre, i tried following for the GOPATH mode.
i still dont see the codelens. |
The codelens is off by default, so you will need to turn it on explicitly.
But, if you are using the language server, why not use the |
@hyangah , thanks for the help |
@sanket-bhalerao Is your goal to simply check whether the variable or function is used or not (boolean decision), or you use it to really find all the locations they are used? For former, I think we can do better with color or other visualization than with codelens. For latter, maybe we should discuss more. |
@hyangah for variables its the boolean decision (as golang shows unused var as errors this part is already covered) |
@sanket-bhalerao Thanks! I will transfer this to gopls issue tracker. |
Thanks for the feature request, @sanket-bhalerao. I'd like to hear from others about the benefits of this feature. Currently, my preference would be to add the 'unused' checks from staticcheck (#36602), which might make this feature a little redundant. |
Issue Type: Feature Request
it would be nice to see if a function is referenced in the code or not.
click on the codelens and see all the places the variable, function being referenced.
variable:

functions:

Extension version: 2020.8.1301
VS Code version: Code - Insiders 1.49.0-insider (bd08768fd310d34cdd4423a53e5f3ca77340fea5, 2020-08-14T05:56:40.601Z)
OS version: Windows_NT x64 10.0.18363
The text was updated successfully, but these errors were encountered: