A rich code editor.

Hierarchy

Index

Events

Methods

Events

onContextMenu

onDidBlurEditor

onDidBlurEditorText

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

onDidChangeModelOptions

  • onDidChangeModelOptions(listener: function): IDisposable

onDidDispose

onDidFocusEditor

onDidFocusEditorText

  • onDidFocusEditorText(listener: function): IDisposable

onDidLayoutChange

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

  • applyFontInfo(target: HTMLElement): void
  • Apply the same font settings as the editor to target.

    Parameters

    • target: HTMLElement

    Returns void

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

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

executeEdits

  • executeEdits(source: string, edits: IIdentifiedSingleEditOperation[], endCursoState?: 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 endCursoState: Selection[]

      Cursor state after the edits were applied.

    Returns boolean

focus

  • focus(): void

getAction

getActions

  • getActions(): IEditorAction[]

getCenteredRangeInViewport

  • getCenteredRangeInViewport(): Range
  • Returns the range that is currently centered in the view port.

    Returns Range

getConfiguration

getContribution

  • getContribution<T>(id: string): T

getDomNode

  • getDomNode(): HTMLElement

getEditorType

  • getEditorType(): string

getId

  • getId(): string

getLayoutInfo

getLineDecorations

  • getLineDecorations(lineNumber: number): IModelDecoration[]

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

getScrollHeight

  • getScrollHeight(): number

getScrollLeft

  • getScrollLeft(): number

getScrollTop

  • getScrollTop(): number

getScrollWidth

  • getScrollWidth(): number

getScrolledVisiblePosition

  • getScrolledVisiblePosition(position: IPosition): object
  • 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 innacurate for positions that are outside the current editor viewport.

    Parameters

    Returns object

    • height: number
    • left: number
    • top: number

getSelection

getSelections

  • getSelections(): Selection[]

getSupportedActions

  • getSupportedActions(): IEditorAction[]

getTargetAtClientPoint

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

    Parameters

    • clientX: number
    • clientY: number

    Returns IMouseTarget

    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

    IModel.getValue

    Parameters

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

    Returns string

getVisibleColumnFromPosition

  • getVisibleColumnFromPosition(position: IPosition): number

hasWidgetFocus

  • hasWidgetFocus(): boolean

isFocused

  • isFocused(): boolean

layout

  • Instructs the editor to remeasure its container. This method should be called when the container of the editor gets resized.

    Parameters

    Returns void

layoutContentWidget

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

    Parameters

    Returns void

layoutOverlayWidget

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

    Parameters

    Returns void

pushUndoStop

  • pushUndoStop(): boolean

removeContentWidget

removeOverlayWidget

render

  • render(): void

restoreViewState

revealLine

  • revealLine(lineNumber: number): void

revealLineInCenter

  • revealLineInCenter(lineNumber: number): void

revealLineInCenterIfOutsideViewport

  • revealLineInCenterIfOutsideViewport(lineNumber: number): void

revealLines

  • revealLines(startLineNumber: number, endLineNumber: number): void
  • Scroll vertically as necessary and reveal lines.

    Parameters

    • startLineNumber: number
    • endLineNumber: number

    Returns void

revealLinesInCenter

  • revealLinesInCenter(lineNumber: number, endLineNumber: number): void

revealLinesInCenterIfOutsideViewport

  • revealLinesInCenterIfOutsideViewport(lineNumber: number, endLineNumber: number): void

revealPosition

  • revealPosition(position: IPosition, revealVerticalInCenter?: boolean, revealHorizontal?: boolean): void
  • Scroll vertically or horizontally as necessary and reveal a position.

    Parameters

    • position: IPosition
    • Optional revealVerticalInCenter: boolean
    • Optional revealHorizontal: boolean

    Returns void

revealPositionInCenter

  • revealPositionInCenter(position: IPosition): void

revealPositionInCenterIfOutsideViewport

  • revealPositionInCenterIfOutsideViewport(position: IPosition): void

revealRange

  • revealRange(range: IRange): void

revealRangeAtTop

  • revealRangeAtTop(range: IRange): void

revealRangeInCenter

  • revealRangeInCenter(range: IRange): void

revealRangeInCenterIfOutsideViewport

  • revealRangeInCenterIfOutsideViewport(range: IRange): 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

setScrollPosition

setScrollTop

  • setScrollTop(newScrollTop: number): void

setSelection

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

setSelections

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

    Parameters

    • selections: ISelection[]

    Returns void

setValue

  • setValue(newValue: string): 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