Interface IGrammarReferenceContributor
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:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumHow to extract file paths from the attribute value. -
Method Summary
Modifier and TypeMethodDescriptionReturns how the attribute value should be interpreted, ornullif this contributor does not handle the given attribute.
-
Method Details
-
classify
IGrammarReferenceContributor.ExtractionKind classify(String elementLocalName, String attrLocalName, boolean hasPrefix) Returns how the attribute value should be interpreted, ornullif this contributor does not handle the given attribute.All string arguments are already the local part of the name (prefix stripped).
hasPrefixistruewhen the original attribute name contained a colon.- Parameters:
elementLocalName- local name of the containing element.attrLocalName- local name of the attribute being examined.hasPrefix-trueif the attribute has a namespace prefix.- Returns:
- extraction kind, or
nullto skip this attribute.
-