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: import autocomplete appends suggestion instead of replacing #42748
Comments
@RomanKornev thanks for the report.
|
@stamblerre do you want to suppress completions in this case or fix the insertion? Without quotes they could be typing the optional name of the import, so popping up the completions wouldn't make sense. |
Suppressing completions sounds like it might be easiest, but it would be helpful to add the quotes for people who are new to Go. I think people who are typing a named import would know to ignore the completion results, so I think adding the quotes should be fine. What do you think? |
I would vote for suppression. It's a fluke completions show up at all, and it would require some finagling to fix the insertion. It's a good point about new Gophers, but as long as a squiggly shows up with a useful message I think they will be okay. |
Sounds good--suppression sounds like a better path forward. |
Autocompleting a import without quotes appends to the completion, producing this result: `import math "math/"`. This commit changes to skip completions when typing a import without quotes, because the users can be typing the alias of the import. Fixes: golang/go#42748
Change https://golang.org/cl/280652 mentions this issue: |
Autocompleting a import without quotes appends to the completion, producing this result: `import math "math/"`. This commit changes to skip completions when typing a import without quotes, because the users can be typing the alias of the import. Fixes: golang/go#42748
What version of Go, VS Code & VS Code Go extension are you using?
go version
to get version of Gocode -v
orcode-insiders -v
to get version of VS Code or VS Code Insidersgo env
to get the go development environment detailsGOARCH="amd64"
GOBIN=""
GOCACHE="/Users/df/Library/Caches/go-build"
GOENV="/Users/df/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/df/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/df/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.15.2/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="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/gd/ck6ncspn19115_7mxytyzw840000gp/T/go-build892077481=/tmp/go-build -gno-record-gcc-switches -fno-common"
Share the Go related settings you have added/edited
"go.useLanguageServer": true,
Describe the bug
Autocompleting
import mat
producesimport mat"math/"
Steps to reproduce the behavior:
import mat
import mat"math/"
instead ofimport "math"
Screenshots or recordings
The text was updated successfully, but these errors were encountered: