Repository navigation
Implement catalog binding support with async entry selection (requires LemMinx 0.40.0) - #2306
angelozerr wants to merge 1 commit into
Conversation
|
Note that we are finalizing the release of SimRel 2026-12 next Wednesday and will need to produce a release of WWD to contribute toward that. So the runway for getting changes in is very short and any changes now will effectively be untested by consumers. I can't judge the riskiness of the changes. |
|
@merks I am aware about that and there is a major problem with pom.xml where formatting is not enabled. I did the fix in LemMinx 0.40.0 but before doing the release (hope today), I wanted to check that LemMinx 0.40.0 will not break WWD because there are so many changes. So my idea is to implement all features in WWD that we have in vscode-xml to check that nothing is broken and new features works in WWD. This PR has no risk since it is a new feature. I need to clean it few but I think it should be soon ready, but without 0.40.0 you cannot play with it. I am integrating all features provided by 0.40.0 like: |
|
That all sounds good! I was aware of the formatting problem. |
|
I just merged the change to update the target platform to LemMinX 0.40.0. |
Thanks! I have several pending PRs and I will create again another PRs. Could you tell me what you think it will be super nice to have, just to know the priority. I will try to do my best to implement the most LemMinx 0.40.0 features, but I will need your review :) |
I expect your judgement is likely better informed than mine. 🤓 Do what you believe will be of value to the most people! |
|
@akurtakov please review this PR |
There was a problem hiding this comment.
🟡 Changes recommended
The pinned LemMinX version cannot support Catalog mode, unescaped contributed URLs can invalidate the catalog, and asynchronous callbacks can fail after dialogs close.
4 open issues
What changed in this PR
Adds catalog-based grammar binding to the XML association workflow, alongside local files and remote URLs. The feature requires LemMinX 0.40.0.
Changes:
- Adds an asynchronous catalog picker with filtering, progress feedback, and disambiguated labels.
- Reorganizes grammar-association classes and removes blocking server discovery.
- Generates system catalog entries from WTP public entries with
webURLattributes.
| File | Description |
|---|---|
org.eclipse.wildwebdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/ui/preferences/XMLPreferenceInitializer.java |
Updates the dialog import after relocation. |
org.eclipse.wildwebdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/ui/preferences/XMLCatalogs.java |
Generates system entries for contributed web URLs. |
org.eclipse.wildwebdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/ui/messages.properties |
Adds catalog selection and validation messages. |
org.eclipse.wildwebdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/ui/Messages.java |
Exposes the new localized messages. |
org.eclipse.wildwebdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/commands/AssociateGrammarHandler.java |
Removes the handler from its former package. |
org.eclipse.wildwebdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/commands/associate/GrammarFileSelectionDialog.java |
Extracts the workspace grammar picker. |
org.eclipse.wildwebdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/commands/associate/CatalogEntrySelectionDialog.java |
Adds asynchronous catalog loading and selection. |
org.eclipse.wildwebdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/commands/associate/CatalogEntryLabelProvider.java |
Styles entries and disambiguates catalog filenames. |
org.eclipse.wildwebdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/commands/associate/BindableCatalogEntry.java |
Defines the catalog entry data model. |
org.eclipse.wildwebdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/commands/associate/AssociateGrammarHandler.java |
Fetches entries and submits catalog binding commands asynchronously. |
org.eclipse.wildwebdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/commands/associate/AssociateGrammarDialog.java |
Adds Catalog mode, browsing, and selection validation. |
org.eclipse.wildwebdeveloper.xml/plugin.xml |
Registers the relocated command handler. |
Review effort: Balanced
| entriesFuture.whenComplete((loadedEntries, ex) -> { | ||
| getShell().getDisplay().asyncExec(() -> handleCompletion(loadedEntries, ex)); | ||
| }); |
129b8c8 to
1c4dc68
Compare
There was a problem hiding this comment.
🟡 Changes recommended
A direct argument cast can crash grammar-association commands, while unescaped URLs can make the generated XML catalog malformed and prevent unrelated mappings from loading.
4 open issues
1 resolved since last review
Review effort: Balanced
1c4dc68 to
d615386
Compare
akurtakov
left a comment
There was a problem hiding this comment.
Thanks @angelozerr, Catalog mode is a nice addition, and loading the entries only when Browse is pressed keeps the dialog responsive. I rebased the PR on master; the only conflicts were from the switch to _ for unused lambda parameters, which I carried over into the moved files (together with the 2026 copyright year that change set).
Two things I'd like fixed before merging, since they affect the existing Local/Remote modes:
1. Command argument parsing. The handler now does (String) command.getArguments().get(0), while the previous handler used ArgumentsUtils.getArgAt(command, 0, String.class). LSP4J can deliver the argument as a JsonPrimitive, in which case the cast throws ClassCastException and no binding mode works. Please keep using ArgumentsUtils.
2. URI of local grammar files. saveInput() now uses grammarFile.getLocationURI().toString() instead of LSPEclipseUtils.toUri(grammarFile.getLocation()).toASCIIString(). That gives file:/home/... without escaping non-ASCII characters, while LSP4E sends document URIs as file:///home/..., ASCII-escaped. If LemMinX compares the two or makes the grammar path relative to the document, they may no longer match. Unless the change is intentional, could you restore the previous line?
Suggestions, fine as a follow-up:
3. Callbacks after the dialogs close. In CatalogEntrySelectionDialog.create(), the whenComplete callback calls getShell().getDisplay(). If the user cancels while the entries are still loading, getShell() is null, and the resulting NPE is swallowed by the future. Capturing the Display when the dialog is created avoids it. In AssociateGrammarDialog, the catalogEntriesFuture.thenAccept(...) after a selection isn't needed: the entries have already loaded by then, so the text can be set directly.
4. Retry after a failed load. If the first fetch fails, every later Browse click in the same dialog reuses the failed future and shows the error again. Resetting catalogEntriesFuture on failure would let the user retry.
5. Escaping in XMLCatalogs. webURL is inserted into the generated catalog without XML escaping, so a URL containing & makes the whole catalog invalid, including all other contributed entries. The existing publicId and uri attributes have the same issue; escaping all three would fix it.
6. Tests. The webURL → system entry generation is easy to unit-test. A test of xml.catalog.entries.bindable against LemMinX 0.40.0 would catch protocol changes.
Nits:
Messages.javaandXMLPreferenceInitializerneed the 2026 copyright year.- The new
Messagesfields are inserted betweendownload_prompt_titleanddownload_prompt_message. - There's a stray
</p>in theCatalogEntrySelectionDialogjavadoc.
Copilot's comment about LemMinX 0.40.0 not being in the target platform is outdated: #2308 updated it, and the manifest requires [0.40.0,1.0.0).
This review was prepared with Claude Code (Anthropic).
ffba09f to
dcc86b1
Compare
- Add CatalogEntrySelectionDialog: quick-open style dialog for selecting bindable catalog entries, populated asynchronously via CompletableFuture - Add CatalogEntryLabelProvider: styled display of entries with entry type, identifier, and gray-colored catalog filename (disambiguated by path segments when needed) - Implement AssociateGrammarDialog with Catalog mode: radio button to switch between Local/Remote and Catalog modes, Browse button that fetches entries asynchronously with progress indicator - Modify AssociateGrammarHandler: fetch catalog entries only when user opens dialog, no blocking server calls in handler, fresh fetch each dialog open to reflect catalog changes - Add webURL support in XMLCatalogs: for WTP catalog contributions with webURL attributes on public entries, generate additional system entries pointing to web URLs Signed-off-by: azerr <azerr@redhat.com>
dcc86b1 to
bf00cd9
Compare
|
@akurtakov please review again. |
|
Please stop asking me to review, I do it whenever I find time and this is just a noise. |


Here a demo:
catalog entries, populated asynchronously via CompletableFuture
and gray-colored catalog filename (disambiguated by path segments when needed)
Local/Remote and Catalog modes, Browse button that fetches entries asynchronously
with progress indicator
no blocking server calls in handler, fresh fetch each dialog open to reflect
catalog changes
attributes on public entries, generate additional system entries pointing to web URLs