-
Notifications
You must be signed in to change notification settings - Fork 227
Description
Issue description
I'm working on an Eclipse plug-in that creates code minings. While testing these code minings, I found out that switching between in-line code minings and line header code minings (in my case by changing preference settings) causes some minings not to be redrawn.
In more detail:
- case: When I have in-line code minings in my editor and I switch preferences to use line header code minings instead, some code minings are redrawn as line header code minings, but some stay beeing drawn as in-line code minings, instead of redrawing all code minings as line header code minings.
- case: When I have line header code minings in my editor and I switch preferences to use in-line code minings instead, some code minings are redrawn as in-line code minings, but some stay beeing drawn as line header code minings, instead of redrawing all code minings as in-line code minings.
First analysis
I debugged the executed code and found out that switching preferences between in-line and line header code minings resulted in correctly re-creating all code minings, but the org.eclipse.jface.internal.text.codemining.CodeMiningManager mixes up CodeMiningLineContentAnnotations with CodeMiningLineHeaderAnnotations. If the manager finds an existing code mining annotation for some position, it reuses the annotation without checking if it has the right type. It seems, the CodeMiningManager should instead replace CodeMiningLineContentAnnotations with CodeMiningLineHeaderAnnotations when switching from in-line code minings to line header code minings and vice versa.
Steps to reproduce
Unfortunately, the plug-in I'm working on is not open source. Thus, I cannot provide simple steps to reproduce the issue.
In my case, I have a file with plenty code minings, often multiple code minings per line and often several consecutive lines with at least one code mining per line. Having this file open in an editor and then switching the code mining preferences for the custom editor causes the issue.
Tested under this environment:
- Eclipse 2025-03 (started via launch configuration from another instance of the IDE)
- Windows 11 Pro