Class WorkspaceIndexCatalogReferenceParticipant
- All Implemented Interfaces:
IReferenceParticipant
Use case: The user clicks a "2 references" code lens on a catalog entry
such as <system systemId="http://example.org/schema" uri="schema.xsd"/> in
catalog.xml. The client sends textDocument/references on the catalog
file at the entry's position. This participant handles that request by locating all
workspace XML files that contain the catalog identifier
("http://example.org/schema") as a reference value — e.g. in a
DOCTYPE system ID or a namespace URI declaration.
Cache-first with open-document accuracy: Reference positions are served
from the in-memory FileBloomEntry cache populated during indexing.
When a referencing file is currently open in the editor with unsaved changes,
the cached line/column positions may be stale (e.g. the user added lines before
the catalog reference). In that case the file's live content is re-scanned to
return accurate Locations.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionWorkspaceIndexCatalogReferenceParticipant(WorkspaceIndex workspaceIndex) Convenience constructor for tests that don't need open-document re-scan.WorkspaceIndexCatalogReferenceParticipant(WorkspaceIndex workspaceIndex, Supplier<IXMLDocumentProvider> docProviderSupplier) Constructor used in production. -
Method Summary
Modifier and TypeMethodDescriptionvoidfindReference(DOMDocument document, org.eclipse.lsp4j.Position position, org.eclipse.lsp4j.ReferenceContext context, List<org.eclipse.lsp4j.Location> locations, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.lemminx.services.extensions.IReferenceParticipant
findReferenceByUri
-
Constructor Details
-
WorkspaceIndexCatalogReferenceParticipant
public WorkspaceIndexCatalogReferenceParticipant(WorkspaceIndex workspaceIndex, Supplier<IXMLDocumentProvider> docProviderSupplier) Constructor used in production. The document-provider supplier is resolved lazily so that the participant can be created before the registry is fully initialized. -
WorkspaceIndexCatalogReferenceParticipant
Convenience constructor for tests that don't need open-document re-scan.
-
-
Method Details
-
findReference
public void findReference(DOMDocument document, org.eclipse.lsp4j.Position position, org.eclipse.lsp4j.ReferenceContext context, List<org.eclipse.lsp4j.Location> locations, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker) - Specified by:
findReferencein interfaceIReferenceParticipant
-