Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Add build tag support for "Go to Definition" feature #193

Open
ramya-rao-a opened this issue Jun 9, 2017 · 3 comments
Open

Add build tag support for "Go to Definition" feature #193

ramya-rao-a opened this issue Jun 9, 2017 · 3 comments

Comments

@ramya-rao-a
Copy link
Contributor

See microsoft/vscode-go#1024

The language server doesnt return definition location when there is a build tag in the file

@keegancsmith
Copy link
Member

@ramya-rao-a we actually support an unofficial extension to LSP to specify the build tags to use https://sourcegraph.com/github.com/sourcegraph/go-langserver/-/blob/langserver/lspx.go#L41

So your initialize request would additionally specify something like

{
  ...
  "BuildContext": {
    "BuildTags": ["integration"]
  }
}

@ramya-rao-a
Copy link
Contributor Author

Am not sure how to include that when creating the language client.
I can set the intializationOptions which you will get in https://sourcegraph.com/github.com/sourcegraph/go-langserver/-/blob/pkg/lsp/service.go#L18:2

@slimsag
Copy link
Member

slimsag commented Feb 14, 2018

@ramya-rao-a To clarify what @keegancsmith said above a bit, you would specify the initializationOptions like this:

"initializationOptions": {
  ...your existing initialization options...
  "BuildContext": {
    "BuildTags": ["integration"]
  }
}

That is to say, the language server supports an unofficial extension to LSP where you can specify that BuildContext field in the initializationOptions field you normally sent on LSP client init.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants