Repository navigation
CodeMinings: Add support for rendering placeholder while resolving #3723 - #4508
flori-schwa wants to merge 1 commit into
Conversation
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
26f3acd to
e80a3e9
Compare
|
Thanks for the update, the separate 1. Test helper cleanup (the open thread on
2. Javadoc caveats for implementors of I applied the patch on top of Patch (apply with
|
e80a3e9 to
05bffd8
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Placeholder rendering can reserve a height inconsistent with the displayed mining and fail to redraw after resolution errors or cancellation, causing overlap or lingering blank space.
2 open issues
3 resolved since last review
Review effort: Balanced
fedejeanne
left a comment
There was a problem hiding this comment.
Thank you for addressing my comments, Florian, everything good on my side ✔️
I let Copilot review again and it found 2 things:
- I proposed a patch for you to (review and) apply for the 1st finding
- I marked the 2nd finding as settled since we already discussed it.
After the 1st finding is resolved, I will approve this PR and it can be merged in the upcoming release (we need to wait until master is open for development again). This should happen beginning of December (see the release plan).
…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
05bffd8 to
1353228
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: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