A simple text document. Not to be implemented. The document keeps the content as string.
Static methods
staticcreate(uri:DocumentUri, languageId:String, version:Int, content:String):TextDocument
Creates a new text document.
Parameters:
uri | The document's uri. |
---|---|
languageId | The document's language Id. |
version | The document's initial version number. |
content | The document's content. |
staticupdate(document:TextDocument, changes:Array<TextDocumentContentChangeEvent>, version:Int):TextDocument
Updates a TextDocument by modifying its content.
Parameters:
document | the document to update. Only documents created by TextDocument.create are valid inputs. |
---|---|
changes | the changes to apply to the document. |
version | the changes version for the document. |
Returns:
The updated TextDocument. Note: That's the same document instance passed in as first parameter.
Variables
uri:DocumentUri
The associated URI for this document. Most documents have the file-scheme, indicating that they represent files on disk. However, some documents may have other schemes indicating that they are not available on disk.
@readonly
version:Int
The version number of this document (it will increase after each change, including undo/redo).
@readonly
Methods
getText(?range:Null<Range>):String
Get the text of this document. A substring can be retrieved by providing a range.
Parameters:
range | (optional) An range within the document to return. If no range is passed, the full content is returned. Invalid range positions are adjusted as described in Position.line and Position.character. If the start range position is greater than the end range position, then the effect of getText is as if the two positions were swapped. |
---|
Returns:
The text of this document or a substring of the text if a range is provided.
offsetAt(position:Position):Int
Converts the position to a zero-based offset. Invalid positions are adjusted as described in Position.line and Position.character.
Parameters:
position | A position. |
---|
Returns:
A valid zero-based offset.
positionAt(offset:Int):Position
Converts a zero-based offset to a position.
Parameters:
offset | A zero-based offset. |
---|
Returns:
A valid position.