Closed Princesseuh closed 3 months ago
Latest commit: 97a9313a3df7d2195df033ef293f18f0cbeff40a
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Changes
Previously, due to how we skipped over CRLF, we'd end up with a mapping that looks like this:
Where the first segment would contain both the last character of the line, and the
\r
. This is fine, albeit wonky, however this ends up breaking downstream in libraries that are line-ending agnostic because they don't expect than an offset would end up after a line ending, even less so in the middle of a two-characters one. (the main culprit here is https://github.com/microsoft/vscode-languageserver-node/tree/main/textDocument, see https://github.com/microsoft/vscode-languageserver-node/issues/1285)This PR fixes this by handling it like this instead:
That way, asking for the last segment of a line will instead result on the
;
, or before the two line endings, depending on which one you ask for, but nothing after or in the middle of it.Testing
Added a test
Docs
N/A