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

LSP rename fails on neovim #1095

Open
leg100 opened this issue Mar 11, 2025 · 0 comments
Open

LSP rename fails on neovim #1095

leg100 opened this issue Mar 11, 2025 · 0 comments

Comments

@leg100
Copy link

leg100 commented Mar 11, 2025

Describe the bug
Attempting to rename a symbol and all references to the symbol in Neovim fails with an error.

To Reproduce

  1. Run neovim with the config at https://gist.github.com/leg100/8ae759fc9356f2c130a8772532138bc7
  2. Setup the "hello world" quick start demo from the documentation.
  3. Move cursor to the "hello" symbol on the component in hello.templ.
  4. Trigger a rename (using gn with the linked neovim config).

Expected behavior
I'd expect the symbol hello to be renamed to the target, e.g. hola, in hello.templ as well as the reference in main.go.

Screenshots

See https://gist.github.com/leg100/8ae759fc9356f2c130a8772532138bc7?permalink_comment_id=5486537#gistcomment-5486537

Logs

{"time":"2025-03-11T21:22:11.409720421Z","level":"INFO","msg":"lsp: starting up..."}
{"time":"2025-03-11T21:22:11.409777591Z","level":"INFO","msg":"lsp: starting gopls..."}
{"time":"2025-03-11T21:22:11.409806061Z","level":"INFO","msg":"creating gopls client"}
{"time":"2025-03-11T21:22:11.409817775Z","level":"INFO","msg":"creating proxy"}
{"time":"2025-03-11T21:22:11.409820001Z","level":"INFO","msg":"creating templ server"}
{"time":"2025-03-11T21:22:11.409823044Z","level":"INFO","msg":"starting debug http server","addr":"localhost:7474"}
{"time":"2025-03-11T21:22:11.409838662Z","level":"INFO","msg":"listening"}
{"time":"2025-03-11T21:22:11.410815015Z","level":"INFO","msg":"client -> server: Initialize"}
{"time":"2025-03-11T21:22:11.454280929Z","level":"INFO","msg":"found file","path":"/home/louis/co/hello-world"}
{"time":"2025-03-11T21:22:11.454295683Z","level":"INFO","msg":"found file","path":"/home/louis/co/hello-world/go.mod"}
{"time":"2025-03-11T21:22:11.454298564Z","level":"INFO","msg":"found file","path":"/home/louis/co/hello-world/go.sum"}
{"time":"2025-03-11T21:22:11.454301036Z","level":"INFO","msg":"found file","path":"/home/louis/co/hello-world/hello.templ"}
{"time":"2025-03-11T21:22:11.454509337Z","level":"INFO","msg":"setting source map cache contents","uri":"file:///home/louis/co/hello-world/hello.templ"}
{"time":"2025-03-11T21:22:11.454515688Z","level":"INFO","msg":"found file","path":"/home/louis/co/hello-world/hello_templ.go"}
{"time":"2025-03-11T21:22:11.454518535Z","level":"INFO","msg":"found file","path":"/home/louis/co/hello-world/main.go"}
{"time":"2025-03-11T21:22:11.454520797Z","level":"INFO","msg":"found file","path":"/home/louis/co/hello-world/templ.log"}
{"time":"2025-03-11T21:22:11.454523785Z","level":"INFO","msg":"client -> server: Initialize end"}
{"time":"2025-03-11T21:22:11.455722358Z","level":"INFO","msg":"client -> server: Initialized"}
{"time":"2025-03-11T21:22:11.455778279Z","level":"INFO","msg":"client -> server: Initialized end"}
{"time":"2025-03-11T21:22:11.456045795Z","level":"INFO","msg":"client <- server: WorkDoneProgressCreate"}
{"time":"2025-03-11T21:22:11.456049795Z","level":"INFO","msg":"client -> server: DidOpen","uri":"file:///home/louis/co/hello-world/hello.templ"}
{"time":"2025-03-11T21:22:11.45617846Z","level":"INFO","msg":"setting source map cache contents","uri":"file:///home/louis/co/hello-world/hello.templ"}
{"time":"2025-03-11T21:22:11.456210855Z","level":"INFO","msg":"client -> server: DidOpen end"}
{"time":"2025-03-11T21:22:11.45670906Z","level":"INFO","msg":"client <- server: Progress"}
{"time":"2025-03-11T21:22:11.456812946Z","level":"INFO","msg":"client <- server: Configuration"}
{"time":"2025-03-11T21:22:11.461598176Z","level":"INFO","msg":"client <- server: LogMessage","message":"2025/03/11 21:22:11 Created View (#1)\n\tdirectory=/home/louis/co/hello-world\n\tview_type=\"GoMod\"\n\troot_dir=\"file:///home/louis/co/hello-world\"\n\tgo_version=\"go version go1.24.0 linux/amd64\"\n\tbuild_flags=[]\n\tenv={GOOS:linux GOARCH:amd64 GOCACHE:/home/louis/.cache/go-build GOMODCACHE:/home/louis/go/pkg/mod GOPATH:/home/louis/go GOPRIVATE: GOFLAGS: GO111MODULE: GOTOOLCHAIN:auto GOROOT:/usr/lib/go GoVersion:24 GoVersionOutput:go version go1.24.0 linux/amd64\n ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}\n\tenv_overlay=[]\n"}
{"time":"2025-03-11T21:22:11.529673384Z","level":"INFO","msg":"client <- server: LogMessage","message":"2025/03/11 21:22:11 go/packages.Load #1\n\tview_id=\"1\"\n\tsnapshot=0\n\tdirectory=/home/louis/co/hello-world\n\tquery=[/home/louis/co/hello-world/... builtin]\n\tpackages=2\n\tduration=67.891823ms\n"}
{"time":"2025-03-11T21:22:11.542464519Z","level":"INFO","msg":"client <- server: Progress"}
{"time":"2025-03-11T21:22:11.551405541Z","level":"INFO","msg":"client <- server: PublishDiagnostics"}
{"time":"2025-03-11T21:22:12.603678486Z","level":"INFO","msg":"client <- server: PublishDiagnostics"}
{"time":"2025-03-11T21:22:12.603711859Z","level":"INFO","msg":"client <- server: PublishDiagnostics: skipping go.mod diagnostics"}
{"time":"2025-03-11T21:22:41.475241259Z","level":"INFO","msg":"client <- server: LogMessage","message":"2025/03/11 21:22:41 background imports cache refresh starting\n"}
{"time":"2025-03-11T21:22:41.581812165Z","level":"INFO","msg":"client <- server: LogMessage","message":"2025/03/11 21:22:41 background refresh finished after 119.174654ms\n"}
{"time":"2025-03-11T21:22:55.404759463Z","level":"INFO","msg":"client -> server: PrepareRename"}
{"time":"2025-03-11T21:22:55.404832654Z","level":"INFO","msg":"updatePosition: found","uri":"file:///home/louis/co/hello-world/hello.templ","fromTempl":"2:6","toGo":"9:5"}
{"time":"2025-03-11T21:22:55.418377033Z","level":"WARN","msg":"go->templ: range not found in sourcemap","range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}}}
{"time":"2025-03-11T21:22:55.418410592Z","level":"INFO","msg":"client -> server: PrepareRename end"}
{"time":"2025-03-11T21:22:57.213843586Z","level":"INFO","msg":"client -> server: Rename"}
{"time":"2025-03-11T21:22:57.277146909Z","level":"INFO","msg":"client -> server: Rename end"}
{"time":"2025-03-11T21:22:57.277210306Z","level":"INFO","msg":"client <- server: LogMessage","message":"2025/03/11 21:22:57 go/packages.Load #2\n\tview_id=\"1\"\n\tsnapshot=2\n\tdirectory=/home/louis/co/hello-world\n\tquery=[file=/home/louis/co/hello-world/hello.templ]\n\tpackages=0\n\tduration=62.309334ms\n"}

templ info output

templ info
(✓) os [ goos=linux goarch=amd64 ]
(✓) go [ location=/usr/sbin/go version=go version go1.24.0 linux/amd64 ]
(✓) gopls [ location=/home/louis/go/bin/gopls version=golang.org/x/tools/gopls v0.18.1 ]
(✓) templ [ location=/home/louis/go/bin/templ version=v0.3.833 ]

Desktop (please complete the following information):

  • OS: Linux
  • templ CLI version (templ version): v0.3.833
  • Go version (go version): go1.34.0 linux/amd64
  • gopls version (gopls version): v0.18.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant