Repository navigation
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
Conversation
angelozerr
marked this pull request as ready for review
November 28, 2026 08:20
Contributor
Author
|
I need to fix issue with UI settings, but if you have time @akurtakov please review this PR |
Contributor
There was a problem hiding this comment.
🟡 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)) { |
angelozerr
force-pushed
the
workspace_index_wwd
branch
from
November 30, 2026 10:15
9a118aa to
a6094ab
Compare
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>
angelozerr
force-pushed
the
workspace_index_wwd
branch
from
November 30, 2026 15:36
a6094ab to
3fc2614
Compare
angelozerr
marked this pull request as draft
November 30, 2026 15:41
Contributor
There was a problem hiding this comment.
🟡 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
Add and Remove actions don’t update the saved head limits · New Serialize head limits as a pattern-to-size JSON object · New Saved head limits are discarded when the page loads · New Read persisted toggle choices to prevent the prompt from returning Set an explicit selection before dispatching grammar reference searches
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"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


After enabled workspace index settings which index all XSD, DTD, RNC, RNG files references:
You can do a Find References on an XSD, DTD, RNC, RNG file from the project explorer:
to retrieve all references . If you rename file, it update all references. Here a demo:
You can see also references in the editor code lens. Here a demo:
Workspace index is also used in catalog support. Here a demo:
XML_PREFERENCES_WORKSPACE_INDEX_EXCLUDE_DIRECTORIES, XML_PREFERENCES_WORKSPACE_INDEX_HEAD_LIMITS
constants, wire them into storePreferencesToLemminxOptions (headLimits parsed from JSON string)
Workspace Index with
enabled checkbox, exclude-directories list editor, and headLimits JSON text field
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
file and triggers Find References; offers to enable workspace index if not yet active
contribution visible on grammar file selections in any view