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: blank identifiers ("_") show up in Outline view #41654

Closed
aohren opened this issue Sep 27, 2020 · 2 comments
Closed

x/tools/gopls: blank identifiers ("_") show up in Outline view #41654

aohren opened this issue Sep 27, 2020 · 2 comments
Assignees
Labels
Milestone

Comments

@aohren
Copy link

@aohren aohren commented Sep 27, 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.15.2 darwin/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
Version: 1.49.2
Commit: e5e9e69aed6e1984f7499b7af85b3d05f9a6883a
Date: 2020-09-24T16:23:52.277Z (2 days ago)
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 19.6.0
  • Check your installed extensions to get the version of the VS Code Go extension
0.17.0
  • Run go env to get the go development environment details
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/adam/Library/Caches/go-build"
GOENV="/Users/adam/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/adam/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/adam/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/local/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/local/lib/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="/usr/bin/clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/xs/311gpt813yj9rkcwb6qgfz340000gn/T/go-build917392284=/tmp/go-build -gno-record-gcc-switches -fno-common"

Share the Go related settings you have added/edited

    "go.formatTool": "goimports",
    "go.docsTool": "guru",
    "go.useLanguageServer": true,
    "go.addTags": {
    
    },

Describe the bug

Package level blank identifier s("") show up in the Outline view as just "". This looks especially bizarre when setting package level variables from a multivalued return function by discarding one of the returned values.

Here's a screenshot of what I mean:
Screen Shot 2020-09-27 at 12 39 28

Steps to reproduce the behavior:

Rendering this main.go in the editor shows three _ identifiers in the Outline view:

package main

var (
	InstanceA, _ = NewMyType()
	InstanceB, _ = NewMyType()
	InstanceC, _ = NewMyType()
)

type MyType struct{}

func NewMyType() (*MyType, error) {
	return &MyType{}, nil
}

func main() {

}
@stamblerre stamblerre transferred this issue from golang/vscode-go Sep 27, 2020
@stamblerre stamblerre changed the title Blank identifiers ("_") show up in Outline view x/tools/gopls: blank identifiers ("_") show up in Outline view Sep 27, 2020
@gopherbot gopherbot added this to the Unreleased milestone Sep 27, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Sep 27, 2020

Thanks for the report! This is an issue with the language server, so I've transferred it to the language server's issue tracker. We'll aim to get this fixed for a future release.

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v1.0.0 Sep 27, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Oct 2, 2020

Change https://golang.org/cl/259142 mentions this issue: internal/lsp: don't show blank identifiers in outline

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
3 participants