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: formatting introducing bad edits #40800
Comments
@Aukstkalnis Wow, it's bad. It looks like the language server is in bad state. Can you turn on the language server debug tracing and share the trace? Here is the instruction. The gopls team may need the full trace to inspect how the server ended up in the bad state. /cc @stamblerre |
Thanks for the report - transferred this to the |
I am using v0.4.4. I made some log while editing the code by removing that pasted text after saving and saving again, and adding some text and saving again. Hope it will help. For me it is easy to to reproduce this problem. So if you need to test something just name it :) |
I suspect the issue is related to line endings somehow. gopls is sending a giant edit for organize imports.
Note that there's one edit per line, plausibly at the end, removing one character from each. We've had problems like this in the past, but I thought we'd fixed them. |
@Aukstkalnis can you check that you don't have any extensions installed that might be changing the file in ways that conflict with gopls? |
Never mind, this is probably a dupe of #40355, the fix for which has not yet been released. You can wait for the next release, or use the master version of gopls. |
Duplicate of #40355 |
Please answer these questions before submitting your issue. Thanks!
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 Insiders- 1.48.0 db40434f562994116e5b21c24015a2e40b2504e6
x64
- 0.16.1
go env
to get the go development environment detailsset GO111MODULE=auto
set GOARCH=386
set GOHOSTARCH=386
set GOHOSTOS=windows
set GOMODCACHE=D:\Projects\Go_Projects\GoPath\pkg\mod
set GONOPROXY=gitlab.com/Aukstkalnis/go-teltonika/*
set GONOSUMDB=gitlab.com/Aukstkalnis/go-teltonika/*
set GOOS=windows
set GOPATH=D:\Projects\Go_Projects\GoPath
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\go
set GOSUMDB=sum.golang.org
set GOTOOLDIR=C:\go\pkg\tool\windows_386
set GCCGO=gccgo
set GO386=sse2
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m32 -mthreads -fmessage-length=0 -fdebug-prefix-map=D:\Temp\go-build110131278=/tmp/go-build -gno-record-gcc-switches
Share the Go related settings you have added/edited
"go.docsTool": "guru",
"go.vetOnSave": "off",
"go.formatTool": "gofmt",
"go.autocompleteUnimportedPackages": true,
"go.buildOnSave": "off",
"go.useLanguageServer": true,
Describe the bug
When I save file, some unexpected text is added.
Steps to reproduce the behavior:
I don't know. This sometimes happens in normal code, and today happened in testing file.
Screenshots or recordings
The text was updated successfully, but these errors were encountered: