Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IStandaloneCodeEditor

Hierarchy

Index

Events

Methods

Events

onContextMenu

onDidAttemptReadOnlyEdit

  • onDidAttemptReadOnlyEdit(listener: () => void): IDisposable

onDidBlurEditorText

  • onDidBlurEditorText(listener: () => void): IDisposable
  • An event emitted when the text inside this editor lost focus (i.e. cursor stops blinking).

    Parameters

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

    Returns IDisposable

onDidBlurEditorWidget

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

    Parameters

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

    Returns IDisposable

onDidChangeConfiguration

onDidChangeCursorPosition

onDidChangeCursorSelection

onDidChangeModel

onDidChangeModelContent

onDidChangeModelDecorations

onDidChangeModelLanguage

onDidChangeModelLanguageConfiguration

onDidChangeModelOptions

onDidContentSizeChange

onDidDispose

  • An event emitted when the editor has been disposed.

    Parameters

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

    Returns IDisposable

onDidFocusEditorText

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

    Parameters

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

    Returns IDisposable

onDidFocusEditorWidget

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

    Parameters

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

    Returns IDisposable

onDidLayoutChange

onDidPaste

onDidScrollChange

onKeyDown

onKeyUp

onMouseDown

onMouseLeave

onMouseMove

onMouseUp

Methods

addAction

addCommand

  • addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null
  • Parameters

    Returns string | null

addContentWidget

addOverlayWidget

applyFontInfo

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

    Parameters

    • target: HTMLElement

    Returns void

changeViewZones

createContextKey

  • createContextKey<T>(key: string, defaultValue: T): IContextKey<T>
  • Type parameters

    • T

    Parameters

    • key: string
    • defaultValue: T

    Returns IContextKey<T>

deltaDecorations

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

    see

    ITextModel.deltaDecorations

    Parameters

    Returns string[]

dispose

  • dispose(): void

executeCommand

  • executeCommand(source: string | null | undefined, 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 | null | undefined

      The source of the call.

    • command: ICommand

      The command to execute

    Returns void

executeCommands

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

    Parameters

    • source: string | null | undefined

      The source of the call.

    • commands: (ICommand | null)[]

    Returns void

executeEdits

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

    Parameters

    Returns boolean

focus

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

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

getContainerDomNode

  • getContainerDomNode(): HTMLElement

getContentHeight

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

    Returns number

getContentWidth

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

    Returns number

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

  • getDomNode(): HTMLElement | null
  • Returns the editor's dom node

    Returns HTMLElement | null

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

getLayoutInfo

getLineDecorations

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

getOption

getOptions

getPosition

getRawOptions

getScrollHeight

  • getScrollHeight(): number

getScrollLeft

  • getScrollLeft(): number

getScrollTop

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

    Returns number

getScrollWidth

  • getScrollWidth(): number

getScrolledVisiblePosition

  • getScrolledVisiblePosition(position: IPosition): { height: number; left: number; top: number } | 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 { height: number; left: number; top: number } | null

getSelection

getSelections

getSupportedActions

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?: { lineEnding: string; preserveBOM: boolean }): string
  • Get value of the current model attached to this editor.

    see

    ITextModel.getValue

    Parameters

    • Optional options: { lineEnding: string; preserveBOM: boolean }
      • 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
  • Returns true if the text inside this editor is focused (i.e. cursor is blinking).

    Returns 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

onDidCompositionEnd

  • onDidCompositionEnd(listener: () => void): IDisposable

onDidCompositionStart

  • onDidCompositionStart(listener: () => void): IDisposable

popUndoStop

  • popUndoStop(): boolean
  • Remove the "undo stop" in the undo-redo stack.

    Returns boolean

pushUndoStop

  • pushUndoStop(): boolean
  • Create 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
  • Scroll vertically as necessary and reveal a line.

    Parameters

    • lineNumber: number
    • Optional scrollType: ScrollType

    Returns void

revealLineInCenter

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

    Parameters

    • lineNumber: number
    • Optional scrollType: ScrollType

    Returns void

revealLineInCenterIfOutsideViewport

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

revealLineNearTop

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

    Parameters

    • lineNumber: number
    • Optional scrollType: ScrollType

    Returns void

revealLines

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

    Parameters

    • startLineNumber: number
    • endLineNumber: number
    • Optional scrollType: ScrollType

    Returns void

revealLinesInCenter

  • revealLinesInCenter(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void
  • Scroll vertically as necessary and reveal lines centered vertically.

    Parameters

    • lineNumber: number
    • endLineNumber: number
    • Optional scrollType: ScrollType

    Returns void

revealLinesInCenterIfOutsideViewport

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

revealLinesNearTop

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

    Parameters

    • lineNumber: number
    • endLineNumber: number
    • Optional scrollType: ScrollType

    Returns void

revealPosition

revealPositionInCenter

revealPositionInCenterIfOutsideViewport

revealPositionNearTop

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

    Parameters

    Returns void

revealRange

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

    Parameters

    Returns void

revealRangeAtTop

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

    Parameters

    Returns void

revealRangeInCenter

revealRangeInCenterIfOutsideViewport

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

revealRangeNearTop

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

    Parameters

    Returns void

revealRangeNearTopIfOutsideViewport

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

    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

setScrollLeft

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

    Parameters

    • newScrollLeft: number
    • Optional scrollType: ScrollType

    Returns void

setScrollPosition

setScrollTop

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

    Parameters

    • newScrollTop: number
    • Optional scrollType: ScrollType

    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: readonly ISelection[]): void
  • Set the selections for all the cursors of the editor. Cursors will be removed or added, as necessary.

    Parameters

    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 | null | undefined, handlerId: string, payload: any): void
  • Directly trigger a handler or an editor action.

    Parameters

    • source: string | null | undefined

      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

Generated using TypeDoc