x4js - v2.2.49
    Preparing search index...

    A rich code editor.

    interface ICodeEditor {
        inComposition: boolean;
        onBeginUpdate: IEvent<void>;
        onContextMenu: IEvent<IEditorMouseEvent>;
        onDidAttemptReadOnlyEdit: IEvent<void>;
        onDidBlurEditorText: IEvent<void>;
        onDidBlurEditorWidget: IEvent<void>;
        onDidChangeConfiguration: IEvent<ConfigurationChangedEvent>;
        onDidChangeCursorPosition: IEvent<ICursorPositionChangedEvent>;
        onDidChangeCursorSelection: IEvent<ICursorSelectionChangedEvent>;
        onDidChangeHiddenAreas: IEvent<void>;
        onDidChangeModel: IEvent<IModelChangedEvent>;
        onDidChangeModelContent: IEvent<IModelContentChangedEvent>;
        onDidChangeModelDecorations: IEvent<IModelDecorationsChangedEvent>;
        onDidChangeModelLanguage: IEvent<IModelLanguageChangedEvent>;
        onDidChangeModelLanguageConfiguration: IEvent<
            IModelLanguageConfigurationChangedEvent,
        >;
        onDidChangeModelOptions: IEvent<IModelOptionsChangedEvent>;
        onDidCompositionEnd: IEvent<void>;
        onDidCompositionStart: IEvent<void>;
        onDidContentSizeChange: IEvent<IContentSizeChangedEvent>;
        onDidFocusEditorText: IEvent<void>;
        onDidFocusEditorWidget: IEvent<void>;
        onDidLayoutChange: IEvent<EditorLayoutInfo>;
        onDidPaste: IEvent<IPasteEvent>;
        onDidScrollChange: IEvent<IScrollEvent>;
        onEndUpdate: IEvent<void>;
        onKeyDown: IEvent<IKeyboardEvent>;
        onKeyUp: IEvent<IKeyboardEvent>;
        onMouseDown: IEvent<IEditorMouseEvent>;
        onMouseLeave: IEvent<IPartialEditorMouseEvent>;
        onMouseMove: IEvent<IEditorMouseEvent>;
        onMouseUp: IEvent<IEditorMouseEvent>;
        onWillChangeModel: IEvent<IModelChangedEvent>;
        addContentWidget(widget: IContentWidget): void;
        addGlyphMarginWidget(widget: IGlyphMarginWidget): void;
        addOverlayWidget(widget: IOverlayWidget): void;
        applyFontInfo(target: HTMLElement): void;
        changeViewZones(
            callback: (accessor: IViewZoneChangeAccessor) => void,
        ): void;
        createDecorationsCollection(
            decorations?: IModelDeltaDecoration[],
        ): IEditorDecorationsCollection;
        deltaDecorations(
            oldDecorations: string[],
            newDecorations: IModelDeltaDecoration[],
        ): string[];
        dispose(): void;
        executeCommand(source: string, command: ICommand): void;
        executeCommands(source: string, commands: ICommand[]): void;
        executeEdits(
            source: string,
            edits: IIdentifiedSingleEditOperation[],
            endCursorState?: ICursorStateComputer | Selection[],
        ): boolean;
        focus(): void;
        getAction(id: string): IEditorAction;
        getBottomForLineNumber(lineNumber: number): number;
        getContainerDomNode(): HTMLElement;
        getContentHeight(): number;
        getContentWidth(): number;
        getContribution<T extends IEditorContribution>(id: string): T;
        getDecorationsInRange(range: Range): IModelDecoration[];
        getDomNode(): HTMLElement;
        getEditorType(): string;
        getFontSizeAtPosition(position: IPosition): string;
        getId(): string;
        getLayoutInfo(): EditorLayoutInfo;
        getLineDecorations(lineNumber: number): IModelDecoration[];
        getLineHeightForPosition(position: IPosition): number;
        getModel(): ITextModel;
        getOffsetForColumn(lineNumber: number, column: number): number;
        getOption<T extends EditorOption>(
            id: T,
        ): FindComputedEditorOptionValueById<T>;
        getOptions(): IComputedEditorOptions;
        getPosition(): Position;
        getRawOptions(): IEditorOptions;
        getScrolledVisiblePosition(
            position: IPosition,
        ): { height: number; left: number; top: number };
        getScrollHeight(): number;
        getScrollLeft(): number;
        getScrollTop(): number;
        getScrollWidth(): number;
        getSelection(): Selection;
        getSelections(): Selection[];
        getSupportedActions(): IEditorAction[];
        getTargetAtClientPoint(clientX: number, clientY: number): IMouseTarget;
        getTopForLineNumber(lineNumber: number, includeViewZones?: boolean): number;
        getTopForPosition(lineNumber: number, column: number): number;
        getValue(options?: { lineEnding: string; preserveBOM: boolean }): string;
        getVisibleColumnFromPosition(position: IPosition): number;
        getVisibleRanges(): Range[];
        handleInitialized?(): void;
        hasPendingScrollAnimation(): boolean;
        hasTextFocus(): boolean;
        hasWidgetFocus(): boolean;
        layout(dimension?: IDimension, postponeRendering?: boolean): void;
        layoutContentWidget(widget: IContentWidget): void;
        layoutGlyphMarginWidget(widget: IGlyphMarginWidget): void;
        layoutOverlayWidget(widget: IOverlayWidget): void;
        onDidDispose(listener: () => void): IDisposable;
        popUndoStop(): boolean;
        pushUndoStop(): boolean;
        removeContentWidget(widget: IContentWidget): void;
        removeDecorations(decorationIds: string[]): void;
        removeGlyphMarginWidget(widget: IGlyphMarginWidget): void;
        removeOverlayWidget(widget: IOverlayWidget): void;
        render(forceRedraw?: boolean): void;
        restoreViewState(state: ICodeEditorViewState): void;
        revealLine(lineNumber: number, scrollType?: ScrollType): void;
        revealLineInCenter(lineNumber: number, scrollType?: ScrollType): void;
        revealLineInCenterIfOutsideViewport(
            lineNumber: number,
            scrollType?: ScrollType,
        ): void;
        revealLineNearTop(lineNumber: number, scrollType?: ScrollType): void;
        revealLines(
            startLineNumber: number,
            endLineNumber: number,
            scrollType?: ScrollType,
        ): void;
        revealLinesInCenter(
            lineNumber: number,
            endLineNumber: number,
            scrollType?: ScrollType,
        ): void;
        revealLinesInCenterIfOutsideViewport(
            lineNumber: number,
            endLineNumber: number,
            scrollType?: ScrollType,
        ): void;
        revealLinesNearTop(
            lineNumber: number,
            endLineNumber: number,
            scrollType?: ScrollType,
        ): void;
        revealPosition(position: IPosition, scrollType?: ScrollType): void;
        revealPositionInCenter(position: IPosition, scrollType?: ScrollType): void;
        revealPositionInCenterIfOutsideViewport(
            position: IPosition,
            scrollType?: ScrollType,
        ): void;
        revealPositionNearTop(position: IPosition, scrollType?: ScrollType): void;
        revealRange(range: IRange, scrollType?: ScrollType): void;
        revealRangeAtTop(range: IRange, scrollType?: ScrollType): void;
        revealRangeInCenter(range: IRange, scrollType?: ScrollType): void;
        revealRangeInCenterIfOutsideViewport(
            range: IRange,
            scrollType?: ScrollType,
        ): void;
        revealRangeNearTop(range: IRange, scrollType?: ScrollType): void;
        revealRangeNearTopIfOutsideViewport(
            range: IRange,
            scrollType?: ScrollType,
        ): void;
        saveViewState(): ICodeEditorViewState;
        setBanner(bannerDomNode: HTMLElement, height: number): void;
        setModel(model: ITextModel): void;
        setPosition(position: IPosition, source?: string): void;
        setScrollLeft(newScrollLeft: number, scrollType?: ScrollType): void;
        setScrollPosition(
            position: INewScrollPosition,
            scrollType?: ScrollType,
        ): void;
        setScrollTop(newScrollTop: number, scrollType?: ScrollType): void;
        setSelection(selection: IRange, source?: string): void;
        setSelection(selection: Range, source?: string): void;
        setSelection(selection: ISelection, source?: string): void;
        setSelection(selection: Selection, source?: string): void;
        setSelections(selections: readonly ISelection[], source?: string): void;
        setValue(newValue: string): void;
        trigger(source: string, handlerId: string, payload: unknown): void;
        updateOptions(newOptions: IEditorOptions): void;
        writeScreenReaderContent(reason: string): void;
    }

    Hierarchy (View Summary)

    Index
    addContentWidget addGlyphMarginWidget addOverlayWidget applyFontInfo changeViewZones createDecorationsCollection deltaDecorations dispose executeCommand executeCommands executeEdits focus getAction getBottomForLineNumber getContainerDomNode getContentHeight getContentWidth getContribution getDecorationsInRange getDomNode getEditorType getFontSizeAtPosition getId getLayoutInfo getLineDecorations getLineHeightForPosition getModel getOffsetForColumn getOption getOptions getPosition getRawOptions getScrolledVisiblePosition getScrollHeight getScrollLeft getScrollTop getScrollWidth getSelection getSelections getSupportedActions getTargetAtClientPoint getTopForLineNumber getTopForPosition getValue getVisibleColumnFromPosition getVisibleRanges handleInitialized? hasPendingScrollAnimation hasTextFocus hasWidgetFocus layout layoutContentWidget layoutGlyphMarginWidget layoutOverlayWidget popUndoStop pushUndoStop removeContentWidget removeDecorations removeGlyphMarginWidget removeOverlayWidget render restoreViewState revealLine revealLineInCenter revealLineInCenterIfOutsideViewport revealLineNearTop revealLines revealLinesInCenter revealLinesInCenterIfOutsideViewport revealLinesNearTop revealPosition revealPositionInCenter revealPositionInCenterIfOutsideViewport revealPositionNearTop revealRange revealRangeAtTop revealRangeInCenter revealRangeInCenterIfOutsideViewport revealRangeNearTop revealRangeNearTopIfOutsideViewport saveViewState setBanner setModel setPosition setScrollLeft setScrollPosition setScrollTop setSelection setSelections setValue trigger updateOptions writeScreenReaderContent
    inComposition: boolean

    Boolean indicating whether input is in composition

    onBeginUpdate: IEvent<void>

    Some editor operations fire multiple events at once. To allow users to react to multiple events fired by a single operation, the editor fires a begin update before the operation and an end update after the operation. Whenever the editor fires onBeginUpdate, it will also fire onEndUpdate once the operation finishes. Note that not all operations are bracketed by onBeginUpdate and onEndUpdate.

    onDidCompositionEnd: IEvent<void>

    An event emitted after composition has ended.

    onDidCompositionStart: IEvent<void>

    An event emitted after composition has started.

    onEndUpdate: IEvent<void>

    Fires after the editor completes the operation it fired onBeginUpdate for.

    • 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

    • Get the vertical position (top offset) for the line's bottom w.r.t. to the first line.

      Parameters

      • lineNumber: number

      Returns number

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

      Returns number

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

      Returns 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

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

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

    • Get the vertical position (top offset) for the line's top w.r.t. to the first line.

      Parameters

      • lineNumber: number
      • OptionalincludeViewZones: boolean

      Returns number

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

      Parameters

      • lineNumber: number
      • column: number

      Returns number

    • Is called when the model has been set, view state was restored and options are updated. This is the best place to compute data for the viewport (such as tokens).

      Returns void

    • 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

      • Optionaldimension: IDimension
      • OptionalpostponeRendering: boolean

      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.

      Parameters

      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: unknown

        Extra data to be sent to the handler.

      Returns void

    onContextMenu: IEvent<IEditorMouseEvent>

    An event emitted on a "contextmenu".

    onDidAttemptReadOnlyEdit: IEvent<void>

    An event emitted when editing failed because the editor is read-only.

    onDidBlurEditorText: IEvent<void>

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

    onDidBlurEditorWidget: IEvent<void>

    An event emitted when the text inside this editor or an editor widget lost focus.

    onDidChangeConfiguration: IEvent<ConfigurationChangedEvent>

    An event emitted when the configuration of the editor has changed. (e.g. editor.updateOptions())

    onDidChangeCursorPosition: IEvent<ICursorPositionChangedEvent>

    An event emitted when the cursor position has changed.

    onDidChangeCursorSelection: IEvent<ICursorSelectionChangedEvent>

    An event emitted when the cursor selection has changed.

    onDidChangeHiddenAreas: IEvent<void>

    An event emitted when hidden areas change in the editor (e.g. due to folding).

    onDidChangeModel: IEvent<IModelChangedEvent>

    An event emitted when the model of this editor has changed (e.g. editor.setModel()).

    onDidChangeModelContent: IEvent<IModelContentChangedEvent>

    An event emitted when the content of the current model has changed.

    onDidChangeModelDecorations: IEvent<IModelDecorationsChangedEvent>

    An event emitted when the decorations of the current model have changed.

    onDidChangeModelLanguage: IEvent<IModelLanguageChangedEvent>

    An event emitted when the language of the current model has changed.

    onDidChangeModelLanguageConfiguration: IEvent<
        IModelLanguageConfigurationChangedEvent,
    >

    An event emitted when the language configuration of the current model has changed.

    onDidChangeModelOptions: IEvent<IModelOptionsChangedEvent>

    An event emitted when the options of the current model has changed.

    onDidContentSizeChange: IEvent<IContentSizeChangedEvent>

    An event emitted when the content width or content height in the editor has changed.

    onDidFocusEditorText: IEvent<void>

    An event emitted when the text inside this editor gained focus (i.e. cursor starts blinking).

    onDidFocusEditorWidget: IEvent<void>

    An event emitted when the text inside this editor or an editor widget gained focus.

    onDidLayoutChange: IEvent<EditorLayoutInfo>

    An event emitted when the layout of the editor has changed.

    onDidPaste: IEvent<IPasteEvent>

    An event emitted when users paste text in the editor.

    onDidScrollChange: IEvent<IScrollEvent>

    An event emitted when the scroll in the editor has changed.

    An event emitted on a "keydown".

    An event emitted on a "keyup".

    An event emitted on a "mousedown".

    An event emitted on a "mouseleave".

    An event emitted on a "mousemove".

    An event emitted on a "mouseup".

    onWillChangeModel: IEvent<IModelChangedEvent>

    An event emitted when the model of this editor is about to change (e.g. from editor.setModel()).