Fix end line number when it exceeds the file#4130
Merged
Merged
Conversation
If the end of the error exceeds the file, set it to the last line, similarly as it is done with the beginning of the error.
70f28af to
0527404
Compare
hsanson
approved these changes
Apr 1, 2022
Contributor
hsanson
left a comment
There was a problem hiding this comment.
Thanks for the explanation and fix. Agree the fix is generic enough and is always good to protect ourselves from wrong data delievered from LSP, linters, and fixers.
w0rp
pushed a commit
that referenced
this pull request
Apr 1, 2022
If the end of the error exceeds the file, set it to the last line, similarly as it is done with the beginning of the error.
cyyever
pushed a commit
to cyyever/ale
that referenced
this pull request
Jul 11, 2022
If the end of the error exceeds the file, set it to the last line, similarly as it is done with the beginning of the error.
cyyever
pushed a commit
to cyyever/ale
that referenced
this pull request
Jul 11, 2022
If the end of the error exceeds the file, set it to the last line, similarly as it is done with the beginning of the error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If the end of the error exceeds the file, set it to the last line, similarly as it is done with the beginning of the error.
This issue was noticed by vim getting killed because of out of memory. The reason was that rust-analyzer delivered a very large number for the end line of an error (4294967295) due to an underflow bug (rust-lang/rust-analyzer#11866). Ale fixed the beginning of the error to line 1 and then tried to generate a list of the lines to highlight (https://github.com/dense-analysis/ale/blob/v3.2.0/autoload/ale/highlight.vim#L80). This list is very large, actually so large that vim was automatically killed because it ran out of memory.
While I don't think Ale should add workarounds for all bugs in language servers, I do think that this fix is reasonable generic and can help to mitigate future memory usage issues with error ranges larger than the current file.