Class GrammarReference
java.lang.Object
org.eclipse.lemminx.extensions.index.GrammarReference
A located grammar reference within an XML file, stored as a line/column
range so that callers can build LSP
Locations and
TextEdits without re-reading the file.
Grammar references are always single-line (attribute values, DOCTYPE
system/public IDs, PI content), so only one line number is stored.
endLine is omitted — it is always equal to line.
Example: In <?xml-model href="schema.xsd"?> on line 0,
the GrammarReference would be:
line = 0 (zero-based) startChar = 22 (start ofschema.xsd, after the opening") endChar = 32 (exclusive, before the closing") value = "schema.xsd" kind = XML_MODEL_HREF
All fields are populated once during GrammarReferenceLocator.locate(org.eclipse.lemminx.commons.TextDocument)
and cached in FileBloomEntry. After indexing, files are never
re-read to build Locations or TextEdits — the cached line/column positions
are used directly.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe kind of grammar reference. -
Constructor Summary
ConstructorsConstructorDescriptionGrammarReference(int offset, int line, int startChar, int endChar, String value, GrammarReference.Kind kind) Full constructor used byGrammarReferenceLocator.locate(org.eclipse.lemminx.commons.TextDocument). -
Method Summary
Modifier and TypeMethodDescriptionintendChar()Zero-based end column (exclusive).kind()intlength()Character length of the value:endChar - startChar.intline()Zero-based line number.intoffset()Absolute character offset from the start of the document.intZero-based start column (inclusive).value()
-
Constructor Details
-
GrammarReference
public GrammarReference(int offset, int line, int startChar, int endChar, String value, GrammarReference.Kind kind) Full constructor used byGrammarReferenceLocator.locate(org.eclipse.lemminx.commons.TextDocument). Both the absolute offset (for text extraction in tests) and the line/column positions (for building LSPLocations andTextEdits) are stored once at indexing time.
-
-
Method Details
-
offset
public int offset()Absolute character offset from the start of the document. -
line
public int line()Zero-based line number. Equal toendLine— grammar refs are always single-line. -
startChar
public int startChar()Zero-based start column (inclusive). -
endChar
public int endChar()Zero-based end column (exclusive). -
length
public int length()Character length of the value:endChar - startChar. -
value
-
kind
-