Repository navigation
CodeMinings: Add support for rendering placeholder while resolving #3723 - #4508
flori-schwa wants to merge 1 commit into
Conversation
bd845cb to
0113326
Compare
|
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 |
0113326 to
05782b5
Compare
Test Results 867 files ± 0 867 suites ±0 49m 27s ⏱️ - 10m 41s 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. |
There was a problem hiding this comment.
🟡 Changes recommended
Incorrect click-target mapping, a null-label painting race, and a nondeterministic test remain unresolved.
3 open issues
What changed in this PR
Adds opt-in code-mining placeholders to reduce editor content shifting while labels resolve asynchronously, addressing #3723.
Changes:
- Introduces
IPlaceholderCodeMiningto distinguish placeholder labels from resolved labels. - Updates header, inline, and footer rendering to support placeholders without caching them as resolved results.
- Adds placeholder rendering, height, and redraw tests.
| File | Description |
|---|---|
| tests/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/codemining/PlaceholderLineHeaderCodeMining.java | Adds a reusable placeholder-enabled test mining. |
| tests/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/codemining/CodeMiningTest.java | Tests placeholder-to-resolved label rendering. |
| tests/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/codemining/CodeMiningLineHeaderAnnotationTest.java | Tests placeholder height and resolution-triggered redraws. |
| bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/codemining/IPlaceholderCodeMining.java | Defines the public placeholder contract. |
| bundles/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/codemining/CodeMiningManager.java | Adds a helper to identify unresolved placeholders. |
| bundles/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/codemining/CodeMiningLineHeaderAnnotation.java | Supports placeholder drawing and separates resolved-cache handling. |
| bundles/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/codemining/CodeMiningLineContentAnnotation.java | Supports inline placeholders and resolution-triggered redraws. |
| bundles/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/codemining/CodeMiningDocumentFooterAnnotation.java | Updates footer height checks and resolved-cache handling. |
Review effort: Balanced
| import org.eclipse.jface.text.codemining.IPlaceholderCodeMining; | ||
| import org.eclipse.jface.text.codemining.LineHeaderCodeMining; | ||
|
|
||
| public class PlaceholderLineHeaderCodeMining extends LineHeaderCodeMining implements IPlaceholderCodeMining { |
There was a problem hiding this comment.
🟢 Only the (int, IDocument, ICodeMiningProvider) constructor is used; drop the other two. You could also reuse the private ResolvablePlaceholderMining from CodeMiningLineHeaderAnnotationTest (moved here) instead of having two similar helper classes.
(Created by Claude)
b5e1b6d to
26f3acd
Compare
…lipse-platform#3723 Codemining implementations can now opt-in to rendering placeholder text to prevent editor jumping. The IPlaceholderCodeMining interface must be implemented and getPlaceholderLabel() should return a non-empty string. If no label is set and there is no last resolved mining, the placeholder text will be shown while the resolve() Future is still running. Fixes eclipse-platform#3723
26f3acd to
e80a3e9
Compare

Codemining implementations can now opt-in to rendering placeholder text
to prevent editor jumping. The IPlaceholderCodeMining interface must be
implemented and getPlaceholderLabel() should return a non-empty string.
If no label is set and there is no last resolved mining, the placeholder
text will be shown while the resolve() Future is still running.
Fixes #3723
Example Usage:
In
JavaImplementationCodeMining(JDT):IPlaceholderCodeMininginterface:getPlaceholderLabel()Method: