ReadonlyidA unique identifier associated with this model.
ReadonlyuriGets the resource associated with this editor model.
Edit the model without adding the edits to the undo stack. This can have dire consequences on the undo stack! See
The edit operations.
If desired, the inverse edit operations, that, when applied, will bring the model back to the previous state.
Is there anything in the redo stack?
Is there anything in the undo stack?
Get the text stored in this model.
OptionalpreserveBOM: booleanThe text snapshot (it is safe to consume it asynchronously).
Perform a minimum amount of operations, in order to transform the decorations
identified by oldDecorations to the decorations described by newDecorations
and returns the new identifiers associated with the resulting decorations.
Array containing previous decorations identifiers.
Array describing what decorations should result after the call.
OptionalownerId: number
Identifies the editor id in which these decorations should appear. If no ownerId is provided, the decorations will appear in all editors that attach this model.
An array containing the new decorations identifiers.
Detect the indentation options for this model from its content.
Destroy this model.
Search the model.
The string used to search. If it is a regular expression, set isRegex to true.
Limit the searching to only search inside the editable range of the model.
Used to indicate that searchString is a regular expression.
Force the matching to match lower/upper case exactly.
Force the matching to match entire words only. Pass null otherwise.
The result will contain the captured groups.
OptionallimitResultCount: number
Limit the number of results
The ranges where the matches are. It is empty if not matches have been found.
Search the model.
The string used to search. If it is a regular expression, set isRegex to true.
Limit the searching to only search inside these ranges.
Used to indicate that searchString is a regular expression.
Force the matching to match lower/upper case exactly.
Force the matching to match entire words only. Pass null otherwise.
The result will contain the captured groups.
OptionallimitResultCount: number
Limit the number of results
The ranges where the matches are. It is empty if no matches have been found.
Search the model for the next match. Loops to the beginning of the model if needed.
The string used to search. If it is a regular expression, set isRegex to true.
Start the searching at the specified position.
Used to indicate that searchString is a regular expression.
Force the matching to match lower/upper case exactly.
Force the matching to match entire words only. Pass null otherwise.
The result will contain the captured groups.
The range where the next match is. It is null if no next match has been found.
Search the model for the previous match. Loops to the end of the model if needed.
The string used to search. If it is a regular expression, set isRegex to true.
Start the searching at the specified position.
Used to indicate that searchString is a regular expression.
Force the matching to match lower/upper case exactly.
Force the matching to match entire words only. Pass null otherwise.
The result will contain the captured groups.
The range where the previous match is. It is null if no previous match has been found.
Gets all the decorations as an array.
OptionalownerId: number
If set, it will ignore decorations belonging to other owners.
OptionalfilterOutValidation: boolean
If set, it will ignore decorations specific to validation (i.e. warnings, errors).
OptionalfilterFontDecorations: boolean
If set, it will ignore font decorations.
Gets all decorations that render in the glyph margin as an array.
OptionalownerId: number
If set, it will ignore decorations belonging to other owners.
Get the alternative version id of the model. This alternative version id is not always incremented, it will return the same values in the case of undo-redo.
Get the character count of text in a certain range.
The range describing what text length to get.
Optionaleol: EndOfLinePreferenceGets all the decorations that contain custom line heights.
OptionalownerId: number
If set, it will ignore decorations belonging to other owners.
Get the options associated with a decoration.
The decoration id.
The decoration options or null if the decoration was not found.
Get the range associated with a decoration.
The decoration id.
The decoration range or null if the decoration was not found.
Gets all the decorations in a range as an array. Only startLineNumber and endLineNumber from range are used for filtering.
So for now it returns all the decorations on the same line as range.
The range to search in
OptionalownerId: number
If set, it will ignore decorations belonging to other owners.
OptionalfilterOutValidation: boolean
If set, it will ignore decorations specific to validation (i.e. warnings, errors).
OptionalfilterFontDecorations: boolean
If set, it will ignore font decorations.
OptionalonlyMinimapDecorations: boolean
If set, it will return only decorations that render in the minimap.
OptionalonlyMarginDecorations: boolean
If set, it will return only decorations that render in the glyph margin.
An array with the decorations
Get the end of line sequence predominantly used in the text buffer.
Get the end of line sequence predominantly used in the text buffer.
EOL char sequence (e.g.: '\n' or '\r\n').
Get a range covering the entire model.
Gets all the decorations that contain injected text.
OptionalownerId: number
If set, it will ignore decorations belonging to other owners.
Get the language associated with this model.
Get the text for a certain line.
Get the number of lines in the model.
Gets all the decorations for the line lineNumber as an array.
The line number
OptionalownerId: number
If set, it will ignore decorations belonging to other owners.
OptionalfilterOutValidation: boolean
If set, it will ignore decorations specific to validation (i.e. warnings, errors).
OptionalfilterFontDecorations: boolean
If set, it will ignore font decorations.
An array with the decorations
Returns the column before the first non whitespace character for line at lineNumber.
Returns 0 if line is empty or contains only whitespace.
Returns the column after the last non whitespace character for line at lineNumber.
Returns 0 if line is empty or contains only whitespace.
Get the text length for a certain line.
Get the maximum legal column for line at lineNumber
Get the minimum legal column for line at lineNumber
Get the text for all lines.
Gets all the decorations for the lines between startLineNumber and endLineNumber as an array.
The start line number
The end line number
OptionalownerId: number
If set, it will ignore decorations belonging to other owners.
OptionalfilterOutValidation: boolean
If set, it will ignore decorations specific to validation (i.e. warnings, errors).
OptionalfilterFontDecorations: boolean
If set, it will ignore font decorations.
An array with the decorations
Get the resolved options for this model.
Gets all the decorations that should be rendered in the overview ruler as an array.
OptionalownerId: number
If set, it will ignore decorations belonging to other owners.
OptionalfilterOutValidation: boolean
If set, it will ignore decorations specific to validation (i.e. warnings, errors).
OptionalfilterFontDecorations: boolean
If set, it will ignore font decorations.
Get the text stored in this model.
Optionaleol: EndOfLinePreference
The end of line character preference. Defaults to EndOfLinePreference.TextDefined.
OptionalpreserveBOM: booleanThe text.
Get the text in a certain range.
The range describing what text to get.
Optionaleol: EndOfLinePreference
The end of line character preference. This will only be used for multiline ranges. Defaults to EndOfLinePreference.TextDefined.
The text.
Get the length of the text stored in this model.
Optionaleol: EndOfLinePreferenceOptionalpreserveBOM: booleanGet the length of text in a certain range.
The range describing what text length to get.
Optionaleol: EndOfLinePreferenceThe text length.
Get the current version id of the model. Anytime a change happens to the model (even undo/redo), the version id is incremented.
Get the word under or besides position.
The position to look for a word.
The word under or besides position. Might be null.
Get the word under or besides position trimmed to position.column
The position to look for a word.
The word under or besides position. Will never be null.
Returns if this model is attached to an editor or not.
Returns if the model was disposed or not.
Advances the given position by the given offset (negative offsets are also accepted) and returns it as a new valid position.
If the offset and position are such that their combination goes beyond the beginning or end of the model, throws an exception.
If the offset is such that the new position would be in the middle of a multi-byte line terminator, throws an exception.
Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs).
Open the current undo-redo element. This offers a way to remove the current undo/redo stop point.
Push edit operations, basically editing the model. This is the preferred way of editing the model. The edit operations will land on the undo stack.
The cursor state before the edit operations. This cursor state will be returned when undo or redo are invoked.
The edit operations.
A callback that can compute the resulting cursors state after the edit operations have been executed.
The cursor state returned by the cursorStateComputer.
Change the end of line sequence. This is the preferred way of changing the eol sequence. This will land on the undo stack.
Close the current undo-redo element. This offers a way to create an undo/redo stop point.
Redo edit operations until the next undo/redo point. The inverse edit operations will be pushed on the undo stack.
Change the end of line sequence without recording in the undo stack. This can have dire consequences on the undo stack! See
Replace the entire text buffer value contained in this model.
Undo edit operations until the previous undo/redo point. The inverse edit operations will be pushed on the redo stack.
ReadonlyonAn event emitted when the model has been attached to the first editor or detached from the last editor.
ReadonlyonAn event emitted when decorations of the model have changed.
ReadonlyonAn event emitted when the language associated with the model has changed.
ReadonlyonAn event emitted when the language configuration associated with the model has changed.
ReadonlyonAn event emitted when the model options have changed.
ReadonlyonAn event emitted right before disposing the model.
An event emitted when the contents of the model have changed.
A model.