Skip to content

CodeMinings: Add support for rendering placeholder while resolving #3723 - #4508

Open
flori-schwa wants to merge 1 commit into
eclipse-platform:masterfrom
vi-eclipse:fschwabe/codemining-placeholders
Open

flori-schwa wants to merge 1 commit into
eclipse-platform:masterfrom
vi-eclipse:fschwabe/codemining-placeholders

Conversation

@flori-schwa

Copy link
Copy Markdown

Codemining implementations can now opt-in to rendering placeholder text while the resolve() Task is still running. The IPlaceholderCodeMining marker interface must be implemented and getLabel() must return a non-empty string, which will be used as the placeholder while the future is not done.

Fixes #3723

Example Usage:

In JavaImplementationCodeMining (JDT):

  • implement the new IPlaceholderCodeMining interface:
-public class JavaImplementationCodeMining extends AbstractJavaElementLineHeaderCodeMining {
+public class JavaImplementationCodeMining extends AbstractJavaElementLineHeaderCodeMining implements IPlaceholderCodeMining {
  • Add a setLabel() Call in the constructor:
	public JavaImplementationCodeMining(IJavaElement element, JavaEditor editor, IDocument document, ICodeMiningProvider provider,
			boolean showImplementationsAtLeastOne) throws JavaModelException, BadLocationException {
		super(element, document, provider, null);
		this.editor= editor;
		this.showImplementationsAtLeastOne= showImplementationsAtLeastOne;

+		if (!showImplementationsAtLeastOne) {
+			setLabel("?? implementations"); //$NON-NLS-1$
+		}
	}

@flori-schwa

Copy link
Copy Markdown
Author

Here is a screen recording where I added a placeholder to the "Java References" and "Java Implementations" Code minings. I also added a random delay in the resolve method to simulate work.

Placeholders.mp4

…lipse-platform#3723

Codemining implementations can now opt-in to rendering placeholder text
while the resolve() Task is still running. The IPlaceholderCodeMining
marker interface must be implemented and getLabel() must return a
non-empty string, which will be used as the placeholder while the future
is not done.

Fixes eclipse-platform#3723
@flori-schwa
flori-schwa force-pushed the fschwabe/codemining-placeholders branch from 0113326 to 05782b5 Compare October 16, 2026 17:36
@flori-schwa flori-schwa changed the title CodeMinings: Add support for rendering placeholders while resolving() CodeMinings: Add support for rendering placeholder while resolving #3723 Oct 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

   867 files  ± 0     867 suites  ±0   49m 27s ⏱️ - 10m 41s
 8 470 tests + 5   8 228 ✅ + 5  242 💤 ±0  0 ❌ ±0 
21 288 runs  +15  20 605 ✅ +15  683 💤 ±0  0 ❌ ±0 

Results for commit 05782b5. ± Comparison against base commit 3faf11c.

This pull request removes 2 and adds 7 tests. Note that renamed tests count towards both.
org.eclipse.jface.text.tests.codemining.CodeMiningLineHeaderAnnotationTest ‑ testGetHeightDoesNotReturnZero
org.eclipse.jface.text.tests.codemining.CodeMiningLineHeaderAnnotationTest ‑ testTwoLineCodeMiningHeightMatchesTextWidgetLineHeight
org.eclipse.jface.text.tests.codemining.CodeMiningLineHeaderAnnotationTest ‑ testGetHeightDoesNotReturnZero(boolean)[1] placeHolder: false
org.eclipse.jface.text.tests.codemining.CodeMiningLineHeaderAnnotationTest ‑ testGetHeightDoesNotReturnZero(boolean)[2] placeHolder: true
org.eclipse.jface.text.tests.codemining.CodeMiningLineHeaderAnnotationTest ‑ testResolvedPlaceholderDoesNotRequestRedraw
org.eclipse.jface.text.tests.codemining.CodeMiningLineHeaderAnnotationTest ‑ testTwoLineCodeMiningHeightMatchesTextWidgetLineHeight(boolean)[1] placeHolder: false
org.eclipse.jface.text.tests.codemining.CodeMiningLineHeaderAnnotationTest ‑ testTwoLineCodeMiningHeightMatchesTextWidgetLineHeight(boolean)[2] placeHolder: true
org.eclipse.jface.text.tests.codemining.CodeMiningLineHeaderAnnotationTest ‑ testUnresolvedPlaceholderRequestsRedraw
org.eclipse.jface.text.tests.codemining.CodeMiningTest ‑ testLineHeaderCodeMiningPlaceholder

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.

Prevent editor "jumping" by using placeholders for Code Minings

1 participant