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: renaming a file breaks code completion when letter capitalization changes #3414

Open
hinst opened this issue May 26, 2024 · 2 comments
Labels
gopls gopls related issues

Comments

@hinst
Copy link

hinst commented May 26, 2024

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.
    • go1.22.0 windows/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
Build info
----------
golang.org/x/tools/gopls v0.15.3
    golang.org/x/tools/gopls@v0.15.3 h1:zbdOidFrPTc8Bx0YrN5QKgJ0zCjyGi0L27sKQ/bDG5o=
    github.com/BurntSushi/toml@v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
    github.com/google/go-cmp@v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
    golang.org/x/exp/typeparams@v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
    golang.org/x/mod@v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
    golang.org/x/sync@v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
    golang.org/x/sys@v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
    golang.org/x/telemetry@v0.0.0-20240209200032-7b892fcb8a78 h1:vcVnuftN4J4UKLRcgetjzfU9FjjgXUUYUc3JhFplgV4=
    golang.org/x/text@v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
    golang.org/x/tools@v0.18.1-0.20240412183611-d92ae0781217 h1:uH9jJYgeLCvblH0S+03kFO0qUDxRkbLRLFiKVVDl7ak=
    golang.org/x/vuln@v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU=
    honnef.co/go/tools@v0.4.6 h1:oFEHCKeID7to/3autwsWfnuv69j3NsfcXbvJKuIcep8=
    mvdan.cc/gofumpt@v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=
    mvdan.cc/xurls/v2@v2.5.0 h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=
go: go1.22.0
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.89.1 dc96b837cf6bb4af9cd736aa3af08cf8279f7685 x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.41.4
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
# Tools Configuration


## Environment

GOBIN: undefined
toolsGopath: 
gopath: C:\Users\hinst\go
GOROOT: C:\Program Files\Go
PATH: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\hinst\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\dotnet\;C:\FPC\3.2.2\bin\i386-Win32;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-69.1\usr\bin;C:\Program Files\PowerShell\7\;C:\Program Files\Go\bin;C:\Program Files\usbipd-win\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files\Git\cmd;C:\HaxeToolkit\haxe;C:\Users\hinst\scoop\shims;C:\Users\hinst\AppData\Local\Programs\Python\Launcher\;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2\plugins\maven\lib\maven3\bin;C:\Users\hinst\.cargo\bin;C:\Users\hinst\AppData\Local\Yarn\bin;C:\Users\hinst\AppData\Local\Microsoft\WindowsApps;C:\Users\hinst\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\hinst\AppData\Roaming\npm;C:\Program Files (x86)\Sophos\Sophos SSL VPN Client\bin;C:\Users\hinst\AppData\Roaming\nvm;C:\Users\hinst\go\bin;C:\Users\hinst\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\hinst\go\bin;C:\Users\hinst\.azure-kubectl;C:\Users\hinst\.azure-kubelogin;C:\Users\hinst\.deno\bin;C:\Users\hinst\go\bin;C:\Users\hinst\AppData\Local\JetBrains\Toolbox\scripts;

## Tools

	go:	C:\Program Files\Go\bin\go.exe: go version go1.22.0 windows/amd64

	gopls:	C:\Users\hinst\go\bin\gopls.exe	(version: v0.15.3 built with go: go1.22.0)
	gotests:	C:\Users\hinst\go\bin\gotests.exe	(version: v1.6.0 built with go: go1.22.0)
	gomodifytags:	C:\Users\hinst\go\bin\gomodifytags.exe	(version: v1.16.0 built with go: go1.22.0)
	impl:	C:\Users\hinst\go\bin\impl.exe	(version: v1.1.0 built with go: go1.22.0)
	goplay:	C:\Users\hinst\go\bin\goplay.exe	(version: v1.0.0 built with go: go1.22.0)
	dlv:	C:\Users\hinst\go\bin\dlv.exe	(version: v1.22.0 built with go: go1.22.0)
	staticcheck:	C:\Users\hinst\go\bin\staticcheck.exe	(version: v0.4.6 built with go: go1.22.0)

## Go env

Workspace Folder (MassFood_2D): c:\Dev\MassFood_2D

	set GO111MODULE=
	set GOARCH=amd64
	set GOBIN=
	set GOCACHE=C:\Users\hinst\AppData\Local\go-build
	set GOENV=C:\Users\hinst\AppData\Roaming\go\env
	set GOEXE=.exe
	set GOEXPERIMENT=
	set GOFLAGS=
	set GOHOSTARCH=amd64
	set GOHOSTOS=windows
	set GOINSECURE=
	set GOMODCACHE=C:\Users\hinst\go\pkg\mod
	set GONOPROXY=
	set GONOSUMDB=
	set GOOS=windows
	set GOPATH=C:\Users\hinst\go
	set GOPRIVATE=
	set GOPROXY=https://proxy.golang.org,direct
	set GOROOT=C:\Program Files\Go
	set GOSUMDB=sum.golang.org
	set GOTMPDIR=
	set GOTOOLCHAIN=auto
	set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
	set GOVCS=
	set GOVERSION=go1.22.0
	set GCCGO=gccgo
	set GOAMD64=v1
	set AR=ar
	set CC=gcc
	set CXX=g++
	set CGO_ENABLED=0
	set GOMOD=c:\Dev\MassFood_2D\go.mod
	set GOWORK=
	set CGO_CFLAGS=-O2 -g
	set CGO_CPPFLAGS=
	set CGO_CXXFLAGS=-O2 -g
	set CGO_FFLAGS=-O2 -g
	set CGO_LDFLAGS=-O2 -g
	set PKG_CONFIG=pkg-config
	set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\hinst\AppData\Local\Temp\go-build2771098946=/tmp/go-build -gno-record-gcc-switches

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

"go.toolsManagement.autoUpdate": true

Describe the bug

Renaming golang source file in the project breaks code completion in that file, in cases when only letter capitalization got changed.

Expected behavior: there are no errors
Actual behavior: there are errors

Steps to reproduce the behavior:

  1. Create an empty folder and open it in VSCode
  2. Create a file named main.go
  3. Paste
    1. package main
    2. func main() {}
  4. Rename the file a few times:
    6. Main.go
    7. maiN.go
    8. application.go
    9. Application.go
    10. aPplication.go
    11. ...and so on
  5. Observe errors:
    1. No packages found for open file C:\Dev\repro\application.go
    2. case-insensitive file name collision: "maiN.go" and "main.go"

Screenshots or recordings

screenshot

@ansaba ansaba added the gopls gopls related issues label May 30, 2024
@ansaba ansaba transferred this issue from golang/vscode-go May 30, 2024
@seankhliao seankhliao changed the title Renaming a file breaks code completion when letter capitalization changes x/tools/gopls: renaming a file breaks code completion when letter capitalization changes May 30, 2024
@ansaba
Copy link

ansaba commented May 30, 2024

@hinst , can you close all the files and restart to check if issues persists?

@ansaba ansaba transferred this issue from golang/go May 30, 2024
@PETERCHUU
Copy link

I got the same problem in my repository, after I try to re-name my folder and package case,

half of my file showing case-insensitive import collision, when I trying to switch back to old name, the other half showing the same error,

I need to re-init entire mod to fix the problem .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls gopls related issues
Projects
None yet
Development

No branches or pull requests

3 participants