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: Autocompletion not working when typing function parameters #41845

Open
asankov opened this issue Oct 7, 2020 · 5 comments
Open

x/tools/gopls: Autocompletion not working when typing function parameters #41845

asankov opened this issue Oct 7, 2020 · 5 comments
Labels

Comments

@asankov
Copy link

@asankov asankov commented Oct 7, 2020

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

$ go version
go version go1.14.4 darwin/amd64

Does this issue reproduce with the latest release?

Haven't tried, but pretty sure it will. Can try it, if necessary.

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

go env Output
$ go env
$ go env    
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/anton_sankov/Library/Caches/go-build"
GOENV="/Users/anton_sankov/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY="none"
GONOSUMDB="*"
GOOS="darwin"
GOPATH="/Users/anton_sankov/go"
GOPROXY="https://artifactory-pub.bit9.local/artifactory/api/go/go"
GOROOT="/usr/local/Cellar/go/1.14.4/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.14.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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/3t/hsk9366s0h18crx6q0ygdn08g_3694/T/go-build677967668=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

What the problem is is better explained with video:

completion1

I am typing the function acceptString, I get a completion hint, click Enter and am send to enter the function arguments. However, once there the autocompletion does not work - it does not suggest anything to me, even when I start writing the function name(or variable name).

Workaround: If I press Esc twice, the autocompletion is working again. See:
completion2

Here, I type ret, then press Esc twice, and upon pressing u I get a suggestion to use returnString. However, now I have lost the parameter hints and have to trigger them again, which is not ideal for functions that accept more than 1 argument.

What did you expect to see?

I expect to have suggestions upon clicking Enter and start entering something.

What did you see instead?

No suggestions, until I press Esc twice and get out of that context.

I am willing to work on this and contribute a PR, if you would help me with finding where approximately is the code that handles this.

@gopherbot gopherbot added this to the Unreleased milestone Oct 7, 2020
@muirdm
Copy link

@muirdm muirdm commented Oct 7, 2020

I think this is a VSCode issue. Try adding the below to your settings:

"[go]": {
    "editor.suggest.snippetsPreventQuickSuggestions": false,
}

@stamblerre should the Go extension set this by default? I don't really know the full impact.

@asankov
Copy link
Author

@asankov asankov commented Oct 7, 2020

yes, you are right. Setting this option resolved the issue.

Shall we keep it open until we figure out if we extension should set it to false by default?

@hyangah
Copy link
Contributor

@hyangah hyangah commented Oct 7, 2020

"editor.suggest.snippetsPreventQuickSuggestions": false will have side-effect (even vscode team switched the default back and forth). https://github.com//Microsoft/vscode/issues/50776, ... Not sure what's preferable.

@stamblerre stamblerre removed this from the Unreleased milestone Oct 8, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Oct 8, 2020

@hyangah: Is golang/vscode-go#49 related here?
Also, should this be moved to the vscode-go issue tracker?

@asankov
Copy link
Author

@asankov asankov commented Oct 12, 2020

Thank you for the suggestions.

I solved my problem by changing the snippetsPreventQuickSuggestions options, so I am ok with closing this now. Of course, you can keep it open for tracking if you want to.

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