Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Fix difference in CRLF line ending handling between tree-sitter and text-buffer #16738

Merged
merged 1 commit into from Feb 14, 2018

Conversation

maxbrunsfeld
Copy link
Contributor

@maxbrunsfeld maxbrunsfeld commented Feb 14, 2018

Fixes #16642
Fixes #16643

Tree-sitter allows tokens to end between CR and LF characters. For exampe, in JavaScript, line comment tokens always end at a LF character; if the file uses CRLF line endings, the comment token will include the the preceding CR character.

Text-buffer on the other hand, does not consider the position between a CR and and LF to be a valid position. It does not let you read or write changes between those characters.

To compensate for this difference in position semantics, I've had to add a special case to the TreeSitterTextBufferInput for the situation where the Tree-sitter parser decides to seek to the position right between a CR and an LF.

@maxbrunsfeld maxbrunsfeld merged commit 2ef0bc5 into master Feb 14, 2018
@maxbrunsfeld maxbrunsfeld deleted the mb-tree-sitter-crlf-handling branch February 14, 2018 17:38
maxbrunsfeld pushed a commit that referenced this pull request Feb 14, 2018
Fix difference in CRLF line ending handling between tree-sitter and text-buffer
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant