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: empty hover for an import spec #33000

Closed
movie-travel-code opened this issue Jul 9, 2019 · 1 comment
Closed

x/tools/gopls: empty hover for an import spec #33000

movie-travel-code opened this issue Jul 9, 2019 · 1 comment
Labels
Milestone

Comments

@movie-travel-code
Copy link

@movie-travel-code movie-travel-code commented Jul 9, 2019

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

$ go version
go version go1.12 darwin/amd64

$ gopls version
version v0.1.1-cmd.gopls, built in $GOPATH mode

Does this issue reproduce with the latest release?

Yes. Reproduces at the master as well.

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/henrywong/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/henrywong/workspace/gopath"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/fm/bk0wqlkj523gdp9pbtnyvxmm0000gn/T/go-build313615319=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Hover on the import package.

package main

import "fmt"

func main() {
  fmt.Println("Hellow World")
}

What did you expect to see?

Should return an empty string or more consistent contents.

What did you see instead?

Returns

```go\n\n```

it will show an redundant empty box in vs code as the figure below shows.
Screen Shot 2019-07-09 at 3 38 05 PM

@gopherbot gopherbot added this to the Unreleased milestone Jul 9, 2019
@gopherbot gopherbot added the gopls label Jul 9, 2019
movie-travel-code added a commit to movie-travel-code/tools that referenced this issue Jul 9, 2019
…n enabled.

There are some circumstances where go langserver returns '```go\n\n```',
clients may render this empty markdown string. It's better to return
an empty string instead. Related issue:
golang/go#33000.
@stamblerre stamblerre changed the title x/tools/gopls: hover on import path returns '```go\n\n```' with 'MarkupKind.Markdown' enabled. x/tools/gopls: empty hover for an import spec Jul 9, 2019
movie-travel-code added a commit to movie-travel-code/tools that referenced this issue Jul 11, 2019
Since 'IdentifierInfo' doesn't contain ast node of import spec,
gopls will construct an empty string under plaintext mode and
'```go\n\n```' under markdown mode for *ast.ImportSpec.

For now, the hovering result of import spec is the corresponding node
format. Related issue: golang/go#33000.
movie-travel-code added a commit to movie-travel-code/tools that referenced this issue Jul 11, 2019
Since 'IdentifierInfo' doesn't contain ast node of import spec,
gopls will construct an empty string under plaintext mode and
'```go\n\n```' under markdown mode for *ast.ImportSpec.

For now, the hovering result of import spec is the corresponding node
format. Related issue: golang/go#33000.
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jul 11, 2019

Change https://golang.org/cl/185357 mentions this issue: internal/lsp: support hover for *ast.ImportSpec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.