Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

CodeLens references do not work in module mode if it is in another file #3003

Closed
karim opened this issue Jan 26, 2020 · 4 comments
Closed

CodeLens references do not work in module mode if it is in another file #3003

karim opened this issue Jan 26, 2020 · 4 comments
Labels
go-modules Related to Go modules upstream-gopls Issue for gopls

Comments

@karim
Copy link

karim commented Jan 26, 2020

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go
    • go version go1.13.6 windows/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 1.41.1 26076a4de974ead31f97692a0d32f90d735645c0 x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.12.0
  • Run go env GOOS GOARCH to get the operating system and processor arhcitecture details
    • windows amd64

Share the Go related settings you have added/edited

"go.useLanguageServer": true,
"go.languageServerExperimentalFeatures": {
    "documentLink": false,
},
"gopls": {
    "completeUnimported": true,
    "hoverKind": "FullDocumentation",
    "staticcheck": true,
},
"go.enableCodeLens": {
    "references": true,
    "runtest": true
}

Describe the bug

Showing references does not work in module mode if they are in different files.

2

However, if I moved the function to the same file it works.

3

Or if I moved the whole project inside GOPATH.

1

@stamblerre
Copy link
Contributor

This is probably because the references codelens relies on the default references provider, which I would guess doesn't work with modules (see here). We should be able to get the references provider from the language server if it's in use. Does that sound right to you, @ramya-rao-a?

@ramya-rao-a
Copy link
Contributor

The catch is in figuring out if the extension can call the reference provider from the language server.
Am not sure if that is possible..

I would suggest that we start looking into the language server it self implementing the code lens

@stamblerre
Copy link
Contributor

That sounds reasonable. Filed golang/go#36787 to track this upstream.

@ramya-rao-a
Copy link
Contributor

Thanks @stamblerre

@karim Closing this issue in favor of the upstream issue logged above.
There is no further work in guru to fix references in module mode, so we will need to wait for gopls, the language server to support this.

@ramya-rao-a ramya-rao-a added upstream-gopls Issue for gopls and removed under-discussion labels Jan 27, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
go-modules Related to Go modules upstream-gopls Issue for gopls
Projects
None yet
Development

No branches or pull requests

3 participants