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/gopls: signatureHelp should return position info for signatures #32468

Open
myitcv opened this issue Jun 6, 2019 · 7 comments

Comments

Projects
None yet
4 participants
@myitcv
Copy link
Member

commented Jun 6, 2019

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

$ go version
go version devel +385b2e0cac Fri May 24 21:34:53 2019 +0000 linux/amd64
$ go list -m golang.org/x/tools
golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/home/myitcv/gostuff/src/github.com/myitcv/govim/cmd/govim/.bin"
GOCACHE="/home/myitcv/.cache/go-build"
GOENV="/home/myitcv/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/myitcv/gos"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/myitcv/gostuff/src/github.com/myitcv/govim/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-build579955727=/tmp/go-build -gno-record-gcc-switches"

The signature help call from client to server (https://github.com/Microsoft/language-server-protocol/blob/gh-pages/specification.md#signature-help-request-leftwards_arrow_with_hook) returns a list of signatures:

type SignatureHelp struct {
	Signatures []SignatureInformation `json:"signatures"`
	ActiveSignature float64 `json:"activeSignature"`
	ActiveParameter float64 `json:"activeParameter"`
}

type SignatureInformation struct {
	Label string `json:"label"`
	Documentation string `json:"documentation,omitempty"` 
	Parameters []ParameterInformation `json:"parameters,omitempty"`
}

type ParameterInformation struct {
	Label string `json:"label"` 
	Documentation string `json:"documentation,omitempty"` 
}

But what's strange is that the signature information does not include position information, i.e. the start (and end, where it's valid/available) of where the call signature is valid: think the starting ( (to the end )).

This position information is valuable to my mind because it tells the client where to place, for example, a popup window.


cc @stamblerre @ianthehat

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jun 7, 2019

According to the LSP spec, the ParameterInformation struct can include position information instead of a label. If we used that, would it be enough to solve this problem?

@myitcv

This comment has been minimized.

Copy link
Member Author

commented Jun 7, 2019

Oh wow, I totally missed that comment, thanks.

Yes, if this is position information like other places in the spec, should be fine!

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jun 10, 2019

@pjweinb: Would it be possible for us to make this change in the protocol generator?

@pjweinb

This comment has been minimized.

Copy link
Contributor

commented Jun 10, 2019

@pjweinb

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

@stamblerre: could you add a [2]float64 field to ParameterInformation in lsp/source/signature_help.go? It does't matter what you name it, but once it exists (and gets filled in), we can change line 57 in signature_help.go to use the new field in place of p.Label.

@stamblerre stamblerre changed the title x/tools/cmd/gopls: signatureHelp should return position info for signatures x/tools/gopls: signatureHelp should return position info for signatures Jul 2, 2019

@myitcv

This comment has been minimized.

Copy link
Member Author

commented Jul 8, 2019

@stamblerre @pjweinb - is there anything I can do to help move this along?

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jul 8, 2019

I'm sorry, this is a slightly lower priority issue for us right now. I will have to make the changes Peter requested before we can change the generator, but I haven't had a chance to get to this yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.