Protected ReadonlyfileProtected ReadonlyserviceProtected Optional ReadonlytextProtectedcreateOptionaloptions: ParserOptionsProtectedcreateProtectedcreateCreate a LangiumDocument from a given parse result.
A TextDocument is created on demand if it is not provided as argument here. Usually this should not be necessary because the main purpose of the TextDocument is to convert between text ranges and offsets, which is done solely in LSP request handling.
With the introduction of update below this method is supposed to be mainly called during workspace initialization and on addition/recognition of new files, while changes in existing documents are processed via update.
OptionaltextDocument: TextDocumentOptionaltext: stringProtectedcreateOptionaltext: stringCreate an Langium document from an in-memory string.
Optionaloptions: ParserOptionsCreate a Langium document from an in-memory string asynchronously. This action can be cancelled if a cancellable parser implementation has been provided.
Create a Langium document from a TextDocument (usually associated with a file).
Optionaluri: URIOptionaloptions: ParserOptionsCreate a Langium document from a TextDocument asynchronously. This action can be cancelled if a cancellable parser implementation has been provided.
Create an Langium document from a specified URI. The factory will use the FileSystemAccess service to read the file.
ProtectedparseOptionaloptions: ParserOptionsProtectedparseUpdate the given document after changes in the corresponding textual representation. Method is called by the document builder after it has been requested to build an existing document and the document's state is DocumentState.Changed. The text parsing is expected to be done the same way as in fromTextDocument and fromString.
Shared service for creating
LangiumDocumentinstances.Register a custom implementation if special (additional) behavior is required for your language(s). Note: If you specialize fromString or fromTextDocument you probably might want to specialize update, too!