Repository navigation
Conversation
0ab7dab to
c4298b0
Compare
|
@akurtakov @merks please review |
ca5eaa1 to
b115248
Compare
akurtakov
left a comment
There was a problem hiding this comment.
Some general points, details inline:
-
The description doesn't match the code. It mentions a left-side navigation list (Local/Remote) with a stacked right panel, but the dialog uses two radio rows in a single
Group, with no list and noStackLayout. Is the description (or the demo) outdated, or was another version meant to be pushed? -
A remote grammar doesn't give completion or validation by default. Wild Web Developer defaults
downloadExternalResourcestofalse(XMLPreferenceInitializer), so after binding to anhttps://schema, LemMinX doesn't fetch it and the user gets no completion, validation or hover until they enable "Download external resources like referenced DTD, XSD". The dialog doesn't say anything about it. Could the Remote option show a hint/warning when the preference is disabled, or offer to enable it? -
Remote XSD with standard binding: did you try binding to a remote XSD that has a
targetNamespace? Forxsi:schemaLocation, LemMinX has to read the schema to get the namespace, which may not work while downloads are disabled. -
Pre-existing, not introduced here, but maybe worth fixing while the dialog is reworked:
- The OK button is never disabled, so the dialog can be confirmed with an empty or invalid grammar.
- Browse fills in a path relative to the XML file's folder (
makeRelativeTo(xmlFilePath.removeLastSegments(1))), butvalidateLocal()resolves it against the project (xmlResourceContainer.getFile(...)), so for an XML file in a subfolder, a correctly browsed grammar is reported as not existing.
| }); | ||
|
|
||
| remoteGrammarURIText = new Text(group, SWT.BORDER); | ||
| remoteGrammarURIText.setText(Messages.AssociateGrammarDialog_remote_grammar_default); |
There was a problem hiding this comment.
This puts the example URL into the field as a real value, and it passes validation, so selecting Remote and pressing OK binds the document to http://example.com/schema.xsd. remoteGrammarURIText.setMessage(...) would show it as a greyed-out hint instead. The example also doesn't need to be a translatable message.
ece5abd to
368b83c
Compare
|
It fails for me in workbench with !ENTRY org.eclipse.ui 4 0 2026-11-26 15:00:36.592 |
Sorry I pushed my code too quicly, I fixed that. |
368b83c to
ac973ca
Compare
akurtakov
left a comment
There was a problem hiding this comment.
Two leftovers from my earlier review:
- The PR description still mentions a left-side navigation list (Local/Remote) with a stacked right panel, while the dialog uses radio buttons. Could you update it (and the demo if it's outdated)?
- Did you try binding to a remote XSD that has a
targetNamespacewith the standard binding? Forxsi:schemaLocation, LemMinX has to read the schema to get the namespace.
7912722 to
a06b1b5
Compare
Replace the single grammar file field with a two-row layout (Local/Remote) inside a "Schema / Grammar" Group: - Local row: radio + text field + Browse button (workspace-relative path) - Remote row: radio + text field for remote grammar URLs (https://, http://...) with placeholder URL hint, select-all on focus - Browse dialog filtered to grammar extensions (xsd, dtd, rng, rnc) Remote grammar support: - Validate remote URL with URI.isAbsolute() + toURL(); catch IllegalArgumentException - Show a warning in the TitleArea when "Download external resources" is disabled, since LemMinX will not fetch the grammar and grammar-driven features (completion, validation, hover, code actions...) will be unavailable - On OK, show a MessageDialogWithToggle offering to enable download now, with Yes/No/Cancel and a "Don't ask again" preference key Association type section uses two radio buttons: - Standard (xsi, DOCTYPE) - XML Model association Standard is automatically disabled and deselected when a RelaxNG file (.rng/.rnc) is detected; re-enabled otherwise. Validation fixes: - Disable OK button on validation error - Resolve grammar path relative to XML file folder (handles ../ segments) - Guard against null getLocation() for non-local file systems - Pass full file URI to command handler for local grammar files - Replace setText with setMessage on remote grammar text field - Rename updateBindingTypeCombo to updateBindingTypeRadios - Set dialog title via getShell().setText and setTitle Signed-off-by: azerr <azerr@redhat.com>
a06b1b5 to
411af73
Compare
Description fixed and new demo recored:
I confirm that LemMinx 0.40.0 takes care of this usecase and generate the proper xmlns attribute and even generate the proper root element. For instance with this XSD: <?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.com/schemas/product"
xmlns:tns="http://example.com/schemas/product"
elementFormDefault="qualified">
<xs:element name="catalog">
</xs:element>
</xs:schema>LemMinx 0.40.0 will generate catalog as root element and xmlns="http://example.com/schemas/product" <catalog xmlns="http://example.com/schemas/product"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://example.com/schemas/product workspaceIndex/schemas/product.xsd"></catalog>
|
|
@akurtakov I need this PR to add the catalog support in the associate grammar catalog based on LemMinx 0.40.0 to have the same feature than https://github.com/redhat-developer/vscode-xml/blob/main/docs/Features/XMLCatalogFeatures.md#binding-with-catalog |
|
This is good to go from my side. |



Fix AssociateGrammarDialog validation and UX issues
Replace the single grammar file field with a two-row layout (Local/Remote)
inside a "Schema / Grammar" Group:
with placeholder URL hint, select-all on focus
Remote grammar support:
since LemMinX will not fetch the grammar and grammar-driven features
(completion, validation, hover, code actions...) will be unavailable
with Yes/No/Cancel and a "Don't ask again" preference key
Association type section uses two radio buttons:
Standard is automatically disabled and deselected when a RelaxNG file
(.rng/.rnc) is detected; re-enabled otherwise.
Validation fixes:
Here a demo: