Skip to content

Keep valid code minings visible when a provider supplies an invalid position - #4559

Open
tobiasmelcher wants to merge 1 commit into
eclipse-platform:masterfrom
tobiasmelcher:d031119/skip-invalid-annotation-code-minings
Open

tobiasmelcher wants to merge 1 commit into
eclipse-platform:masterfrom
tobiasmelcher:d031119/skip-invalid-annotation-code-minings

Conversation

@tobiasmelcher

@tobiasmelcher tobiasmelcher commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

   867 files  ± 0     867 suites  ±0   48m 48s ⏱️ - 10m 19s
 8 553 tests + 8   8 313 ✅ + 8  240 💤 ±0  0 ❌ ±0 
21 531 runs  +24  20 855 ✅ +24  676 💤 ±0  0 ❌ ±0 

Results for commit 3c65f7d. ± Comparison against base commit 6ff7172.

♻️ This comment has been updated with latest results.

…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 tobiasmelcher changed the title Skip annotation code minings with invalid positions Keep valid code minings visible when a provider supplies an invalid position Nov 12, 2026
@tobiasmelcher
tobiasmelcher force-pushed the d031119/skip-invalid-annotation-code-minings branch from 04e173f to 3c65f7d Compare November 12, 2026 15:49
@BeckerWdf

Copy link
Copy Markdown
Member

@tobiasmelcher: Is this a regression we introduced recently?

@tobiasmelcher

Copy link
Copy Markdown
Contributor Author

@tobiasmelcher: Is this a regression we introduced recently?

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants