Class WorkspaceIndexCatalogReferenceParticipant

java.lang.Object
org.eclipse.lemminx.extensions.index.WorkspaceIndexCatalogReferenceParticipant
All Implemented Interfaces:
IReferenceParticipant

public class WorkspaceIndexCatalogReferenceParticipant extends Object implements IReferenceParticipant
Provides "Find References" for OASIS catalog entries.

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 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

      public WorkspaceIndexCatalogReferenceParticipant(WorkspaceIndex workspaceIndex)
      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:
      findReference in interface IReferenceParticipant