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

Intellisense doesn't work inside nested project directories #265

Closed
infalmo opened this issue Jun 28, 2020 · 3 comments
Closed

Intellisense doesn't work inside nested project directories #265

infalmo opened this issue Jun 28, 2020 · 3 comments

Comments

@infalmo
Copy link

infalmo commented Jun 28, 2020

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

  • go version go1.14.4 linux/amd64
  • 1.47.0-insider 9bf6af04dcb5c2e531cedca83cd188939ca1b0db x64
  • 0.14.4
GO111MODULE="auto"
GOARCH="amd64"
GOBIN="/home/gevacrt/go/bin"
GOCACHE="/home/gevacrt/.cache/go-build"
GOENV="/home/gevacrt/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/gevacrt/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/gevacrt/cptool/pkg/codeforces/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-build524846832=/tmp/go-build -gno-record-gcc-switches"

Share the Go related settings you have added/edited

"go.useLanguageServer": true,

Describe the bug

Here is what my project directory looks like

.
├── cmd/
│   ├── myapp/
│   │   ├── file1.go
│   │   └── file2.go
│   └── myanotherapp/
│       ├── file1.go
│       └── file2.go
└── pkg/
    └── mylibrary/
        ├── file1.go
        ├── file2.go
        ├── go.mod
        └── go.sum

Importing any external library in mylibrary module (and even myapp/myotherapp), causes intellisense suggestions to not show up. However, opening any of the folders individually (like opening only folder mylibrary or myapp), resolves the error.

Steps to reproduce the behavior:

  1. Create a similar project directory structure as above
  2. Try importing an external package (in my example, github.com/urfave/cli/v2).
  3. You will observe intellisense suggestions not appearing.
  4. Doing the same by opening only the folder myapp on vscode, causes the intellisense to work correctly.

Screenshots or recordings

Screenshot_20200629_022139
Screenshot_20200629_022352

@hyangah
Copy link
Contributor

hyangah commented Jun 29, 2020

@infixint943 thanks for the report. That's a known issue. golang/go#36899 describes the current limitation and the improvement plan. Currently the best workaround is to use Workspace Folders per module - for every go.mod, add the module root using "File" > "Add Folder to Workspace". (golang/go#32394)

@stamblerre Let's create a pinned issue on vscode-go side. It became the most common issues users face nowadays.

@stamblerre
Copy link
Contributor

Good idea - done: #275.

@hyangah
Copy link
Contributor

hyangah commented Jun 30, 2020

Thanks @stamblerre

I will close this issue in favor of the pinned issue.

@hyangah hyangah closed this as completed Jun 30, 2020
@golang golang locked and limited conversation to collaborators Jun 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants