/ go Public
x/tools/gopls: be more careful when computing edits or positions on fixed source #58120
Issues related to file corruption in gopls
Issues related to parsing / poor parser recovery.
Issues related to the Go language server, gopls.
This label describes issues relating to any tools in the x/tools repository.
There are a few places where gopls pre-processes source code to improve parsing (
Surprisingly, this isn't taken into account in many places where it should be: wherever we compute positions or edits based on fixed syntax. I suspect that it isn't (usually) an issue in practice because the source fixups are limited in scope, and people don't generally try to work on source code with parse errors. Nevertheless, we should fix this. One straightforward solution may be to express the source fixes as edits, and use them to invert positions computed from the resulting parsed syntax. We'd need to remove all token.Pos helper methods from
protocol.Mapper, and lift them to
source.ParsedGoFile, where they can be interpreted correctly.
The text was updated successfully, but these errors were encountered: