An editor.

Hierarchy

Index

Events

onDidDispose

  • An event emitted when the editor has been disposed.

    Parameters

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

    Returns IDisposable

Methods

dispose

  • dispose(): void

focus

  • focus(): void
  • Brings browser focus to the editor text

    Returns void

getActions

  • getActions(): IEditorAction[]
  • Returns all actions associated with this editor.

    Returns IEditorAction[]

getEditorType

  • getEditorType(): string
  • Get the editor type. Please see EditorType. This is to avoid an instanceof check

    Returns string

getId

  • getId(): string
  • Get a unique id for this editor instance.

    Returns string

getModel

getPosition

getSelection

getSelections

  • getSelections(): Selection[]
  • Returns all the selections of the editor.

    Returns Selection[]

getSupportedActions

  • getSupportedActions(): IEditorAction[]
  • Returns all actions associated with this editor.

    Returns IEditorAction[]

getVisibleColumnFromPosition

  • getVisibleColumnFromPosition(position: IPosition): number
  • Given a position, returns a column number that takes tab-widths into account.

    Parameters

    Returns number

isFocused

  • isFocused(): boolean
  • Returns true if this editor has keyboard focus (e.g. cursor is blinking).

    Returns 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

restoreViewState

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

    Parameters

    Returns void

revealLine

  • revealLine(lineNumber: number): void
  • Scroll vertically as necessary and reveal a line.

    Parameters

    • lineNumber: number

    Returns void

revealLineInCenter

  • revealLineInCenter(lineNumber: number): void
  • Scroll vertically as necessary and reveal a line centered vertically.

    Parameters

    • lineNumber: number

    Returns void

revealLineInCenterIfOutsideViewport

  • revealLineInCenterIfOutsideViewport(lineNumber: number): void
  • Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport.

    Parameters

    • lineNumber: number

    Returns 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
  • Scroll vertically as necessary and reveal lines centered vertically.

    Parameters

    • lineNumber: number
    • endLineNumber: number

    Returns void

revealLinesInCenterIfOutsideViewport

  • revealLinesInCenterIfOutsideViewport(lineNumber: number, endLineNumber: number): void
  • Scroll vertically as necessary and reveal lines centered vertically only if it lies outside the viewport.

    Parameters

    • lineNumber: number
    • endLineNumber: number

    Returns 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
  • Scroll vertically or horizontally as necessary and reveal a position centered vertically.

    Parameters

    Returns void

revealPositionInCenterIfOutsideViewport

  • revealPositionInCenterIfOutsideViewport(position: IPosition): void
  • Scroll vertically or horizontally as necessary and reveal a position centered vertically only if it lies outside the viewport.

    Parameters

    Returns void

revealRange

  • revealRange(range: IRange): void
  • Scroll vertically or horizontally as necessary and reveal a range.

    Parameters

    Returns void

revealRangeAtTop

  • revealRangeAtTop(range: IRange): void
  • Scroll vertically or horizontally as necessary and reveal a range at the top of the viewport.

    Parameters

    Returns void

revealRangeInCenter

  • revealRangeInCenter(range: IRange): void
  • Scroll vertically or horizontally as necessary and reveal a range centered vertically.

    Parameters

    Returns void

revealRangeInCenterIfOutsideViewport

  • revealRangeInCenterIfOutsideViewport(range: IRange): void
  • Scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport.

    Parameters

    Returns 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

setSelection

  • setSelection(selection: IRange): void
  • setSelection(selection: Range): void
  • setSelection(selection: ISelection): void
  • setSelection(selection: Selection): void
  • Set the primary selection of the editor. This will remove any secondary cursors.

    Parameters

    • selection: IRange

      The new selection

    Returns void

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

    Parameters

    • selection: Range

      The new selection

    Returns void

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

    Parameters

    Returns void

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

    Parameters

    Returns 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

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