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: requests fail with type errors #36249

Closed
Lis2T opened this issue Dec 22, 2019 · 5 comments
Closed

x/tools/gopls: requests fail with type errors #36249

Lis2T opened this issue Dec 22, 2019 · 5 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@Lis2T
Copy link

Lis2T commented Dec 22, 2019

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

$ go version
go version go1.13.5 darwin/amd64

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=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/yuki/Library/Caches/go-build"
GOENV="/Users/yuki/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/yuki/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.13.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.5/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/yuki/Documents/GitHub/go_interpreter/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sk/tgf7xxtj0534t8wwr4h0g0sc0000gn/T/go-build223359251=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Run Vscode with the latest vscode-go extension and gopls language server on.

I opened random go file, gopls logs:

[Error - 12:13:36 AM] Request textDocument/codeAction failed.
  Message: /Users/yuki/Documents/GitHub/go_interpreter/hello.go:14:1: expected declaration, found Pri
  Code: 0 

And autosuggest is broken too.
Screen Shot 2019-12-23 at 0 13 49

Similar Case#31492
I create .code-workspace file, but still does not work.

{
  "folders": [
    {
      "path": "/Users/yuki/Documents/GitHub/go_interpreter"
    }
  ],

What did you expect to see?

gopls works with vscode.

What did you see instead?

Request textDocument/* failed.

@gopherbot gopherbot added this to the Unreleased milestone Dec 22, 2019
@gopherbot gopherbot added Documentation Tools This label describes issues relating to any tools in the x/tools repository. labels Dec 22, 2019
@gopherbot
Copy link

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Dec 22, 2019
@muirdm
Copy link

muirdm commented Dec 23, 2019

Currently you have a syntax error which gopls is reporting: expected declaration, found Pri. What do you expect "Pri" to complete to?

Only func/var/type/const declarations are valid at the file level. gopls in general does not work well when faced with syntax errors.

@stamblerre stamblerre modified the milestones: Unreleased, gopls v1.0 Dec 23, 2019
@stamblerre stamblerre added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 23, 2019
@stamblerre stamblerre changed the title x/tools/cmd/gopls: "Request textDocument/definition failed", x/tools/gopls: requests fail with type errors Dec 23, 2019
@Lis2T
Copy link
Author

Lis2T commented Dec 31, 2019

Currently you have a syntax error which gopls is reporting: expected declaration, found Pri. What do you expect "Pri" to complete to?

Only func/var/type/const declarations are valid at the file level. gopls in general does not work well when faced with syntax errors.

Thanks for replying, This is just one example.

gopls doesn't work yet. For example, I have enabled completeUnimported, but the predictions show different ones.
Screen Shot 2019-12-31 at 9 59 22

This is my settings.json.
I enabled the language server.
Screen Shot 2019-12-31 at 10 00 16

@muirdm
Copy link

muirdm commented Dec 31, 2019

Completions don't work at the top level of the file. Try completing inside a function.

@Lis2T
Copy link
Author

Lis2T commented Dec 31, 2019

Completions don't work at the top level of the file. Try completing inside a function.

Thanks! I was a misunderstanding gopls working.

@Lis2T Lis2T closed this as completed Dec 31, 2019
@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.4.0 Jul 22, 2020
@golang golang locked and limited conversation to collaborators Jul 22, 2021
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. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants