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

Missing "run package tests | run file tests" lens when gopls test codelens is enabled #1182

Closed
ronakg opened this issue Feb 3, 2021 · 2 comments

Comments

@ronakg
Copy link

ronakg commented Feb 3, 2021

Please answer these questions before submitting your issue. Thanks!

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

  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.15.7 darwin/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
Build info
----------
golang.org/x/tools/gopls v0.6.5
    golang.org/x/tools/gopls@v0.6.5 h1:kLt9rD/dWtVdvc8LmdcxagDFih6zxYXREpKSYYZu5KE=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/google/go-cmp@v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/mod@v0.4.0 h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8=
    golang.org/x/sync@v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
    golang.org/x/sys@v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=
    golang.org/x/tools@v0.1.1-0.20210201201750-4d4ee958a9b7 h1:/wdPW261t381NDQd8TBo63/FyvACfLICwtH8wMRoHJQ=
    golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
    honnef.co/go/tools@v0.0.1-2020.1.6 h1:W18jzjh8mfPez+AwGLxmOImucz/IFjpNlrKVnaj2YVc=
    mvdan.cc/gofumpt@v0.1.0 h1:hsVv+Y9UsZ/mFZTxJZuHVI6shSQCtzZ11h1JEFPAZLw=
    mvdan.cc/xurls/v2@v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
1.52.1
ea3859d4ba2f3e577a159bc91e3074c5d85c0523
x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.22.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
Checking configured tools....
GOBIN: undefined
toolsGopath: 
gopath: /Users/rogandhi/go
GOROOT: /usr/local/Cellar/go/1.15.7_1/libexec
PATH: /Users/rogandhi/.sdkman/candidates/maven/current/bin:/Users/rogandhi/.sdkman/candidates/gradle/current/bin:/usr/local/opt/openssl@1.1/bin:/Users/rogandhi/.rbenv/shims:/Users/rogandhi/.pyenv/shims:/Users/rogandhi/go/bin:/Users/rogandhi/.local/bin:/usr/local/bin:/usr/local/sbin:/Users/rogandhi/.pyenv/bin:/Users/rogandhi/.pyenv/shims:/Users/rogandhi/.rbenv/bin:/Users/rogandhi/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/opt/X11/bin:/usr/local/bin/jamf:/Applications/Wireshark.app/Contents/MacOS:/usr/local/opt/fzf/bin

   gopkgs: /Users/rogandhi/go/bin/gopkgs installed
   go-outline: /Users/rogandhi/go/bin/go-outline installed
   gotests: /Users/rogandhi/go/bin/gotests installed
   gomodifytags: /Users/rogandhi/go/bin/gomodifytags installed
   impl: impl not installed
   goplay: goplay not installed
   dlv: /Users/rogandhi/go/bin/dlv installed
   golangci-lint: /Users/rogandhi/go/bin/golangci-lint installed
   gopls: /Users/rogandhi/go/bin/gopls installed

go env
Workspace Folder (ise-go): /Users/rogandhi/work/ise-go
	GO111MODULE=""
	GOARCH="amd64"
	GOBIN=""
	GOCACHE="/Users/rogandhi/Library/Caches/go-build"
	GOENV="/Users/rogandhi/Library/Application Support/go/env"
	GOEXE=""
	GOFLAGS=""
	GOHOSTARCH="amd64"
	GOHOSTOS="darwin"
	GOINSECURE=""
	GOMODCACHE="/Users/rogandhi/go/pkg/mod"
	GONOPROXY=""
	GONOSUMDB=""
	GOOS="darwin"
	GOPATH="/Users/rogandhi/go"
	GOPRIVATE=""
	GOPROXY="https://proxy.golang.org,direct"
	GOROOT="/usr/local/Cellar/go/1.15.7_1/libexec"
	GOSUMDB="sum.golang.org"
	GOTMPDIR=""
	GOTOOLDIR="/usr/local/Cellar/go/1.15.7_1/libexec/pkg/tool/darwin_amd64"
	GCCGO="gccgo"
	AR="ar"
	CC="clang"
	CXX="clang++"
	CGO_ENABLED="1"
	GOMOD="/Users/rogandhi/work/ise-go/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/f1/d20cq36s6gn1kj0vgdv855t00000gn/T/go-build360183974=/tmp/go-build -gno-record-gcc-switches -fno-common"

Share the Go related settings you have added/edited

{
    "[go]": {
        "editor.codeActionsOnSave": {
            "source.fixAll": true,
            "source.organizeImports": true
        },
        "editor.formatOnSave": true
    },
    "editor.wordWrap": "bounded",
    "editor.wordWrapColumn": 100,
    "go.addTags": {
        "transform": "camelcase"
    },
    "go.autocompleteUnimportedPackages": true,
    "go.buildOnSave": "workspace",
    "go.coverOnSingleTest": true,
    "go.coverOnSingleTestFile": true,
    "go.coverOnTestPackage": true,
    "go.coverShowCounts": false,
    "go.coverageDecorator": {
        "type": "highlight"
    },
    "go.editorContextMenuCommands": {
        "addImport": true,
        "addTags": true,
        "debugTestAtCursor": true,
        "generateTestForFile": true,
        "generateTestForFunction": true,
        "generateTestForPackage": true,
        "playground": true,
        "removeTags": true,
        "testAtCursor": true,
        "testCoverage": true,
        "testFile": true,
        "testPackage": true,
        "toggleTestFile": true
    },
    "go.formatTool": "goimports",
    "go.gotoSymbol.ignoreFolders": [
        "vendor"
    ],
    "go.gotoSymbol.includeImports": true,
    "go.languageServerExperimentalFeatures": {
        "diagnostics": true,
        "documentLink": true
    },
    "go.enableCodeLens": {
        "references": false,
        "runtest": false,
    },
    "go.lintOnSave": "workspace",
    "go.lintTool": "golangci-lint",
    "go.testFlags": [
        "-v"
    ],
    "go.testTimeout": "10m",
    "go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
    "go.useLanguageServer": true,
    "gopls": {
        "analyses": {
            "fieldalignment": false,
            "fillreturns": true,
            "nonewvars": true,
            "shadow": true,
            "undeclaredname": true,
            "unreachable": true,
            "unusedparams": true
        },
        "codelenses": {
            "references": false,
            "test": true
        },
        "gofumpt": true,
        "usePlaceholders": true
    },
    "search.exclude": {
        "**/vendor": true
    }
}

Describe the bug

I have disabled the extension's test codelens and have enabled gopls' test codelens. The gopls' version of test codelens does not generate the package/file level code lenses.

Example of extension's version of test codelens at the top of the file:

image

This is missing when enabling gopls' version of test codelens.

@stamblerre
Copy link
Contributor

I would recommend disabling the gopls code lenses -- the gopls code lenses are actually meant for other editors that don't have these test code lenses, and VS Code Go's are more advanced.

@hyangah
Copy link
Contributor

hyangah commented Feb 4, 2021

Duplicate of golang/go#36787 (comment)
We plan to utilize the info from gopls if the issue is resolved - still we will need to replace the code lens's commands with the extension's implementation.

@hyangah hyangah closed this as completed Feb 4, 2021
@golang golang locked and limited conversation to collaborators Feb 4, 2022
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