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: add package selector to completions #38230

Closed
tj opened this issue Apr 3, 2020 · 4 comments
Closed

x/tools/gopls: add package selector to completions #38230

tj opened this issue Apr 3, 2020 · 4 comments
Labels
Milestone

Comments

@tj
Copy link

@tj tj commented Apr 3, 2020

What version of Go are you using (go version)?

  • go version go1.14 darwin/amd64
  • golang.org/x/tools/gopls v0.3.4

What operating system and processor architecture are you using (go env)?

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/tj/Library/Caches/go-build"
GOENV="/Users/tj/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/tj/dev"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/tj/dev/src/github.com/tj/work/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/_d/sf_tjwcj7mj47vvhpkqlhvth0000gn/T/go-build680565461=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Currently all autocompletion using a package selector will omit the selector. For example if you have a t *testing.T, and type t.Run the completed signature will be the following, omitting t *testing.T, so you have to manually correct it.

t.Run(name string, f func(t *T))

The same happens with any other package, for example while filling fields you'll get []Job in the completion here:

in := client.AddJobsInput{
  Jobs: []Job,
}

Where it should be:

in := client.AddJobsInput{
  Jobs: []client.Job,
}

(this is in VS Code, if it matters)

@gopherbot gopherbot added this to the Unreleased milestone Apr 3, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Apr 3, 2020

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@muirdm
Copy link

@muirdm muirdm commented Apr 3, 2020

This is due to the type alias workaround (https://go-review.googlesource.com/c/tools/+/208497) where we format the *ast.Field.Type expression directly. It has no notion of the types.Qualifier.

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.5.0 Apr 3, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Apr 3, 2020

Thanks for the issue report, @tj! We'll aim to get a fix for this into gopls/v0.5.0.

@gopherbot
Copy link

@gopherbot gopherbot commented Apr 22, 2020

Change https://golang.org/cl/229319 mentions this issue: internal/lsp: correctly handle type aliases when formatting

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
4 participants
You can’t perform that action at this time.