mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-17 04:58:14 +00:00
When computing the token range of a declaration, we were using the first and last parse nodes to determine the first and last tokens. That's not correct -- the parse tree nodes can be in a different order from the tokens, so the first parse node need not be at the start of the declaration. For a malformed declaration such as `fn f` (with no terminator), the first and last parse nodes were both associated with the `fn` token for error recovery, meaning that the function name wasn't even within the symbol we handed back to the LSP client, in violation of the LSP requirements. This led to VS Code producing an error and discarding all symbols in the file. Assisted-by: Claude Code