Repository navigation
Keep valid code minings visible when a provider supplies an invalid position - #4559
Open
tobiasmelcher wants to merge 1 commit into
Open
tobiasmelcher wants to merge 1 commit into
tobiasmelcher wants to merge 1 commit into
Conversation
Contributor
…osition An invalid position can abort an annotation batch update before the remaining annotations are added and the model change event is fired. Filter invalid positions in InlinedAnnotationSupport, dispose rejected code minings, and retain only valid annotations for reuse. Keep the position check in AnnotationCodeMiningProvider so it does not return invalid minings.
tobiasmelcher
force-pushed
the
d031119/skip-invalid-annotation-code-minings
branch
from
November 12, 2026 15:49
04e173f to
3c65f7d
Compare
Member
|
@tobiasmelcher: Is this a regression we introduced recently? |
Contributor
Author
@BeckerWdf No, this is not a recent regression. I checked the history: this case already existed in the original annotation code mining implementation from 2019. The position calculation skips leading whitespace and then reserves one character for the mining. On an empty or whitespace-only final line, the position is already at the end of the document, so that extra character points past the end. The provider returned this invalid position without checking it. This PR adds that missing check and also makes the framework skip invalid minings, so they cannot prevent other valid minings from appearing. |
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.
An invalid code mining position can stop an annotation batch update and prevent other valid code minings from appearing. This can happen when an error or warning mining on an empty or whitespace-only final line points past the end of the document.
InlinedAnnotationSupport now checks positions before updating the annotation model. It skips invalid annotations so valid minings from any provider can still appear. Invalid minings are disposed and excluded from subsequent annotation reuse.
AnnotationCodeMiningProvider also checks positions before returning its minings, so it does not supply invalid positions to the framework.