golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.91k stars 759 forks source link

Go explorer view opens when creating default task #3616

Open SoCuul opened 1 week ago

SoCuul commented 1 week ago

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

Version Information
* Run `go version` to get version of Go from _the VS Code integrated terminal_. - go version go1.23.3 darwin/arm64 * Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_. - golang.org/x/tools/gopls v0.16.2 * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. - 1.95.3 f1a4fb101478ce6ec82fe9627c43efbf9e98c813 arm64 * Check your installed extensions to get the version of the VS Code Go extension - v0.42.1 * Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command. - # Tools Configuration ## Environment GOBIN: undefined toolsGopath: gopath: /Users/daniel/go GOROOT: /opt/homebrew/Cellar/go/1.23.3/libexec PATH: /usr/local/opt/make/libexec/gnubin:/Users/daniel/.rbenv/shims:/Users/daniel/Library/pnpm:/Users/daniel/.nvm/versions/node/v22.11.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/daniel/.orbstack/bin:/Users/daniel/bin:/Users/daniel/Library/Python/3.11/bin:/Users/daniel/Library/Python/3.12/bin:/Users/daniel/scripts:/Users/daniel/.spicetify:/bin:/Users/daniel/go/bin:/Users/daniel/Library/Android/sdk/tools/bin:/Users/daniel/Library/Android/sdk/platform-tools:/Users/daniel/Library/Android/sdk/emulator ## Tools go: /opt/homebrew/bin/go: go version go1.23.3 darwin/arm64 gopls: /Users/daniel/go/bin/gopls (version: v0.16.2 built with go: go1.23.0) gotests: not installed gomodifytags: not installed impl: not installed goplay: not installed dlv: /Users/daniel/go/bin/dlv (version: v1.23.0 built with go: go1.23.0) staticcheck: /Users/daniel/go/bin/staticcheck (version: v0.5.1 built with go: go1.23.0) ## Go env Workspace Folder (test): /Users/daniel/test GO111MODULE='' GOARCH='arm64' GOBIN='' GOCACHE='/Users/daniel/Library/Caches/go-build' GOENV='/Users/daniel/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='arm64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/Users/daniel/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users/daniel/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/opt/homebrew/Cellar/go/1.23.3/libexec' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='local' GOTOOLDIR='/opt/homebrew/Cellar/go/1.23.3/libexec/pkg/tool/darwin_arm64' GOVCS='' GOVERSION='go1.23.3' GODEBUG='' GOTELEMETRY='local' GOTELEMETRYDIR='/Users/daniel/Library/Application Support/go/telemetry' GCCGO='gccgo' GOARM64='v8.0' AR='ar' CC='cc' CXX='c++' CGO_ENABLED='1' GOMOD='/dev/null' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/d9/cs2_nnvj1f7_mqlzxtqg5tm80000gn/T/go-build4131895757=/tmp/go-build -gno-record-gcc-switches -fno-common'

Share the Go related settings you have added/edited

{
    "go.tasks.provideDefault": false,
    "go.showWelcome": false,
    "go.survey.prompt": false,
    "go.terminal.activateEnvironment": false
}

Describe the bug

When I run Tasks: Configure Default Build Task from the command palette, the go view gets added to the explorer window within vscode. This happens instantly (without clicking any option after the configure command), with the go task provider disabled, and will not disappear until you refresh the window.

Steps to reproduce the behavior:

  1. Open the command palette
  2. Run the Tasks: Configure Default Build Task built-in command
  3. The go extension view will appear in the explorer window

Screenshots or recordings

h9jiang commented 20 hours ago

Hi SoCuul, I was able to see what you are observing in your uploaded screenshots. I can answer some of your questions based on the code written in vscode-go.

In VSCode-Go Extension's entry point, goMain.ts, we call ExplorerProvider.Setup(). This function will create the go extension view will appear in the explorer window. This means, the go extension must be initializing when you execute Tasks: Configure Default Build Task.

By taking another look of your screenshot and my local repro, when you execute the task Tasks: Configure Default Build Task, the bottom left have some notification. (It disappears very shortly) But the notification is Activating Extensions.

My best guess would be, VSCode think it's necessary to activate all the extensions to finish Tasks: Configure Default Build Task. So when you hit enter, extensions are being initialized. Before you select which task you want to configure, the initialization is already done.

image

Further, if you go to the output, you can see some log from task. And vscode-go is definitely a task provider see vscode-go wiki.

image

I found a similar issue from vscode side see issue

Is there any concern of activating vscode-go when configuring the task?

cc @hyangah