TextDocument
Represents a text document, such as a source file. Text documents have lines and knowledge about an underlying resource like a file.
Properties
The end of line sequence that is predominately used in this document.
The file system path of the associated resource. Shorthand notation for TextDocument.uri.fsPath. Independent of the uri scheme.
Is this document representing an untitled file which has never been saved yet. Note that this does not mean the document will be saved to disk, use {@linkcode Uri.scheme} to figure out where a document will be saved, e.g. file
, ftp
etc.
The identifier of the language associated with this document.
Functions
Get a word-range at the given position. By default words are defined by common separators, like space, -, _, etc. In addition, per language custom word definitions can be defined. It is also possible to provide a custom regular expression.
Returns a text line denoted by the line number. Note that the returned object is not live and changes to the document are not reflected.
Returns a text line denoted by the position. Note that the returned object is not live and changes to the document are not reflected.
Converts a zero-based offset to a position.
Save the underlying file.
Ensure a position is contained in the range of this document.
Ensure a range is completely contained in this document.