mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-12-05 06:14:18 +01:00
When a request came in with a column past the end of its line, which happens when the editor's copy of the document has drifted from ours, LineTable clamped it to the end of the line including its terminator, which is really the start of the next line. In code completion, if that next line began with an identifier like `func`, the completion position landed after the cursor and building the text edit range trapped. LineTable now clamps such columns to the end of the line's content, before the newline, as LSP specifies, and completion clamps the request position once up front so that everything downstream agrees on where the cursor is. Separately, argument completions at the very end of a file read the character after the cursor to look for a closing parenthesis, which subscripted the string at its end index. That check now makes sure there is a character to look at first.