Skip to content
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/internal/lsp: How to specify the scope of a gopls search? #33588

Closed
coventry opened this issue Aug 11, 2019 · 2 comments
Closed

x/tools/internal/lsp: How to specify the scope of a gopls search? #33588

coventry opened this issue Aug 11, 2019 · 2 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls.
Milestone

Comments

@coventry
Copy link

What did you do?

I'd like to use the emacs lsp-mode client to find references to a symbol, but its lsp-find-references only returns references to the symbol in the current golang package.

What did you expect to see?

I'm hoping there's a way to specify a broader scope for the search, so that all references to a symbol in a larger project can be identified, not just the ones which happen to be in the same package as the file I'm currently visiting.

What did you see instead?

Here is the message lsp-mode is sending to gopls, on an lsp-find-references request:

{
  "jsonrpc": "2.0",
  "method": "textDocument/references",
  "params": {
    "textDocument": {
      "uri": "file:///path/to/file.go"},
    "position": {
      "line": 23,
      "character": 45
    },
    "context": {
      "includeDeclaration": false
    }
  },
  "id": 2777
}

lsp-mode only seems to be getting back references to the symbol at file.go:23:45 in the same package as file.go's. Is there a way to expand the search scope?

Probably less relevant questions from the template:

What version of Go are you using (go version)?

$ go version
go version go1.12.1 linux/amd64

Does this issue reproduce with the latest release?

It does with go get golang.org/x/tools/gopls@latest, at least.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
go  env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ubuntu/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ubuntu/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/ubuntu/go/src/github.com/smartcontractkit/chainlink/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build901014584=/tmp/go-build -gno-record-gcc-switches"
@gopherbot gopherbot added this to the Unreleased milestone Aug 11, 2019
@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Aug 11, 2019
@stamblerre
Copy link
Contributor

Duplicate of #32869

@stamblerre stamblerre marked this as a duplicate of #32869 Aug 12, 2019
@coventry
Copy link
Author

Thanks for the pointer.

@golang golang locked and limited conversation to collaborators Aug 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls.
Projects
None yet
Development

No branches or pull requests

3 participants