x/tools/cmd/gopls: Formatting/CodeAction fail on single line file #31797
Labels
FrozenDueToAge
gopls
Issues related to the Go language server, gopls.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Distilled from #31150 (comment)
I've managed to track down this particular instance of the
ToUTF16Column: point is missing offset
error to the case where a file contains a single line that is the package clause, with no trailing\n
. Here is the sequence of events fromgovim
's perspective:Sequence of events
which gives rise to the following exception:
If instead of simply writing
package main
toblah.go
I writepackage main\n
(i.e. there is a trailing newline), then I don't see any issues.This fails for both
Formatting
andCodeAction
What did you expect to see?
No error when calling either
Formatting
orCodeAction
.What did you see instead?
An error similar to the above (which I hacked to panic for the stack trace)
cc @ianthehat
The text was updated successfully, but these errors were encountered: