A rich code editor.

Hierarchy

Index

Events

Methods

Events

onContextMenu

onDidBlurEditorText

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

    Parameters

    • listener: function
        • (): void
        • Returns void

    Returns IDisposable

onDidBlurEditorWidget

  • onDidBlurEditorWidget(listener: function): IDisposable
  • An event emitted when the text inside this editor or an editor widget lost focus.

    Parameters

    • listener: function
        • (): void
        • Returns void

    Returns IDisposable

onDidChangeConfiguration

  • onDidChangeConfiguration(listener: function): IDisposable

onDidChangeCursorPosition

  • onDidChangeCursorPosition(listener: function): IDisposable

onDidChangeCursorSelection

  • onDidChangeCursorSelection(listener: function): IDisposable

onDidChangeModel

onDidChangeModelContent

  • onDidChangeModelContent(listener: function): IDisposable

onDidChangeModelDecorations

  • onDidChangeModelDecorations(listener: function): IDisposable

onDidChangeModelLanguage

  • onDidChangeModelLanguage(listener: function): IDisposable

onDidChangeModelLanguageConfiguration

  • onDidChangeModelLanguageConfiguration(listener: function): IDisposable

onDidChangeModelOptions

  • onDidChangeModelOptions(listener: function): IDisposable

onDidDispose

onDidFocusEditorText

  • onDidFocusEditorText(listener: function): IDisposable
  • An event emitted when the text inside this editor gained focus (i.e. cursor starts blinking).

    Parameters

    • listener: function
        • (): void
        • Returns void

    Returns IDisposable

onDidFocusEditorWidget

  • onDidFocusEditorWidget(listener: function): IDisposable
  • An event emitted when the text inside this editor or an editor widget gained focus.

    Parameters

    • listener: function
        • (): void
        • Returns void

    Returns IDisposable

onDidLayoutChange

onDidPaste

  • An event emitted when users paste text in the editor.

    Parameters

    • listener: function
        • Parameters

          Returns void

    Returns IDisposable

onDidScrollChange

onKeyDown

onKeyUp

onMouseDown

onMouseLeave

onMouseMove

onMouseUp

Methods

addContentWidget

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

    Parameters

    Returns void

addOverlayWidget

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

    Parameters

    Returns void

applyFontInfo

changeViewZones

  • changeViewZones(callback: function): void

deltaDecorations

  • deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[]
  • All decorations added through this call will get the ownerId of this editor.

    see

    ITextModel.deltaDecorations

    Parameters

    • oldDecorations: string[]
    • newDecorations: IModelDeltaDecoration[]

    Returns string[]

dispose

  • dispose(): void

executeCommand

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

    Parameters

    • source: string

      The source of the call.

    • command: ICommand

      The command to execute

    Returns void

executeCommands

  • executeCommands(source: string, commands: ICommand[]): void
  • Execute multiple (concomitant) commands on the editor.

    Parameters

    • source: string

      The source of the call.

    • commands: ICommand[]

    Returns void

executeEdits

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

    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

focus

  • focus(): void

getAction

  • Get an action that is a contribution to this editor.

    id

    Unique identifier of the contribution.

    Parameters

    • id: string

    Returns IEditorAction

    The action or null if action not found.

getContribution

  • getContribution<T>(id: string): T
  • Get a contribution of this editor.

    id

    Unique identifier of the contribution.

    Type parameters

    Parameters

    • id: string

    Returns T

    The contribution or null if contribution not found.

getDomNode

getEditorType

  • getEditorType(): string

getId

  • getId(): string

getLayoutInfo

getLineDecorations

  • getLineDecorations(lineNumber: number): IModelDecoration[] | null
  • Get all the decorations on a line (filtering out decorations from other editors).

    Parameters

    • lineNumber: number

    Returns IModelDecoration[] | null

getModel

getOffsetForColumn

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

    Parameters

    • lineNumber: number
    • column: number

    Returns number

getPosition

getRawOptions

getScrollHeight

  • getScrollHeight(): number
  • Get the scrollHeight of the editor's viewport.

    Returns number

getScrollLeft

  • getScrollLeft(): number
  • Get the scrollLeft of the editor's viewport.

    Returns number

getScrollTop

  • getScrollTop(): number
  • Get the scrollTop of the editor's viewport.

    Returns number

getScrollWidth

  • getScrollWidth(): number
  • Get the scrollWidth of the editor's viewport.

    Returns number

getScrolledVisiblePosition

  • getScrolledVisiblePosition(position: IPosition): object | null
  • 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

    Returns object | null

getSelection

getSelections

  • getSelections(): Selection[] | null

getSupportedActions

  • getSupportedActions(): IEditorAction[]

getTargetAtClientPoint

  • getTargetAtClientPoint(clientX: number, clientY: number): IMouseTarget | null
  • Get the hit test target at coordinates clientX and clientY. The coordinates are relative to the top-left of the viewport.

    Parameters

    • clientX: number
    • clientY: number

    Returns IMouseTarget | null

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

getTopForLineNumber

  • getTopForLineNumber(lineNumber: number): number
  • Get the vertical position (top offset) for the line w.r.t. to the first line.

    Parameters

    • lineNumber: number

    Returns number

getTopForPosition

  • getTopForPosition(lineNumber: number, column: number): number
  • Get the vertical position (top offset) for the position w.r.t. to the first line.

    Parameters

    • lineNumber: number
    • column: number

    Returns number

getValue

  • getValue(options?: object): string
  • Get value of the current model attached to this editor.

    see

    ITextModel.getValue

    Parameters

    • Optional options: object
      • lineEnding: string
      • preserveBOM: boolean

    Returns string

getVisibleColumnFromPosition

  • getVisibleColumnFromPosition(position: IPosition): number

getVisibleRanges

  • getVisibleRanges(): Range[]
  • Returns the ranges that are currently visible. Does not account for horizontal scrolling.

    Returns Range[]

hasTextFocus

  • hasTextFocus(): boolean

hasWidgetFocus

  • hasWidgetFocus(): boolean
  • Returns true if the text inside this editor or an editor widget has focus.

    Returns boolean

layout

  • 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

    Returns void

layoutContentWidget

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

    Parameters

    Returns void

layoutOverlayWidget

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

    Parameters

    Returns void

onCompositionEnd

  • An event emitted after composition has ended.

    Parameters

    • listener: function
        • (): void
        • Returns void

    Returns IDisposable

onCompositionStart

  • An event emitted after composition has started.

    Parameters

    • listener: function
        • (): void
        • Returns void

    Returns IDisposable

pushUndoStop

  • pushUndoStop(): boolean
  • Push an "undo stop" in the undo-redo stack.

    Returns boolean

removeContentWidget

removeOverlayWidget

render

  • render(forceRedraw?: boolean): void
  • Force an editor render now.

    Parameters

    • Optional forceRedraw: boolean

    Returns void

restoreViewState

revealLine

  • revealLine(lineNumber: number, scrollType?: ScrollType): void

revealLineInCenter

  • revealLineInCenter(lineNumber: number, scrollType?: ScrollType): void

revealLineInCenterIfOutsideViewport

  • revealLineInCenterIfOutsideViewport(lineNumber: number, scrollType?: ScrollType): void

revealLines

  • revealLines(startLineNumber: number, endLineNumber: number, scrollType?: ScrollType): void

revealLinesInCenter

  • revealLinesInCenter(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void

revealLinesInCenterIfOutsideViewport

  • revealLinesInCenterIfOutsideViewport(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void

revealPosition

revealPositionInCenter

revealPositionInCenterIfOutsideViewport

revealRange

revealRangeAtTop

revealRangeInCenter

revealRangeInCenterIfOutsideViewport

  • revealRangeInCenterIfOutsideViewport(range: IRange, scrollType?: ScrollType): void

saveViewState

setModel

  • 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

    Returns void

setPosition

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

    Parameters

    • position: IPosition

      New primary cursor's position

    Returns void

setScrollLeft

  • setScrollLeft(newScrollLeft: number): void
  • Change the scrollLeft of the editor's viewport.

    Parameters

    • newScrollLeft: number

    Returns void

setScrollPosition

setScrollTop

  • setScrollTop(newScrollTop: number): void
  • Change the scrollTop of the editor's viewport.

    Parameters

    • newScrollTop: number

    Returns void

setSelection

  • setSelection(selection: IRange): void
  • setSelection(selection: Range): void
  • setSelection(selection: ISelection): void
  • setSelection(selection: Selection): void

setSelections

  • setSelections(selections: keyof ISelection[]): void
  • Set the selections for all the cursors of the editor. Cursors will be removed or added, as necessary.

    Parameters

    • selections: keyof ISelection[]

    Returns void

setValue

  • setValue(newValue: string): void
  • Set the value of the current model attached to this editor.

    see

    ITextModel.setValue

    Parameters

    • newValue: string

    Returns void

trigger

  • trigger(source: string, handlerId: string, payload: any): 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

updateOptions