Interface IGrammarReferenceContributor


public interface IGrammarReferenceContributor
Extension point that allows XML plugins to contribute grammar reference attribute patterns to the workspace index.

Implement this interface to tell the index scanner which XML attributes in your domain point to grammar files. For example, the OASIS XML Catalog extension contributes a pattern for uri="..." on catalog entries.

Register your implementation in IXMLExtension.start(org.eclipse.lsp4j.InitializeParams, org.eclipse.lemminx.services.extensions.XMLExtensionsRegistry) via XMLExtensionsRegistry.registerGrammarReferenceContributor(org.eclipse.lemminx.services.extensions.IGrammarReferenceContributor).

All registered contributors are consulted by the index scanner (XMLReferenceCollector and GrammarReferenceLocator) after the built-in patterns (schemaLocation, noNamespaceSchemaLocation, xml-model href, xs:include/import schemaLocation, DOCTYPE SYSTEM) are checked.

See Also:
  • Method Details

    • classify

      IGrammarReferenceContributor.ExtractionKind classify(String elementLocalName, String attrLocalName, boolean hasPrefix)
      Returns how the attribute value should be interpreted, or null if this contributor does not handle the given attribute.

      All string arguments are already the local part of the name (prefix stripped). hasPrefix is true when the original attribute name contained a colon.

      Parameters:
      elementLocalName - local name of the containing element.
      attrLocalName - local name of the attribute being examined.
      hasPrefix - true if the attribute has a namespace prefix.
      Returns:
      extraction kind, or null to skip this attribute.