Correctly count CRLF newlines when counting line offsets. #1007
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows completion coordinates to find the correct position in the file when using Windows style newlines (CRLF). I added two simple tests which are slight tweaks of the coords_to_point_works test in core.rs.
Notably for me, this allows RLS autocomplete to function correctly when working on files with Windows style newlines.
See issue 976 in the rust-lang/rls repo. I believe this behavior was merged to the racer github repo on Jun 24, 2018 with commit 42046fc.
Example image of the autocomplete problem in VSCode on Windows. This is a file with CRLF newlines. Notice that the cursor is on line 7, but the auto-completion is for the code that exists on line 5.
Now the autocomplete will autocomplete line 5 at the end of line 5, where the user will want it to. 🎉