Interface IStandaloneCodeEditor
Expand description
interface IStandaloneCodeEditor {
inComposition: boolean;
onBeginUpdate: IEvent<void>;
onContextMenu: IEvent<IEditorMouseEvent>;
onDidAttemptReadOnlyEdit: IEvent<void>;
onDidBlurEditorText: IEvent<void>;
onDidBlurEditorWidget: IEvent<void>;
onDidChangeConfiguration: IEvent<
ConfigurationChangedEvent,
>;
onDidChangeCursorPosition: IEvent<
ICursorPositionChangedEvent,
>;
onDidChangeCursorSelection: IEvent<
ICursorSelectionChangedEvent,
>;
onDidChangeHiddenAreas: IEvent<void>;
onDidChangeModel: IEvent<IModelChangedEvent>;
onDidChangeModelContent: IEvent<
IModelContentChangedEvent,
>;
onDidChangeModelDecorations: IEvent<
IModelDecorationsChangedEvent,
>;
onDidChangeModelLanguage: IEvent<
IModelLanguageChangedEvent,
>;
onDidChangeModelLanguageConfiguration: IEvent<
IModelLanguageConfigurationChangedEvent,
>;
onDidChangeModelOptions: IEvent<
IModelOptionsChangedEvent,
>;
onDidCompositionEnd: IEvent<void>;
onDidCompositionStart: IEvent<void>;
onDidContentSizeChange: IEvent<
IContentSizeChangedEvent,
>;
onDidFocusEditorText: IEvent<void>;
onDidFocusEditorWidget: IEvent<void>;
onDidLayoutChange: IEvent<EditorLayoutInfo>;
onDidPaste: IEvent<IPasteEvent>;
onDidScrollChange: IEvent<IScrollEvent>;
onEndUpdate: IEvent<void>;
onKeyDown: IEvent<IKeyboardEvent>;
onKeyUp: IEvent<IKeyboardEvent>;
onMouseDown: IEvent<IEditorMouseEvent>;
onMouseLeave: IEvent<IPartialEditorMouseEvent>;
onMouseMove: IEvent<IEditorMouseEvent>;
onMouseUp: IEvent<IEditorMouseEvent>;
onWillChangeModel: IEvent<IModelChangedEvent>;
addAction(descriptor: IActionDescriptor): IDisposable;
addCommand(
keybinding: number,
handler: ICommandHandler,
context?: string,
): string;
addContentWidget(widget: IContentWidget): void;
addGlyphMarginWidget(widget: IGlyphMarginWidget): void;
addOverlayWidget(widget: IOverlayWidget): void;
applyFontInfo(target: HTMLElement): void;
changeViewZones(
callback: (
accessor: IViewZoneChangeAccessor,
) => void,
): void;
createContextKey<
T extends ContextKeyValue = ContextKeyValue,
>(
key: string,
defaultValue: T,
): IContextKey<T>;
createDecorationsCollection(
decorations?: IModelDeltaDecoration[],
): IEditorDecorationsCollection;
deltaDecorations(
oldDecorations: string[],
newDecorations: IModelDeltaDecoration[],
): string[];
dispose(): void;
executeCommand(source: string, command: ICommand): void;
executeCommands(
source: string,
commands: ICommand[],
): void;
executeEdits(
source: string,
edits: IIdentifiedSingleEditOperation[],
endCursorState?: ICursorStateComputer | Selection[],
): boolean;
focus(): void;
getAction(id: string): IEditorAction;
getBottomForLineNumber(lineNumber: number): number;
getContainerDomNode(): HTMLElement;
getContentHeight(): number;
getContentWidth(): number;
getContribution<T extends IEditorContribution>(
id: string,
): T;
getDecorationsInRange(range: Range): IModelDecoration[];
getDomNode(): HTMLElement;
getEditorType(): string;
getFontSizeAtPosition(position: IPosition): string;
getId(): string;
getLayoutInfo(): EditorLayoutInfo;
getLineDecorations(
lineNumber: number,
): IModelDecoration[];
getLineHeightForPosition(position: IPosition): number;
getModel(): ITextModel;
getOffsetForColumn(
lineNumber: number,
column: number,
): number;
getOption<T extends EditorOption>(
id: T,
): FindComputedEditorOptionValueById<T>;
getOptions(): IComputedEditorOptions;
getPosition(): Position;
getRawOptions(): IEditorOptions;
getScrolledVisiblePosition(
position: IPosition,
): { height: number; left: number; top: number };
getScrollHeight(): number;
getScrollLeft(): number;
getScrollTop(): number;
getScrollWidth(): number;
getSelection(): Selection;
getSelections(): Selection[];
getSupportedActions(): IEditorAction[];
getTargetAtClientPoint(
clientX: number,
clientY: number,
): IMouseTarget;
getTopForLineNumber(
lineNumber: number,
includeViewZones?: boolean,
): number;
getTopForPosition(
lineNumber: number,
column: number,
): number;
getValue(
options?: {
lineEnding: string;
preserveBOM: boolean;
},
): string;
getVisibleColumnFromPosition(
position: IPosition,
): number;
getVisibleRanges(): Range[];
handleInitialized?(): void;
hasPendingScrollAnimation(): boolean;
hasTextFocus(): boolean;
hasWidgetFocus(): boolean;
layout(
dimension?: IDimension,
postponeRendering?: boolean,
): void;
layoutContentWidget(widget: IContentWidget): void;
layoutGlyphMarginWidget(
widget: IGlyphMarginWidget,
): void;
layoutOverlayWidget(widget: IOverlayWidget): void;
onDidDispose(listener: () => void): IDisposable;
popUndoStop(): boolean;
pushUndoStop(): boolean;
removeContentWidget(widget: IContentWidget): void;
removeDecorations(decorationIds: string[]): void;
removeGlyphMarginWidget(
widget: IGlyphMarginWidget,
): void;
removeOverlayWidget(widget: IOverlayWidget): void;
render(forceRedraw?: boolean): void;
restoreViewState(state: ICodeEditorViewState): void;
revealLine(
lineNumber: number,
scrollType?: ScrollType,
): void;
revealLineInCenter(
lineNumber: number,
scrollType?: ScrollType,
): void;
revealLineInCenterIfOutsideViewport(
lineNumber: number,
scrollType?: ScrollType,
): void;
revealLineNearTop(
lineNumber: number,
scrollType?: ScrollType,
): void;
revealLines(
startLineNumber: number,
endLineNumber: number,
scrollType?: ScrollType,
): void;
revealLinesInCenter(
lineNumber: number,
endLineNumber: number,
scrollType?: ScrollType,
): void;
revealLinesInCenterIfOutsideViewport(
lineNumber: number,
endLineNumber: number,
scrollType?: ScrollType,
): void;
revealLinesNearTop(
lineNumber: number,
endLineNumber: number,
scrollType?: ScrollType,
): void;
revealPosition(
position: IPosition,
scrollType?: ScrollType,
): void;
revealPositionInCenter(
position: IPosition,
scrollType?: ScrollType,
): void;
revealPositionInCenterIfOutsideViewport(
position: IPosition,
scrollType?: ScrollType,
): void;
revealPositionNearTop(
position: IPosition,
scrollType?: ScrollType,
): void;
revealRange(
range: IRange,
scrollType?: ScrollType,
): void;
revealRangeAtTop(
range: IRange,
scrollType?: ScrollType,
): void;
revealRangeInCenter(
range: IRange,
scrollType?: ScrollType,
): void;
revealRangeInCenterIfOutsideViewport(
range: IRange,
scrollType?: ScrollType,
): void;
revealRangeNearTop(
range: IRange,
scrollType?: ScrollType,
): void;
revealRangeNearTopIfOutsideViewport(
range: IRange,
scrollType?: ScrollType,
): void;
saveViewState(): ICodeEditorViewState;
setBanner(
bannerDomNode: HTMLElement,
height: number,
): void;
setModel(model: ITextModel): void;
setPosition(position: IPosition, source?: string): void;
setScrollLeft(
newScrollLeft: number,
scrollType?: ScrollType,
): void;
setScrollPosition(
position: INewScrollPosition,
scrollType?: ScrollType,
): void;
setScrollTop(
newScrollTop: number,
scrollType?: ScrollType,
): void;
setSelection(selection: IRange, source?: string): void;
setSelection(selection: Range, source?: string): void;
setSelection(
selection: ISelection,
source?: string,
): void;
setSelection(
selection: Selection,
source?: string,
): void;
setSelections(
selections: readonly ISelection[],
source?: string,
): void;
setValue(newValue: string): void;
trigger(
source: string,
handlerId: string,
payload: unknown,
): void;
updateOptions(
newOptions: IEditorOptions & IGlobalEditorOptions,
): void;
writeScreenReaderContent(reason: string): void;
}Properties§
readonly in Composition: booleanBoolean indicating whether input is in composition
readonly on Begin Update: IEvent<void>Some editor operations fire multiple events at once.
To allow users to react to multiple events fired by a single operation,
the editor fires a begin update before the operation and an end update after the operation.
Whenever the editor fires onBeginUpdate, it will also fire onEndUpdate once the operation finishes.
Note that not all operations are bracketed by onBeginUpdate and onEndUpdate.
readonly on Did Composition End: IEvent<void>An event emitted after composition has ended.
readonly on Did Composition Start: IEvent<void>An event emitted after composition has started.
readonly on End Update: IEvent<void>Fires after the editor completes the operation it fired onBeginUpdate for.
Methods§
§addAction(descriptor: IActionDescriptor): IDisposable
addAction(descriptor: IActionDescriptor): IDisposable
§addCommand(
keybinding: number,
handler: ICommandHandler,
context?: string,
): string
addCommand(
keybinding: number,
handler: ICommandHandler,
context?: string,
): string
§addContentWidget(widget: IContentWidget): void
addContentWidget(widget: IContentWidget): void
Add a content widget. Widgets must have unique ids, otherwise they will be overwritten.
§addGlyphMarginWidget(widget: IGlyphMarginWidget): void
addGlyphMarginWidget(widget: IGlyphMarginWidget): void
Add a glyph margin widget. Widgets must have unique ids, otherwise they will be overwritten.
§addOverlayWidget(widget: IOverlayWidget): void
addOverlayWidget(widget: IOverlayWidget): void
Add an overlay widget. Widgets must have unique ids, otherwise they will be overwritten.
§applyFontInfo(target: HTMLElement): void
applyFontInfo(target: HTMLElement): void
Apply the same font settings as the editor to target.
§changeViewZones(
callback: (
accessor: IViewZoneChangeAccessor,
) => void,
): void
changeViewZones(
callback: (
accessor: IViewZoneChangeAccessor,
) => void,
): void
Change the view zones. View zones are lost when a new model is attached to the editor.
§createContextKey<
T extends ContextKeyValue = ContextKeyValue,
>(
key: string,
defaultValue: T,
): IContextKey<T>
createContextKey<
T extends ContextKeyValue = ContextKeyValue,
>(
key: string,
defaultValue: T,
): IContextKey<T>
§createDecorationsCollection(
decorations?: IModelDeltaDecoration[],
): IEditorDecorationsCollection
createDecorationsCollection(
decorations?: IModelDeltaDecoration[],
): IEditorDecorationsCollection
Create a collection of decorations. All decorations added through this collection will get the ownerId of the editor (meaning they will not show up in other editors). These decorations will be automatically cleared when the editor's model changes.
§deltaDecorations(
oldDecorations: string[],
newDecorations: IModelDeltaDecoration[],
): string[]
deltaDecorations(
oldDecorations: string[],
newDecorations: IModelDeltaDecoration[],
): string[]
All decorations added through this call will get the ownerId of this editor.
§dispose(): void
dispose(): void
Dispose the editor.
§executeCommand(source: string, command: ICommand): void
executeCommand(source: string, command: ICommand): void
Execute a command on the editor. The edits will land on the undo-redo stack, but no "undo stop" will be pushed.
§executeCommands(source: string, commands: ICommand[]): void
executeCommands(source: string, commands: ICommand[]): void
Execute multiple (concomitant) commands on the editor.
§executeEdits(
source: string,
edits: IIdentifiedSingleEditOperation[],
endCursorState?: ICursorStateComputer | Selection[],
): boolean
executeEdits(
source: string,
edits: IIdentifiedSingleEditOperation[],
endCursorState?: ICursorStateComputer | Selection[],
): boolean
Execute edits on the editor. The edits will land on the undo-redo stack, but no "undo stop" will be pushed.
§focus(): void
focus(): void
Brings browser focus to the editor text
§getAction(id: string): IEditorAction
getAction(id: string): IEditorAction
Get an action that is a contribution to this editor.
§getBottomForLineNumber(lineNumber: number): number
getBottomForLineNumber(lineNumber: number): number
Get the vertical position (top offset) for the line's bottom w.r.t. to the first line.
§getContainerDomNode(): HTMLElement
getContainerDomNode(): HTMLElement
Returns the editor's container dom node
§getContentHeight(): number
getContentHeight(): number
Get the height of the editor's content.
This is information that is "erased" when computing scrollHeight = Math.max(contentHeight, height)
§getContentWidth(): number
getContentWidth(): number
Get the width of the editor's content.
This is information that is "erased" when computing scrollWidth = Math.max(contentWidth, width)
§getContribution<T extends IEditorContribution>(
id: string,
): T
getContribution<T extends IEditorContribution>(
id: string,
): T
Get a contribution of this editor.
§getDecorationsInRange(range: Range): IModelDecoration[]
getDecorationsInRange(range: Range): IModelDecoration[]
Get all the decorations for a range (filtering out decorations from other editors).
§getDomNode(): HTMLElement
getDomNode(): HTMLElement
Returns the editor's dom node
§getEditorType(): string
getEditorType(): string
Get the editor type. Please see EditorType.
This is to avoid an instanceof check
§getId(): string
getId(): string
Get a unique id for this editor instance.
§getLayoutInfo(): EditorLayoutInfo
getLayoutInfo(): EditorLayoutInfo
Get the layout info for the editor.
§getLineDecorations(lineNumber: number): IModelDecoration[]
getLineDecorations(lineNumber: number): IModelDecoration[]
Get all the decorations on a line (filtering out decorations from other editors).
§getModel(): ITextModel
getModel(): ITextModel
Type the getModel() of IEditor.
§getOffsetForColumn(
lineNumber: number,
column: number,
): number
getOffsetForColumn(
lineNumber: number,
column: number,
): number
Get the horizontal position (left offset) for the column w.r.t to the beginning of the line.
This method works only if the line lineNumber is currently rendered (in the editor's viewport).
Use this method with caution.
§getOption<T extends EditorOption>(
id: T,
): FindComputedEditorOptionValueById<T>
getOption<T extends EditorOption>(
id: T,
): FindComputedEditorOptionValueById<T>
Gets a specific editor option.
§getOptions(): IComputedEditorOptions
getOptions(): IComputedEditorOptions
Gets all the editor computed options.
§getRawOptions(): IEditorOptions
getRawOptions(): IEditorOptions
Returns the editor's configuration (without any validation or defaults).
§getScrolledVisiblePosition(
position: IPosition,
): { height: number; left: number; top: number }
getScrolledVisiblePosition(
position: IPosition,
): { height: number; left: number; top: number }
Get the visible position for position.
The result position takes scrolling into account and is relative to the top left corner of the editor.
Explanation 1: the results of this method will change for the same position if the user scrolls the editor.
Explanation 2: the results of this method will not change if the container of the editor gets repositioned.
Warning: the results of this method are inaccurate for positions that are outside the current editor viewport.
§getScrollHeight(): number
getScrollHeight(): number
Get the scrollHeight of the editor's viewport.
§getScrollLeft(): number
getScrollLeft(): number
Get the scrollLeft of the editor's viewport.
§getScrollTop(): number
getScrollTop(): number
Get the scrollTop of the editor's viewport.
§getScrollWidth(): number
getScrollWidth(): number
Get the scrollWidth of the editor's viewport.
§getSupportedActions(): IEditorAction[]
getSupportedActions(): IEditorAction[]
Returns all actions associated with this editor.
§getTargetAtClientPoint(
clientX: number,
clientY: number,
): IMouseTarget
getTargetAtClientPoint(
clientX: number,
clientY: number,
): IMouseTarget
Get the hit test target at coordinates clientX and clientY.
The coordinates are relative to the top-left of the viewport.
§getTopForLineNumber(
lineNumber: number,
includeViewZones?: boolean,
): number
getTopForLineNumber(
lineNumber: number,
includeViewZones?: boolean,
): number
Get the vertical position (top offset) for the line's top w.r.t. to the first line.
§getTopForPosition(
lineNumber: number,
column: number,
): number
getTopForPosition(
lineNumber: number,
column: number,
): number
Get the vertical position (top offset) for the position w.r.t. to the first line.
§getValue(
options?: {
lineEnding: string;
preserveBOM: boolean;
},
): string
getValue(
options?: {
lineEnding: string;
preserveBOM: boolean;
},
): string
Get value of the current model attached to this editor.
§getVisibleColumnFromPosition(position: IPosition): number
getVisibleColumnFromPosition(position: IPosition): number
Given a position, returns a column number that takes tab-widths into account.
§getVisibleRanges(): Range[]
getVisibleRanges(): Range[]
Returns the ranges that are currently visible. Does not account for horizontal scrolling.
§handleInitialized?(): void
handleInitialized?(): void
Is called when the model has been set, view state was restored and options are updated. This is the best place to compute data for the viewport (such as tokens).
§hasPendingScrollAnimation(): boolean
hasPendingScrollAnimation(): boolean
Check if the editor is currently scrolling towards a different scroll position.
§hasTextFocus(): boolean
hasTextFocus(): boolean
Returns true if the text inside this editor is focused (i.e. cursor is blinking).
§hasWidgetFocus(): boolean
hasWidgetFocus(): boolean
Returns true if the text inside this editor or an editor widget has focus.
§layout(
dimension?: IDimension,
postponeRendering?: boolean,
): void
layout(
dimension?: IDimension,
postponeRendering?: boolean,
): void
Instructs the editor to remeasure its container. This method should be called when the container of the editor gets resized.
If a dimension is passed in, the passed in value will be used.
By default, this will also render the editor immediately. If you prefer to delay rendering to the next animation frame, use postponeRendering == true.
§layoutContentWidget(widget: IContentWidget): void
layoutContentWidget(widget: IContentWidget): void
Layout/Reposition a content widget. This is a ping to the editor to call widget.getPosition() and update appropriately.
§layoutGlyphMarginWidget(widget: IGlyphMarginWidget): void
layoutGlyphMarginWidget(widget: IGlyphMarginWidget): void
Layout/Reposition a glyph margin widget. This is a ping to the editor to call widget.getPosition() and update appropriately.
§layoutOverlayWidget(widget: IOverlayWidget): void
layoutOverlayWidget(widget: IOverlayWidget): void
Layout/Reposition an overlay widget. This is a ping to the editor to call widget.getPosition() and update appropriately.
§popUndoStop(): boolean
popUndoStop(): boolean
Remove the "undo stop" in the undo-redo stack.
§pushUndoStop(): boolean
pushUndoStop(): boolean
Create an "undo stop" in the undo-redo stack.
§removeContentWidget(widget: IContentWidget): void
removeContentWidget(widget: IContentWidget): void
Remove a content widget.
§removeDecorations(decorationIds: string[]): void
removeDecorations(decorationIds: string[]): void
Remove previously added decorations.
§removeGlyphMarginWidget(widget: IGlyphMarginWidget): void
removeGlyphMarginWidget(widget: IGlyphMarginWidget): void
Remove a glyph margin widget.
§removeOverlayWidget(widget: IOverlayWidget): void
removeOverlayWidget(widget: IOverlayWidget): void
Remove an overlay widget.
§render(forceRedraw?: boolean): void
render(forceRedraw?: boolean): void
Force an editor render now.
§restoreViewState(state: ICodeEditorViewState): void
restoreViewState(state: ICodeEditorViewState): void
Restores the view state of the editor from a serializable object generated by saveViewState.
§revealLine(
lineNumber: number,
scrollType?: ScrollType,
): void
revealLine(
lineNumber: number,
scrollType?: ScrollType,
): void
Scroll vertically as necessary and reveal a line.
§revealLineInCenter(
lineNumber: number,
scrollType?: ScrollType,
): void
revealLineInCenter(
lineNumber: number,
scrollType?: ScrollType,
): void
Scroll vertically as necessary and reveal a line centered vertically.
§revealLineInCenterIfOutsideViewport(
lineNumber: number,
scrollType?: ScrollType,
): void
revealLineInCenterIfOutsideViewport(
lineNumber: number,
scrollType?: ScrollType,
): void
Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport.
§revealLineNearTop(
lineNumber: number,
scrollType?: ScrollType,
): void
revealLineNearTop(
lineNumber: number,
scrollType?: ScrollType,
): void
Scroll vertically as necessary and reveal a line close to the top of the viewport, optimized for viewing a code definition.
§revealLines(
startLineNumber: number,
endLineNumber: number,
scrollType?: ScrollType,
): void
revealLines(
startLineNumber: number,
endLineNumber: number,
scrollType?: ScrollType,
): void
Scroll vertically as necessary and reveal lines.
§revealLinesInCenter(
lineNumber: number,
endLineNumber: number,
scrollType?: ScrollType,
): void
revealLinesInCenter(
lineNumber: number,
endLineNumber: number,
scrollType?: ScrollType,
): void
Scroll vertically as necessary and reveal lines centered vertically.
§revealLinesInCenterIfOutsideViewport(
lineNumber: number,
endLineNumber: number,
scrollType?: ScrollType,
): void
revealLinesInCenterIfOutsideViewport(
lineNumber: number,
endLineNumber: number,
scrollType?: ScrollType,
): void
Scroll vertically as necessary and reveal lines centered vertically only if it lies outside the viewport.
§revealLinesNearTop(
lineNumber: number,
endLineNumber: number,
scrollType?: ScrollType,
): void
revealLinesNearTop(
lineNumber: number,
endLineNumber: number,
scrollType?: ScrollType,
): void
Scroll vertically as necessary and reveal lines close to the top of the viewport, optimized for viewing a code definition.
§revealPosition(
position: IPosition,
scrollType?: ScrollType,
): void
revealPosition(
position: IPosition,
scrollType?: ScrollType,
): void
Scroll vertically or horizontally as necessary and reveal a position.
§revealPositionInCenter(
position: IPosition,
scrollType?: ScrollType,
): void
revealPositionInCenter(
position: IPosition,
scrollType?: ScrollType,
): void
Scroll vertically or horizontally as necessary and reveal a position centered vertically.
§revealPositionInCenterIfOutsideViewport(
position: IPosition,
scrollType?: ScrollType,
): void
revealPositionInCenterIfOutsideViewport(
position: IPosition,
scrollType?: ScrollType,
): void
Scroll vertically or horizontally as necessary and reveal a position centered vertically only if it lies outside the viewport.
§revealPositionNearTop(
position: IPosition,
scrollType?: ScrollType,
): void
revealPositionNearTop(
position: IPosition,
scrollType?: ScrollType,
): void
Scroll vertically or horizontally as necessary and reveal a position close to the top of the viewport, optimized for viewing a code definition.
§revealRange(range: IRange, scrollType?: ScrollType): void
revealRange(range: IRange, scrollType?: ScrollType): void
Scroll vertically or horizontally as necessary and reveal a range.
§revealRangeAtTop(
range: IRange,
scrollType?: ScrollType,
): void
revealRangeAtTop(
range: IRange,
scrollType?: ScrollType,
): void
Scroll vertically or horizontally as necessary and reveal a range at the top of the viewport.
§revealRangeInCenter(
range: IRange,
scrollType?: ScrollType,
): void
revealRangeInCenter(
range: IRange,
scrollType?: ScrollType,
): void
Scroll vertically or horizontally as necessary and reveal a range centered vertically.
§revealRangeInCenterIfOutsideViewport(
range: IRange,
scrollType?: ScrollType,
): void
revealRangeInCenterIfOutsideViewport(
range: IRange,
scrollType?: ScrollType,
): void
Scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport.
§revealRangeNearTop(
range: IRange,
scrollType?: ScrollType,
): void
revealRangeNearTop(
range: IRange,
scrollType?: ScrollType,
): void
Scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport, optimized for viewing a code definition.
§revealRangeNearTopIfOutsideViewport(
range: IRange,
scrollType?: ScrollType,
): void
revealRangeNearTopIfOutsideViewport(
range: IRange,
scrollType?: ScrollType,
): void
Scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport, optimized for viewing a code definition. Only if it lies outside the viewport.
§saveViewState(): ICodeEditorViewState
saveViewState(): ICodeEditorViewState
Saves current view state of the editor in a serializable object.
§setModel(model: ITextModel): void
setModel(model: ITextModel): void
Sets the current model attached to this editor. If the previous model was created by the editor via the value key in the options literal object, it will be destroyed. Otherwise, if the previous model was set via setModel, or the model key in the options literal object, the previous model will not be destroyed. It is safe to call setModel(null) to simply detach the current model from the editor.
§setPosition(position: IPosition, source?: string): void
setPosition(position: IPosition, source?: string): void
Set the primary position of the cursor. This will remove any secondary cursors.
§setScrollLeft(
newScrollLeft: number,
scrollType?: ScrollType,
): void
setScrollLeft(
newScrollLeft: number,
scrollType?: ScrollType,
): void
Change the scrollLeft of the editor's viewport.
§setScrollPosition(
position: INewScrollPosition,
scrollType?: ScrollType,
): void
setScrollPosition(
position: INewScrollPosition,
scrollType?: ScrollType,
): void
Change the scroll position of the editor's viewport.
§setScrollTop(
newScrollTop: number,
scrollType?: ScrollType,
): void
setScrollTop(
newScrollTop: number,
scrollType?: ScrollType,
): void
Change the scrollTop of the editor's viewport.
§setSelection(selection: IRange, source?: string): void
setSelection(selection: IRange, source?: string): void
Set the primary selection of the editor. This will remove any secondary cursors.
§setSelection(selection: Range, source?: string): void
setSelection(selection: Range, source?: string): void
Set the primary selection of the editor. This will remove any secondary cursors.
§setSelection(selection: ISelection, source?: string): void
setSelection(selection: ISelection, source?: string): void
Set the primary selection of the editor. This will remove any secondary cursors.
§setSelection(selection: Selection, source?: string): void
setSelection(selection: Selection, source?: string): void
Set the primary selection of the editor. This will remove any secondary cursors.
§setSelections(
selections: readonly ISelection[],
source?: string,
): void
setSelections(
selections: readonly ISelection[],
source?: string,
): void
Set the selections for all the cursors of the editor. Cursors will be removed or added, as necessary.
§setValue(newValue: string): void
setValue(newValue: string): void
Set the value of the current model attached to this editor.
§trigger(
source: string,
handlerId: string,
payload: unknown,
): void
trigger(
source: string,
handlerId: string,
payload: unknown,
): void
Directly trigger a handler or an editor action.
§updateOptions(
newOptions: IEditorOptions & IGlobalEditorOptions,
): void
updateOptions(
newOptions: IEditorOptions & IGlobalEditorOptions,
): void
Update the editor's options after the editor has been created.
§writeScreenReaderContent(reason: string): void
writeScreenReaderContent(reason: string): void
Write the screen reader content to be the current selection
Events§
An event emitted on a "contextmenu".
readonly on Did Attempt Read Only Edit: IEvent<void>An event emitted when editing failed because the editor is read-only.
readonly on Did Blur Editor Text: IEvent<void>An event emitted when the text inside this editor lost focus (i.e. cursor stops blinking).
readonly on Did Blur Editor Widget: IEvent<void>An event emitted when the text inside this editor or an editor widget lost focus.
readonly on Did Change Configuration: IEvent<ConfigurationChangedEvent>An event emitted when the configuration of the editor has changed. (e.g. editor.updateOptions())
readonly on Did Change Cursor Position: IEvent<ICursorPositionChangedEvent>An event emitted when the cursor position has changed.
readonly on Did Change Cursor Selection: IEvent<ICursorSelectionChangedEvent>An event emitted when the cursor selection has changed.
An event emitted when hidden areas change in the editor (e.g. due to folding).
readonly on Did Change Model: IEvent<IModelChangedEvent>An event emitted when the model of this editor has changed (e.g. editor.setModel()).
readonly on Did Change Model Content: IEvent<IModelContentChangedEvent>An event emitted when the content of the current model has changed.
readonly on Did Change Model Decorations: IEvent<IModelDecorationsChangedEvent>An event emitted when the decorations of the current model have changed.
readonly on Did Change Model Language: IEvent<IModelLanguageChangedEvent>An event emitted when the language of the current model has changed.
readonly on Did Change Model Language Configuration: IEvent<IModelLanguageConfigurationChangedEvent>An event emitted when the language configuration of the current model has changed.
readonly on Did Change Model Options: IEvent<IModelOptionsChangedEvent>An event emitted when the options of the current model has changed.
readonly on Did Content Size Change: IEvent<IContentSizeChangedEvent>An event emitted when the content width or content height in the editor has changed.
readonly on Did Focus Editor Text: IEvent<void>An event emitted when the text inside this editor gained focus (i.e. cursor starts blinking).
readonly on Did Focus Editor Widget: IEvent<void>An event emitted when the text inside this editor or an editor widget gained focus.
readonly on Did Layout Change: IEvent<EditorLayoutInfo>An event emitted when the layout of the editor has changed.
readonly on Did Paste: IEvent<IPasteEvent>An event emitted when users paste text in the editor.
readonly on Did Scroll Change: IEvent<IScrollEvent>An event emitted when the scroll in the editor has changed.
readonly on Key Down: IEvent<IKeyboardEvent>An event emitted on a "keydown".
readonly on Key Up: IEvent<IKeyboardEvent>An event emitted on a "keyup".
readonly on Mouse Down: IEvent<IEditorMouseEvent>An event emitted on a "mousedown".
readonly on Mouse Leave: IEvent<IPartialEditorMouseEvent>An event emitted on a "mouseleave".
readonly on Mouse Move: IEvent<IEditorMouseEvent>An event emitted on a "mousemove".
readonly on Mouse Up: IEvent<IEditorMouseEvent>An event emitted on a "mouseup".
readonly on Will Change Model: IEvent<IModelChangedEvent>An event emitted when the model of this editor is about to change (e.g. from editor.setModel()).
§onDidDispose(listener: () => void): IDisposable
onDidDispose(listener: () => void): IDisposable
An event emitted when the editor has been disposed.
A rich code editor.