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

no symbols found in document #442

Closed
bingoIsCoder opened this issue Jul 30, 2020 · 9 comments
Closed

no symbols found in document #442

bingoIsCoder opened this issue Jul 30, 2020 · 9 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@bingoIsCoder
Copy link

bingoIsCoder commented Jul 30, 2020

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go
    • go version go1.14.6 linux/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 1.47.3
      91899dcef7b8110878ea59626991a18c8a6a1b3e
      x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.15.2
  • Run go env to get the go development environment details
    • GO111MODULE="on"
      GOARCH="amd64"
      GOBIN=""
      GOCACHE="/home/tian/.cache/go-build"
      GOENV="/home/tian/.config/go/env"
      GOEXE=""
      GOFLAGS=""
      GOHOSTARCH="amd64"
      GOHOSTOS="linux"
      GOINSECURE=""
      GONOPROXY=""
      GONOSUMDB=""
      GOOS="linux"
      GOPATH="/home/tian/go:/mnt/e/go"
      GOPRIVATE=""
      GOPROXY="https://goproxy.io"
      GOROOT="/usr/local/go"
      GOSUMDB="sum.golang.org"
      GOTMPDIR=""
      GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
      GCCGO="gccgo"
      AR="ar"
      CC="gcc"
      CXX="g++"
      CGO_ENABLED="1"
      GOMOD="/mnt/e/go/src/test.com/myproject/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-build178762018=/tmp/go-build -gno-record-gcc-switches"

Share the Go related settings you have added/edited

"go.useLanguageServer": true,
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
},
// Optional: Disable snippets, as they conflict with completion ranking.
"editor.snippetSuggestions": "none",
},
"[go.mod]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
},
},
"gopls": {
// Add parameter placeholders when completing a function.
"usePlaceholders": true,
// If true, enable additional analyses with staticcheck.
// Warning: This will significantly increase memory usage.
"staticcheck": false,
}

Describe the bug

  1. vscode OUTLINE show: no symbols found in document 'myfile.go'
  2. go to definition not working in this file

Steps to reproduce the behavior:

Screenshots or recordings

@stamblerre
Copy link
Contributor

It looks like you have a number of language server-related features in your settings, but you don't have "go.useLanguageServer": true. Is this intentional? If you are using Go modules, I would suggest enabling the language server.

@hyangah
Copy link
Contributor

hyangah commented Jul 30, 2020

@gopherbot waitingforinfo, remove Documentation

@gopherbot gopherbot added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed Documentation labels Jul 30, 2020
@bingoIsCoder
Copy link
Author

It looks like you have a number of language server-related features in your settings, but you don't have "go.useLanguageServer": true. Is this intentional? If you are using Go modules, I would suggest enabling the language server.

I omitted setting 'go.useLanguageServer', I am using language server.

@stamblerre
Copy link
Contributor

stamblerre commented Jul 31, 2020

Ok, thanks for clarifying. In that case, can you please follow the steps in the gopls troubleshooting document and provide logs?

@bingoIsCoder
Copy link
Author

Ok, thanks for clarifying. In that case, can you please follow the steps in the gopls troubleshooting document and provide logs?

Thanks for reply. The gopls server log out:

[Trace - 14:56:52.466 PM] Sending notification '$/cancelRequest'.
Params: {"id":2}

[Error - Received] 14:56:55.078 PM #2 context canceled

[Trace - 14:56:55.078 PM] Received response 'textDocument/documentSymbol - (3)' in 2842ms.
Result: []

[Error - 2:56:55 PM] Request textDocument/codeAction failed.
Message: context canceled
Code: 0

run gopls -rpc.trace -v check /path/to/file.go, log out:

2020/07/31 14:53:26 Info:2020/07/31 14:53:26 Build info

golang.org/x/tools/gopls 0.4.3
golang.org/x/tools/gopls@v0.4.3 h1:irz7Q+XdHNECamFKbNWKvMV2Ak6zBbwdwbZndG4545I=
github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
golang.org/x/mod@v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
golang.org/x/sync@v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
golang.org/x/tools@v0.0.0-20200708181441-6004c8539734 h1:Vc0Vx98oU/O3+qPQ36fnTT5UduS55KLh2uSGbL7mqEo=
golang.org/x/xerrors@v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
honnef.co/go/tools@v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=
mvdan.cc/xurls/v2@v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=

Go info

go version go1.14.6 linux/amd64

2020/07/31 14:53:28 Info:2020/07/31 14:53:28 go env for /mnt/e/go/src/test.com/myProject
(valid build configuration = true)
(build flags: [])
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tian/.cache/go-build"
GOENV="/home/tian/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/tian/go:/mnt/e/go"
GOPRIVATE=""
GOPROXY="https://goproxy.io"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/mnt/e/go/src/test.com/myProject/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-build847279981=/tmp/go-build -gno-record-gcc-switches"

2020/07/31 14:53:33 Info:2020/07/31 14:53:33 go/packages.Load
snapshot=0
directory=/mnt/e/go/src/test.com/myProject
query=[./... builtin]
packages=23

@stamblerre
Copy link
Contributor

Based on the output of the gopls check command, it doesn't seem like there's anything going wrong. But it looks like you only shared a small snippet of the log - can you please share the complete log for the entire session?

@hyangah
Copy link
Contributor

hyangah commented Jul 31, 2020

In addition to it, also please make sure this case is a duplicate of #275 (e.g. the open file belongs to the module covered by /mnt/e/go/src/test.com/myproject/go.mod, and no other go.mod files), or the file contains any build tags.

@GrayMi
Copy link

GrayMi commented Aug 30, 2020

I guess it may be related to the gopls

I took the following measures to solve this problem.
golang/go#32394 (comment)

@stamblerre
Copy link
Contributor

There hasn't been any activity on this issue for a few months, so going to close this.
@bingoIsCoder: Please open a new issue if you encounter this problem again.

@golang golang locked and limited conversation to collaborators Nov 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants