Skip to content

editor.suggest.insertMode is ignored when autocompleting function name from other package #2955

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

Closed
ig0rmin opened this issue Aug 29, 2023 · 2 comments
Labels
Duplicate Make it obvious when issues are closed as duplicate FeatureRequest
Milestone

Comments

@ig0rmin
Copy link

ig0rmin commented Aug 29, 2023

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
go version go1.21.0 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
Build info
----------
golang.org/x/tools/gopls v0.13.2
    golang.org/x/tools/gopls@v0.13.2 h1:Pyvx6MKvatbX3zzZmdGiFRfQZl0ohPlt2sFxO/5j6Ro=
    github.com/BurntSushi/toml@v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
    github.com/google/go-cmp@v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/exp@v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
    golang.org/x/exp/typeparams@v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
    golang.org/x/mod@v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
    golang.org/x/sync@v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
    golang.org/x/sys@v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
    golang.org/x/text@v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
    golang.org/x/tools@v0.11.2-0.20230810185051-cc6b5804b8cf h1:Oush7UwPamr2/iNeNFBuNFj89YyHn0YY69EKDdvANnk=
    golang.org/x/vuln@v0.0.0-20230110180137-6ad3e3d07815 h1:A9kONVi4+AnuOr1dopsibH6hLi1Huy54cbeJxnq4vmU=
    honnef.co/go/tools@v0.4.2 h1:6qXr+R5w+ktL5UkwEbPp+fEvfyoMPche6GkOpGHZcLc=
    mvdan.cc/gofumpt@v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
    mvdan.cc/xurls/v2@v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.21.0
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
1.81.1
6c3e3dba23e8fadc360aed75ce363ba185c49794
x64
  • Check your installed extensions to get the version of the VS Code Go extension
v0.39.1
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
Checking configured tools....
GOBIN: undefined
toolsGopath: 
gopath: /home/igor/go
GOROOT: /usr/local/go
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/usr/local/go/bin:/usr/local/go/bin:/home/igor/go/bin:/usr/local/go/bin:/home/igor/go/bin

	go:	/usr/local/go/bin/go: go version go1.21.0 linux/amd64

	gotests:	not installed
	gomodifytags:	not installed
	impl:	not installed
	goplay:	not installed
	dlv:	/home/igor/go/bin/dlv	(version: v1.21.0 built with go: go1.21.0)
	staticcheck:	/home/igor/go/bin/staticcheck	(version: v0.4.5 built with go: go1.21.0)
	gopls:	/home/igor/go/bin/gopls	(version: v0.13.2 built with go: go1.21.0)

go env
Workspace Folder (no folder): undefined
	GO111MODULE=''
	GOARCH='amd64'
	GOBIN=''
	GOCACHE='/home/igor/.cache/go-build'
	GOENV='/home/igor/.config/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='amd64'
	GOHOSTOS='linux'
	GOINSECURE=''
	GOMODCACHE='/home/igor/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='linux'
	GOPATH='/home/igor/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/usr/local/go'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
	GOVCS=''
	GOVERSION='go1.21.0'
	GCCGO='gccgo'
	GOAMD64='v1'
	AR='ar'
	CC='gcc'
	CXX='g++'
	CGO_ENABLED='1'
	GOMOD='/dev/null'
	GOWORK=''
	CGO_CFLAGS='-O2 -g'
	CGO_CPPFLAGS=''
	CGO_CXXFLAGS='-O2 -g'
	CGO_FFLAGS='-O2 -g'
	CGO_LDFLAGS='-O2 -g'
	PKG_CONFIG='pkg-config'
	GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4286429659=/tmp/go-build -gno-record-gcc-switches'

Share the Go related settings you have added/edited

User settings.json doesn't have any go settings.

Describe the bug

VSCode has an option editor.suggest.insertMode that defines behavior on accepting autocompletion suggestion. I have default "insert" setting: "Insert suggestion without overwriting text right of the cursor". When editing .go file and accepting a function name from other package this option is ignored and the text after the cursor is always owerwritten. For example:

func main() {
	str := "test"
        // Put cursor before str and type "fmt.Sprintf" then accept suggestion. 
        // "str" is always overwritten, despite editor.suggest.insertMode value
	fmt.Printf("s: %v\n", str)
}

I'm attaching a video of how it happens. I reproduced it on the freshly installed Ubuntu 22.04 with freshly installed VSCode and only Go extension installed. The bug happens only when autocompleting function name from other packages (like in example before). If the name before the dot is a name of variable the bug doesn't happen and the text isn't replaced.

I expect the editor.suggest.insertMode: insert option is to be respected and my text is never overwritten by autocompletion.

Screenshots or recordings

Screencast.from.29.08.2023.00.48.47.webm
@gopherbot gopherbot added this to the Untriaged milestone Aug 29, 2023
@hyangah
Copy link
Contributor

hyangah commented Aug 30, 2023

Thanks for the detailed report!
This is a duplicate of golang/go#61215
Closing in favor of the issue in the Gopls issue tracker.

@hyangah hyangah closed this as not planned Won't fix, can't repro, duplicate, stale Aug 30, 2023
@hyangah hyangah added FeatureRequest Duplicate Make it obvious when issues are closed as duplicate labels Aug 30, 2023
@skeggse
Copy link

skeggse commented Aug 20, 2024

Can we reopen this now that golang/go#61215 has been fixed, to track vscode-go incorporating those changes? I assume there's a package upgrade or something needed to actually get VSCode to comply with the setting, since its still ignoring my insert setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Make it obvious when issues are closed as duplicate FeatureRequest
Projects
None yet
Development

No branches or pull requests

4 participants