Interface IStandaloneDiffEditor

A rich diff editor.

interface IStandaloneDiffEditor {
    onDidChangeModel: IEvent<void>;
    onDidUpdateDiff: IEvent<void>;
    accessibleDiffViewerNext(): void;
    accessibleDiffViewerPrev(): void;
    addAction(descriptor): IDisposable;
    addCommand(keybinding, handler, context?): string;
    createContextKey<T>(key, defaultValue): IContextKey<T>;
    createDecorationsCollection(decorations?): IEditorDecorationsCollection;
    createViewModel(model): IDiffEditorViewModel;
    dispose(): void;
    focus(): void;
    getContainerDomNode(): HTMLElement;
    getEditorType(): string;
    getId(): string;
    getLineChanges(): ILineChange[];
    getModel(): IDiffEditorModel;
    getModifiedEditor(): IStandaloneCodeEditor;
    getOriginalEditor(): IStandaloneCodeEditor;
    getPosition(): Position;
    getSelection(): Selection;
    getSelections(): Selection[];
    getSupportedActions(): IEditorAction[];
    getVisibleColumnFromPosition(position): number;
    goToDiff(target): void;
    handleInitialized(): void;
    hasTextFocus(): boolean;
    layout(dimension?, postponeRendering?): void;
    onDidDispose(listener): IDisposable;
    restoreViewState(state): void;
    revealFirstDiff(): unknown;
    revealLine(lineNumber, scrollType?): void;
    revealLineInCenter(lineNumber, scrollType?): void;
    revealLineInCenterIfOutsideViewport(lineNumber, scrollType?): void;
    revealLineNearTop(lineNumber, scrollType?): void;
    revealLines(startLineNumber, endLineNumber, scrollType?): void;
    revealLinesInCenter(lineNumber, endLineNumber, scrollType?): void;
    revealLinesInCenterIfOutsideViewport(lineNumber, endLineNumber, scrollType?): void;
    revealLinesNearTop(lineNumber, endLineNumber, scrollType?): void;
    revealPosition(position, scrollType?): void;
    revealPositionInCenter(position, scrollType?): void;
    revealPositionInCenterIfOutsideViewport(position, scrollType?): void;
    revealPositionNearTop(position, scrollType?): void;
    revealRange(range, scrollType?): void;
    revealRangeAtTop(range, scrollType?): void;
    revealRangeInCenter(range, scrollType?): void;
    revealRangeInCenterIfOutsideViewport(range, scrollType?): void;
    revealRangeNearTop(range, scrollType?): void;
    revealRangeNearTopIfOutsideViewport(range, scrollType?): void;
    saveViewState(): IDiffEditorViewState;
    setModel(model): void;
    setPosition(position, source?): void;
    setSelection(selection, source?): void;
    setSelection(selection, source?): void;
    setSelection(selection, source?): void;
    setSelection(selection, source?): void;
    setSelections(selections, source?): void;
    trigger(source, handlerId, payload): void;
    updateOptions(newOptions): void;
}

Hierarchy (view full)

Methods

  • Parameters

    Returns string

  • Dispose the editor.

    Returns void

  • Brings browser focus to the editor text

    Returns void

  • 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

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

    Parameters

    Returns number

  • Jumps to the next or previous diff.

    Parameters

    • target: "next" | "previous"

    Returns void

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

    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.

    By default, this will also render the editor immediately. If you prefer to delay rendering to the next animation frame, use postponeRendering == true.

    Parameters

    • Optional dimension: IDimension
    • Optional postponeRendering: boolean

    Returns void

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

    Parameters

    Returns void

  • Scrolls to the first diff. (Waits until the diff computation finished.)

    Returns unknown

  • Scroll vertically as necessary and reveal a line.

    Parameters

    Returns void

  • Scroll vertically as necessary and reveal a line centered vertically.

    Parameters

    Returns void

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

    Parameters

    Returns void

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

    Parameters

    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

    Returns void

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

    Parameters

    Returns void

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

    Parameters

    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

    Returns void

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

    Parameters

    Returns void

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

    Parameters

    Returns void

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

    Parameters

    Returns void

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

    Parameters

    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

    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

    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.

    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

  • 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

  • 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

    Returns void

Events

onDidChangeModel: IEvent<void>

An event emitted when the diff model is changed (i.e. the diff editor shows new content).

onDidUpdateDiff: IEvent<void>

An event emitted when the diff information computed by this diff editor has been updated.

  • An event emitted when the editor has been disposed.

    Parameters

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

    Returns IDisposable