Skip to content

Add XML workspace index settings, preference page, grammar detector and Find References in explorer (requires LemMinx 0.40.0) - #2307

Draft
angelozerr wants to merge 1 commit into
eclipse-wildwebdeveloper:masterfrom
angelozerr:workspace_index_wwd
Draft

angelozerr wants to merge 1 commit into
eclipse-wildwebdeveloper:masterfrom
angelozerr:workspace_index_wwd

Conversation

@angelozerr

@angelozerr angelozerr commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

After enabled workspace index settings which index all XSD, DTD, RNC, RNG files references:

image

You can do a Find References on an XSD, DTD, RNC, RNG file from the project explorer:

image

to retrieve all references . If you rename file, it update all references. Here a demo:

WorkspaceIndexSearchDemo

You can see also references in the editor code lens. Here a demo:

WorkspaceIndexCodeLensDemo

Workspace index is also used in catalog support. Here a demo:

WorkspaceIndexCatalogDemo
  • XMLPreferenceServerConstants: add XML_PREFERENCES_WORKSPACE_INDEX_ENABLED,
    XML_PREFERENCES_WORKSPACE_INDEX_EXCLUDE_DIRECTORIES, XML_PREFERENCES_WORKSPACE_INDEX_HEAD_LIMITS
    constants, wire them into storePreferencesToLemminxOptions (headLimits parsed from JSON string)
  • XMLPreferenceInitializer: set defaults for workspace index settings and detector ignore flag
  • XMLWorkspaceIndexPreferencePage: new preference page under XML >
    Workspace Index with
    enabled checkbox, exclude-directories list editor, and headLimits JSON text field
  • XMLWorkspaceIndexDetector (IStartup): quick workspace scan at startup to detect grammar
    files (XSD/DTD/RNG/RNC); shows MessageDialogWithToggle prompt to enable workspace index
    if at least one grammar file found and user has not already opted in/out
  • XMLFindReferencesInExplorerHandler: new command handler that opens the selected grammar
    file and triggers Find References; offers to enable workspace index if not yet active
  • plugin.xml: register new preference page, startup, command, handler, and popup menu
    contribution visible on grammar file selections in any view
  • plugin.properties / messages.properties: add all new i18n strings

@angelozerr

Copy link
Copy Markdown
Contributor Author

I need to fix issue with UI settings, but if you have time @akurtakov please review this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new controls require LemMinX 0.40.0, but the target resolves 0.31.2 and the bundle permits 0.29.0, allowing installation with a server that lacks workspace-index support.

4 open issues
What changed in this PR

Adds workspace-index integration to Eclipse’s XML tooling, intended to use LemMinX 0.40.0 for cross-file grammar references and rename support.

Changes:

  • Adds index preferences for enablement, excluded directories, and JSON head limits.
  • Detects grammar files at startup and offers to enable indexing.
  • Adds an Explorer Find References command and related UI labels.
File Description
XMLWorkspaceIndexPreferencePage.java Adds workspace-index preference controls.
XMLPreferenceServerConstants.java Serializes index preferences into server options.
XMLPreferenceInitializer.java Defines index and detection defaults.
messages.properties Adds preference and startup-prompt text.
Messages.java Exposes the new localized messages.
XMLWorkspaceIndexDetector.java Scans for grammar files and prompts to enable indexing.
XMLFindReferencesInExplorerHandler.java Opens selected grammar files and invokes Find References.
plugin.xml Registers preferences, startup detection, and the Explorer command.
plugin.properties Adds preference names, search keywords, and the command label.

Review effort: Balanced

Comment on lines +67 to +69
if (editor instanceof ITextEditor) {
IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
handlerService.executeCommand(FIND_REFERENCES_COMMAND, null);
if (store.getBoolean(XMLPreferenceServerConstants.XML_PREFERENCES_WORKSPACE_INDEX_ENABLED.preferenceId)) {
return;
}
if (store.getBoolean(PREF_WORKSPACE_INDEX_DETECTION_IGNORE)) {
Find References in explorer

- XMLPreferenceServerConstants: add
XML_PREFERENCES_WORKSPACE_INDEX_ENABLED,
  XML_PREFERENCES_WORKSPACE_INDEX_EXCLUDE_DIRECTORIES,
XML_PREFERENCES_WORKSPACE_INDEX_HEAD_LIMITS
  constants, wire them into storePreferencesToLemminxOptions (headLimits
parsed from JSON string)
- XMLPreferenceInitializer: set defaults for workspace index settings
and detector ignore flag
- XMLWorkspaceIndexPreferencePage: new preference page under XML >
Workspace Index with
  enabled checkbox, exclude-directories list editor, and headLimits JSON
text field
- XMLWorkspaceIndexDetector (IStartup): quick workspace scan at startup
to detect grammar
  files (XSD/DTD/RNG/RNC); shows MessageDialogWithToggle prompt to
enable workspace index
  if at least one grammar file found and user has not already opted
in/out
- XMLFindReferencesInExplorerHandler: new command handler that opens the
selected grammar
  file and triggers Find References; offers to enable workspace index if
not yet active
- plugin.xml: register new preference page, startup, command, handler,
and popup menu
  contribution visible on grammar file selections in any view
- plugin.properties / messages.properties: add all new i18n strings

Signed-off-by: azerr <azerr@redhat.com>
@merks
merks requested a balanced review from Copilot November 30, 2026 15:39
@angelozerr
angelozerr marked this pull request as draft November 30, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Head-limit preferences can be lost or omitted from server configuration because loading is disabled and saving uses stale viewer input and an incompatible JSON format.

5 open issues
2 resolved since last review

Review effort: Balanced

Comment on lines +217 to +226
addBtn.addListener(SWT.Selection, e -> {
HeadLimit item = new HeadLimit("*.xml", 1000);
tableViewer.add(item);
});

Button removeBtn = new Button(btnComposite, SWT.PUSH);
removeBtn.setText("&Remove");
removeBtn.addListener(SWT.Selection, e -> {
tableViewer.getStructuredSelection().forEach(sel -> tableViewer.remove(sel));
});
Comment on lines +258 to +262
JsonArray arr = new JsonArray();
for (HeadLimit item : items) {
JsonObject obj = new JsonObject();
obj.addProperty("pattern", item.pattern);
obj.addProperty("limit", item.limit);
Comment on lines +272 to +276
/*JsonArray arr = new JsonArray(jsonString);
for (int i = 0; i < arr.length(); i++) {
JSONObject obj = arr.getJSONObject(i);
items.add(new HeadLimit(
obj.getString("pattern"),
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.

2 participants