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
0netrickp0ny opened this issue Dec 22, 2019 · 5 comments
Closed

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

0netrickp0ny opened this issue Dec 22, 2019 · 5 comments

Comments

@0netrickp0ny
Copy link

@0netrickp0ny 0netrickp0ny 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

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Dec 22, 2019

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 label Dec 22, 2019
@muirdm

This comment has been minimized.

Copy link

@muirdm 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 changed the title x/tools/cmd/gopls: "Request textDocument/definition failed", x/tools/gopls: requests fail with type errors Dec 23, 2019
@0netrickp0ny

This comment has been minimized.

Copy link
Author

@0netrickp0ny 0netrickp0ny 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

This comment has been minimized.

Copy link

@muirdm muirdm commented Dec 31, 2019

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

@0netrickp0ny

This comment has been minimized.

Copy link
Author

@0netrickp0ny 0netrickp0ny 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.

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
4 participants
You can’t perform that action at this time.