x/tools/gopls: index out of range while trying to run textDocument/codeAction on entire document #55300
Labels
Documentation
Issues describing a change to documentation.
FrozenDueToAge
gopls
Issues related to the Go language server, gopls.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
gopls version
go env
What did you do?
Invoke
textDocument/codeAction
passing a range that covers the entire file(following the spec for
range,
which means that the end position is exclusive). Here's what the range I'm
sending looks like (in JSON-ish):
Where
$N
= number of lines in the file.For full reproduction steps, see "Editor & Settings" below.
What did you expect to see?
The list of code actions available in the entire file.
What did you see instead?
gopls panics with an index out of range. Since this is a panic, the stacktrace
isn't available in the logs for gopls, but I'm able to get the process output
from my editor's logs:
In order to make it easier to read, I've also expanded the two lines above. This is the output from gopls:
This is a regression and I was able to bisect it to this commit:
Editor and settings
This is neovim. It can be reproduced with just gopls installed. Minimal
reproducer in neovim:
https://gist.github.com/fsouza/01bf91accbce744ae528bad2472c79f3
How to reproduce in neovim with the config file above, using some Go repo (I
tested with fake-gcs-server, but
I suspect that any project/file will do):
Logs
Logs from gopls: https://gist.github.com/fsouza/ecc217ae4f2bbdc4dbcf2033c6b34581
Logs from the editor (includes the process stderr with the crash at the very end): https://gist.github.com/fsouza/9700b8daa4658fb226440fbedf1dbff5
The text was updated successfully, but these errors were encountered: