on Did Change Model Decorations on Did Change Model Language on Did Change Model Language Configuration on Did Change Model Options on Did Content Size Change on Did Focus Editor Text on Did Focus Editor Widget on Did Layout Change on Did Paste on Did Scroll Change on Key Down on Key Up on Mouse Down on Mouse Leave on Mouse Move on Mouse Up on Did Dispose

Properties

on Did Composition End on Did Composition Start

Methods

add Content Widget add Glyph Margin Widget add Overlay Widget apply Font Info change View Zones create Decorations Collection delta Decorations dispose execute Command execute Commands execute Edits focus get Action get Bottom For Line Number get Container Dom Node get Content Height get Content Width get Contribution get Decorations In Range get Dom Node get Editor Type get Id get Layout Info get Line Decorations get Model get Offset For Column get Option get Options get Position get Raw Options get Scroll Height get Scroll Left get Scroll Top get Scroll Width get Scrolled Visible Position get Selection get Selections get Supported Actions get Target At Client Point get Top For Line Number get Top For Position get Value get Visible Column From Position get Visible Ranges handle Initialized? has Pending Scroll Animation has Text Focus has Widget Focus layout layout Content Widget layout Glyph Margin Widget layout Overlay Widget pop Undo Stop push Undo Stop remove Content Widget remove Decorations remove Glyph Margin Widget remove Overlay Widget render restore View State reveal Line reveal Line In Center reveal Line In Center If Outside Viewport reveal Line Near Top reveal Lines reveal Lines In Center reveal Lines In Center If Outside Viewport reveal Lines Near Top reveal Position reveal Position In Center reveal Position In Center If Outside Viewport reveal Position Near Top reveal Range reveal Range At Top reveal Range In Center reveal Range In Center If Outside Viewport reveal Range Near Top reveal Range Near Top If Outside Viewport save View State set Banner set Model set Position set Scroll Left set Scroll Position set Scroll Top set Selection set Selections set Value trigger update Options write Screen Reader Content

Events

on Context Menu : IEvent < IEditorMouseEvent >

An event emitted on a "contextmenu".

  • Defined in editor.api.d.ts:5621
  • on Did Attempt Read Only Edit : IEvent < void >

    An event emitted when editing failed because the editor is read-only.

  • Defined in editor.api.d.ts:5601
  • on Did Blur Editor Text : IEvent < void >

    An event emitted when the text inside this editor lost focus (i.e. cursor stops blinking).

  • Defined in editor.api.d.ts:5578
  • on Did Blur Editor Widget : IEvent < void >

    An event emitted when the text inside this editor or an editor widget lost focus.

  • Defined in editor.api.d.ts:5588
  • on Did Change Configuration : IEvent < ConfigurationChangedEvent >

    An event emitted when the configuration of the editor has changed. (e.g. editor.updateOptions() )

  • Defined in editor.api.d.ts:5548
  • on Did Change Cursor Position : IEvent < ICursorPositionChangedEvent >

    An event emitted when the cursor position has changed.

  • Defined in editor.api.d.ts:5553
  • on Did Change Cursor Selection : IEvent < ICursorSelectionChangedEvent >

    An event emitted when the cursor selection has changed.

  • Defined in editor.api.d.ts:5558
  • on Did Change Hidden Areas : IEvent < void >

    An event emitted when hidden areas change in the editor (e.g. due to folding).

  • Defined in editor.api.d.ts:5661
  • on Did Change Model : IEvent < IModelChangedEvent >

    An event emitted when the model of this editor has changed (e.g. editor.setModel() ).

  • Defined in editor.api.d.ts:5563
  • on Did Change Model Content : IEvent < IModelContentChangedEvent >

    An event emitted when the content of the current model has changed.

  • Defined in editor.api.d.ts:5528
  • on Did Change Model Decorations : IEvent < IModelDecorationsChangedEvent >

    An event emitted when the decorations of the current model have changed.

  • Defined in editor.api.d.ts:5568
  • on Did Change Model Language : IEvent < IModelLanguageChangedEvent >

    An event emitted when the language of the current model has changed.

  • Defined in editor.api.d.ts:5533
  • on Did Change Model Language Configuration : IEvent < IModelLanguageConfigurationChangedEvent >

    An event emitted when the language configuration of the current model has changed.

  • Defined in editor.api.d.ts:5538
  • on Did Change Model Options : IEvent < IModelOptionsChangedEvent >

    An event emitted when the options of the current model has changed.

  • Defined in editor.api.d.ts:5543
  • on Did Content Size Change : IEvent < IContentSizeChangedEvent >

    An event emitted when the content width or content height in the editor has changed.

  • Defined in editor.api.d.ts:5651
  • on Did Focus Editor Text : IEvent < void >

    An event emitted when the text inside this editor gained focus (i.e. cursor starts blinking).

  • Defined in editor.api.d.ts:5573
  • on Did Focus Editor Widget : IEvent < void >

    An event emitted when the text inside this editor or an editor widget gained focus.

  • Defined in editor.api.d.ts:5583
  • on Did Layout Change : IEvent < EditorLayoutInfo >

    An event emitted when the layout of the editor has changed.

  • Defined in editor.api.d.ts:5646
  • on Did Paste : IEvent < IPasteEvent >

    An event emitted when users paste text in the editor.

  • Defined in editor.api.d.ts:5606
  • on Did Scroll Change : IEvent < IScrollEvent >

    An event emitted when the scroll in the editor has changed.

  • Defined in editor.api.d.ts:5656
  • on Key Down : IEvent < IKeyboardEvent >

    An event emitted on a "keydown".

  • Defined in editor.api.d.ts:5641
  • An event emitted on a "keyup".

  • Defined in editor.api.d.ts:5636
  • on Mouse Down : IEvent < IEditorMouseEvent >

    An event emitted on a "mousedown".

  • Defined in editor.api.d.ts:5616
  • on Mouse Leave : IEvent < IPartialEditorMouseEvent >

    An event emitted on a "mouseleave".

  • Defined in editor.api.d.ts:5631
  • on Mouse Move : IEvent < IEditorMouseEvent >

    An event emitted on a "mousemove".

  • Defined in editor.api.d.ts:5626
  • An event emitted on a "mouseup".

  • Defined in editor.api.d.ts:5611
  • An event emitted when the editor has been disposed.

    Parameters

    listener: ( ( ) => void )
  • ( ) : void
  • Returns void

    Returns IDisposable

    Properties

    on Did Composition End : IEvent < void >

    An event emitted after composition has ended.

  • Defined in editor.api.d.ts:5596
  • on Did Composition Start : IEvent < void >

    An event emitted after composition has started.

  • Defined in editor.api.d.ts:5592
  • Methods

    Add a content widget. Widgets must have unique ids, otherwise they will be overwritten.

    Parameters

    widget: IContentWidget

    Returns void

    Add a glyph margin widget. Widgets must have unique ids, otherwise they will be overwritten.

    Parameters

    widget: IGlyphMarginWidget

    Returns void

    Add an overlay widget. Widgets must have unique ids, otherwise they will be overwritten.

    Parameters

    widget: IOverlayWidget

    Returns void

    Apply the same font settings as the editor to target .

    Parameters

    target: HTMLElement

    Returns void

    Change the view zones. View zones are lost when a new model is attached to the editor.

    Parameters

    callback: ( ( accessor : IViewZoneChangeAccessor ) => void )
  • ( accessor : IViewZoneChangeAccessor ) : void
  • Parameters

    accessor: IViewZoneChangeAccessor

    Returns void

    Returns void

    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.

    Parameters

    Optional decorations: IModelDeltaDecoration []

    Returns IEditorDecorationsCollection

    All decorations added through this call will get the ownerId of this editor.

    Deprecated

    Use createDecorationsCollection

    See

    createDecorationsCollection

    Parameters

    oldDecorations: string []
    newDecorations: IModelDeltaDecoration []

    Returns string []

    Dispose the editor.

    Returns void

    Execute a command on the editor. The edits will land on the undo-redo stack, but no "undo stop" will be pushed.

    Parameters

    source: string

    The source of the call.

    command: ICommand

    The command to execute

    Returns void

    Execute multiple (concomitant) commands on the editor.

    Parameters

    source: string

    The source of the call.

    commands: ICommand []

    Returns void

    Execute edits on the editor. The edits will land on the undo-redo stack, but no "undo stop" will be pushed.

    Parameters

    source: string

    The source of the call.

    edits: IIdentifiedSingleEditOperation []

    The edits to execute.

    Optional endCursorState: ICursorStateComputer | Selection []

    Cursor state after the edits were applied.

    Returns boolean

    Brings browser focus to the editor text

    Returns void

    Get an action that is a contribution to this editor.

    Id

    Unique identifier of the contribution.

    Returns

    The action or null if action not found.

    Parameters

    id: string

    Returns IEditorAction

    Get the vertical position (top offset) for the line's bottom w.r.t. to the first line.

    Parameters

    lineNumber: number

    Returns number

    Returns the editor's container dom node

    Returns HTMLElement

    Get the height of the editor's content. This is information that is "erased" when computing scrollHeight = Math.max(contentHeight, height)

    Returns number

    Get the width of the editor's content. This is information that is "erased" when computing scrollWidth = Math.max(contentWidth, width)

    Returns number

    Get a contribution of this editor.

    Id

    Unique identifier of the contribution.

    Returns

    The contribution or null if contribution not found.

    Type Parameters

    T extends IEditorContribution

    Parameters

    id: string

    Returns T

    Get all the decorations for a range (filtering out decorations from other editors).

    Parameters

    range: Range

    Returns IModelDecoration []

    Returns the editor's dom node

    Returns HTMLElement

    Get the editor type. Please see EditorType . This is to avoid an instanceof check

    Returns string

    Get a unique id for this editor instance.

    Returns string

    Get the layout info for the editor.

    Returns EditorLayoutInfo

    Get all the decorations on a line (filtering out decorations from other editors).

    Parameters

    lineNumber: number

    Returns IModelDecoration []

    Type the getModel() of IEditor.

    Returns ITextModel

    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.

    Parameters

    lineNumber: number
    column: number

    Returns number

    Gets a specific editor option.

    Type Parameters

    T extends EditorOption

    Parameters

    id: T

    Returns FindComputedEditorOptionValueById < T >

    Gets all the editor computed options.

    Returns IComputedEditorOptions

    Returns the primary position of the cursor.

    Returns Position

    Returns the editor's configuration (without any validation or defaults).

    Returns IEditorOptions

    Get the scrollHeight of the editor's viewport.

    Returns number

    Get the scrollLeft of the editor's viewport.

    Returns number

    Get the scrollTop of the editor's viewport.

    Returns number

    Get the scrollWidth of the editor's viewport.

    Returns 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.

    Parameters

    position: IPosition

    Returns {
    height : number ;
    left : number ;
    top : number ;
    }

    height : number
    left : number
    top : number

    Returns the primary selection of the editor.

    Returns Selection

    Returns all the selections of the editor.

    Returns Selection []

    Returns all actions associated with this editor.

    Returns IEditorAction []

    Get the hit test target at coordinates clientX and clientY . The coordinates are relative to the top-left of the viewport.

    Returns

    Hit test target or null if the coordinates fall outside the editor or the editor has no model.

    Parameters

    clientX: number
    clientY: number

    Returns IMouseTarget

    Get the vertical position (top offset) for the line's top w.r.t. to the first line.

    Parameters

    lineNumber: number
    Optional includeViewZones: boolean

    Returns number

    Get the vertical position (top offset) for the position w.r.t. to the first line.

    Parameters

    lineNumber: number
    column: number

    Returns number

    Get value of the current model attached to this editor.

    See

    getValue

    Parameters

    Optional options: {
    lineEnding : string ;
    preserveBOM : boolean ;
    }
    line Ending : string
    preserveBOM : boolean

    Returns string

    Given a position, returns a column number that takes tab-widths into account.

    Parameters

    position: IPosition

    Returns number

    Returns the ranges that are currently visible. Does not account for horizontal scrolling.

    Returns Range []

    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).

    Returns void

    Check if the editor is currently scrolling towards a different scroll position.

    Returns boolean

    Returns true if the text inside this editor is focused (i.e. cursor is blinking).

    Returns boolean

    Returns true if the text inside this editor or an editor widget has focus.

    Returns boolean

    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.

    Parameters

    Optional dimension: IDimension

    Returns void

    Layout/Reposition a content widget. This is a ping to the editor to call widget.getPosition() and update appropriately.

    Parameters

    widget: IContentWidget

    Returns void

    Layout/Reposition a glyph margin widget. This is a ping to the editor to call widget.getPosition() and update appropriately.

    Parameters

    widget: IGlyphMarginWidget

    Returns void

    Layout/Reposition an overlay widget. This is a ping to the editor to call widget.getPosition() and update appropriately.

    Parameters

    widget: IOverlayWidget

    Returns void

    Remove the "undo stop" in the undo-redo stack.

    Returns boolean

    Create an "undo stop" in the undo-redo stack.

    Returns boolean

    Remove a content widget.

    Parameters

    widget: IContentWidget

    Returns void

    Remove previously added decorations.

    Parameters

    decorationIds: string []

    Returns void

    Remove a glyph margin widget.

    Parameters

    widget: IGlyphMarginWidget

    Returns void

    Remove an overlay widget.

    Parameters

    widget: IOverlayWidget

    Returns void

    Force an editor render now.

    Parameters

    Optional forceRedraw: boolean

    Returns void

    Restores the view state of the editor from a serializable object generated by saveViewState .

    Parameters

    state: ICodeEditorViewState

    Returns void

    Scroll vertically as necessary and reveal a line.

    Parameters

    lineNumber: number
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically as necessary and reveal a line centered vertically.

    Parameters

    lineNumber: number
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport.

    Parameters

    lineNumber: number
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically as necessary and reveal a line close to the top of the viewport, optimized for viewing a code definition.

    Parameters

    lineNumber: number
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically as necessary and reveal lines.

    Parameters

    startLineNumber: number
    endLineNumber: number
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically as necessary and reveal lines centered vertically.

    Parameters

    lineNumber: number
    endLineNumber: number
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically as necessary and reveal lines centered vertically only if it lies outside the viewport.

    Parameters

    lineNumber: number
    endLineNumber: number
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically as necessary and reveal lines close to the top of the viewport, optimized for viewing a code definition.

    Parameters

    lineNumber: number
    endLineNumber: number
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically or horizontally as necessary and reveal a position.

    Parameters

    position: IPosition
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically or horizontally as necessary and reveal a position centered vertically.

    Parameters

    position: IPosition
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically or horizontally as necessary and reveal a position centered vertically only if it lies outside the viewport.

    Parameters

    position: IPosition
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically or horizontally as necessary and reveal a position close to the top of the viewport, optimized for viewing a code definition.

    Parameters

    position: IPosition
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically or horizontally as necessary and reveal a range.

    Parameters

    range: IRange
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically or horizontally as necessary and reveal a range at the top of the viewport.

    Parameters

    range: IRange
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically or horizontally as necessary and reveal a range centered vertically.

    Parameters

    range: IRange
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport.

    Parameters

    range: IRange
    Optional scrollType: ScrollType

    Returns void

    Scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport, optimized for viewing a code definition.

    Parameters

    range: IRange
    Optional scrollType: ScrollType

    Returns 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.

    Parameters

    range: IRange
    Optional scrollType: ScrollType

    Returns void

    Saves current view state of the editor in a serializable object.

    Returns ICodeEditorViewState

    Parameters

    bannerDomNode: HTMLElement
    height: number

    Returns 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.

    Parameters

    model: ITextModel

    Returns void

    Set the primary position of the cursor. This will remove any secondary cursors.

    Parameters

    position: IPosition

    New primary cursor's position

    Optional source: string

    Source of the call that caused the position

    Returns void

    Change the scrollLeft of the editor's viewport.

    Parameters

    newScrollLeft: number
    Optional scrollType: ScrollType

    Returns void

    Change the scroll position of the editor's viewport.

    Parameters

    position: INewScrollPosition
    Optional scrollType: ScrollType

    Returns void

    Change the scrollTop of the editor's viewport.

    Parameters

    newScrollTop: number
    Optional scrollType: ScrollType

    Returns void

    Set the primary selection of the editor. This will remove any secondary cursors.

    Parameters

    selection: IRange

    The new selection

    Optional source: string

    Source of the call that caused the selection

    Returns void

    Set the primary selection of the editor. This will remove any secondary cursors.

    Parameters

    selection: Range

    The new selection

    Optional source: string

    Source of the call that caused the selection

    Returns void

    Set the primary selection of the editor. This will remove any secondary cursors.

    Parameters

    selection: ISelection

    The new selection

    Optional source: string

    Source of the call that caused the selection

    Returns void

    Set the primary selection of the editor. This will remove any secondary cursors.

    Parameters

    selection: Selection

    The new selection

    Optional source: string

    Source of the call that caused the selection

    Returns void

    Set the selections for all the cursors of the editor. Cursors will be removed or added, as necessary.

    Parameters

    selections: readonly ISelection []

    The new selection

    Optional source: string

    Source of the call that caused the selection

    Returns void

    Set the value of the current model attached to this editor.

    See

    setValue

    Parameters

    newValue: string

    Returns void

    Directly trigger a handler or an editor action.

    Parameters

    source: string

    The source of the call.

    handlerId: string

    The id of the handler or the id of a contribution.

    payload: any

    Extra data to be sent to the handler.

    Returns void

    Update the editor's options after the editor has been created.

    Parameters

    newOptions: IEditorOptions

    Returns void

    Write the screen reader content to be the current selection

    Parameters

    reason: string

    Returns void

    Settings

    Member Visibility

  • Theme

    Modules

  • Monaco Editor API
  • editor
  • languages
  • typescript
  • worker
  • ICode Editor
  • on Context Menu
  • on Did Attempt Read Only Edit
  • on Did Blur Editor Text
  • on Did Blur Editor Widget
  • on Did Change Configuration
  • on Did Change Cursor Position
  • on Did Change Cursor Selection
  • on Did Change Hidden Areas
  • on Did Change Model
  • on Did Change Model Content
  • on Did Change Model Decorations
  • on Did Change Model Language
  • on Did Change Model Language Configuration
  • on Did Change Model Options
  • on Did Composition End
  • on Did Composition Start
  • on Did Content Size Change
  • on Did Focus Editor Text
  • on Did Focus Editor Widget
  • on Did Layout Change
  • on Did Paste
  • on Did Scroll Change
  • on Key Down
  • on Key Up
  • on Mouse Down
  • on Mouse Leave
  • on Mouse Move
  • on Mouse Up
  • add Content Widget
  • add Glyph Margin Widget
  • add Overlay Widget
  • apply Font Info
  • change View Zones
  • create Decorations Collection
  • delta Decorations
  • dispose
  • execute Command
  • execute Commands
  • execute Edits
  • focus
  • get Action
  • get Bottom For Line Number
  • get Container Dom Node
  • get Content Height
  • get Content Width
  • get Contribution
  • get Decorations In Range
  • get Dom Node
  • get Editor Type
  • get Id
  • get Layout Info
  • get Line Decorations
  • get Model
  • get Offset For Column
  • get Option
  • get Options
  • get Position
  • get Raw Options
  • get Scroll Height
  • get Scroll Left
  • get Scroll Top
  • get Scroll Width
  • get Scrolled Visible Position
  • get Selection
  • get Selections
  • get Supported Actions
  • get Target At Client Point
  • get Top For Line Number
  • get Top For Position
  • get Value
  • get Visible Column From Position
  • get Visible Ranges
  • handle Initialized?
  • has Pending Scroll Animation
  • has Text Focus
  • has Widget Focus
  • layout
  • layout Content Widget
  • layout Glyph Margin Widget
  • layout Overlay Widget
  • on Did Dispose
  • pop Undo Stop
  • push Undo Stop
  • remove Content Widget
  • remove Decorations
  • remove Glyph Margin Widget
  • remove Overlay Widget
  • render
  • restore View State
  • reveal Line
  • reveal Line In Center
  • reveal Line In Center If Outside Viewport
  • reveal Line Near Top
  • reveal Lines
  • reveal Lines In Center
  • reveal Lines In Center If Outside Viewport
  • reveal Lines Near Top
  • reveal Position
  • reveal Position In Center
  • reveal Position In Center If Outside Viewport
  • reveal Position Near Top
  • reveal Range
  • reveal Range At Top
  • reveal Range In Center
  • reveal Range In Center If Outside Viewport
  • reveal Range Near Top
  • reveal Range Near Top If Outside Viewport
  • save View State
  • set Banner
  • set Model
  • set Position
  • set Scroll Left
  • set Scroll Position
  • set Scroll Top
  • set Selection
  •