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

gopls: set editor.suggest.snippetsPreventQuickSuggestions to true by default #839

Closed
asankov opened this issue Oct 7, 2020 · 9 comments
Closed
Assignees
Milestone

Comments

@asankov
Copy link

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.

@muirdm
Copy link

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 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 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
Copy link
Contributor

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

@asankov
Copy link
Author

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.

@hyangah hyangah transferred this issue from golang/go Oct 26, 2020
@gopherbot gopherbot added this to the Untriaged milestone Apr 8, 2021
@stamblerre stamblerre changed the title x/tools/gopls: Autocompletion not working when typing function parameters x/tools/gopls: autocompletion not working when typing function parameters Apr 9, 2021
@stamblerre
Copy link
Contributor

stamblerre commented Apr 9, 2021

@hyangah: What do you think about switching the default here? Or should we just stay in line with VS Code defaults?

@stamblerre stamblerre modified the milestones: Untriaged, Backlog Apr 9, 2021
@asankov
Copy link
Author

asankov commented Apr 10, 2021

FYI I have been using this setting ever since you recommended it to me and I have seen no issues with it.

@hyangah
Copy link
Contributor

hyangah commented Apr 12, 2021

@stamblerre I've been using the setting for a while and have no objection to switch the default.

@stamblerre stamblerre changed the title x/tools/gopls: autocompletion not working when typing function parameters gopls: set editor.suggest.snippetsPreventQuickSuggestions to true by default Apr 12, 2021
@stamblerre stamblerre self-assigned this Apr 12, 2021
@stamblerre stamblerre modified the milestones: Backlog, On Deck Apr 12, 2021
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/310754 mentions this issue: package.json: set editor.suggest.snippetsPreventQuickSuggestions to true

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

5 participants