Namespace editor

Type Aliases§

§

type BuiltinTheme = "vs" | "vs-dark" | "hc-black" | "hc-light"

§

type ComputedEditorOptionValue<T> = T extends IEditorOption<any, infer R> ? R : never

§

type ContextKeyValue =
    | null
    | undefined
    | boolean
    | number
    | string
    | (null | undefined | boolean | number | string)[]
    | Record<
        string,
        null
        | undefined
        | boolean
        | number
        | string,
    >

§

type EditorAutoClosingEditStrategy = "always" | "auto" | "never"

Configuration options for typing over closing quotes or brackets

§

type EditorAutoClosingStrategy = "always" | "languageDefined" | "beforeWhitespace" | "never"

Configuration options for auto closing quotes and brackets

§

type EditorAutoSurroundStrategy = "languageDefined" | "quotes" | "brackets" | "never"

Configuration options for auto wrapping quotes and brackets

§

type EditorOptionsType = typeof EditorOptions

§

type FindComputedEditorOptionValueById<T> = NonNullable<
    ComputedEditorOptionValue<
        EditorOptionsType[FindEditorOptionsKeyById<T>],
    >,
>

§

type FindEditorOptionsKeyById<T> = {
    [K in keyof EditorOptionsType]: EditorOptionsType[K]["id"] extends T
        ? K
        : never
}[keyof EditorOptionsType]

§

type GoToLocationValues = "peek" | "gotoAndPeek" | "goto"

§

type IColors = { ... }

§

type IEditorModel = ITextModel | IDiffEditorModel | IDiffEditorViewModel

§

type IEditorViewState = ICodeEditorViewState | IDiffEditorViewState

An editor view state.

§

type IModel = ITextModel

§

type IMouseTarget =
    | IMouseTargetUnknown
    | IMouseTargetTextarea
    | IMouseTargetMargin
    | IMouseTargetViewZone
    | IMouseTargetContentText
    | IMouseTargetContentEmpty
    | IMouseTargetContentWidget
    | IMouseTargetOverlayWidget
    | IMouseTargetScrollbar
    | IMouseTargetOverviewRuler
    | IMouseTargetOutsideEditor

Target hit with the mouse in the editor.

§

type InUntrustedWorkspace = "inUntrustedWorkspace"

§

type IReadOnlyModel = ITextModel

§

type LineNumbersType =
    | "on"
    | "off"
    | "relative"
    | "interval"
    | ((lineNumber: number) => string)

§

type MouseMiddleClickAction = "default" | "openLink" | "ctrlLeftClick"

§

type QuickSuggestionsValue = "on" | "inline" | "off"

§

type RequiredRecursive<T> = {
    [P in keyof T]-?: T[P] extends object
    | undefined
        ? RequiredRecursive<T[P]>
        : T[P]
}

Variables§

§

const EditorOptions: { ... }

§

const EditorType: { ... }

The type of the IEditor.

§

const EditorZoom: IEditorZoom

Functions§

§

addCommand(descriptor: ICommandDescriptor): IDisposable

Add a command.

§

addEditorAction(descriptor: IActionDescriptor): IDisposable

Add an action to all editors.

§

addKeybindingRule(rule: IKeybindingRule): IDisposable

Add a keybinding rule.

§

addKeybindingRules(rules: IKeybindingRule[]): IDisposable

Add keybinding rules.

§

colorize(
    text: string,
    languageId: string,
    options: IColorizerOptions,
): Promise<string>

Colorize text using language languageId.

§

colorizeElement(
    domNode: HTMLElement,
    options: IColorizerElementOptions,
): Promise<void>

Colorize the contents of domNode using attribute data-lang.

§

colorizeModelLine(
    model: ITextModel,
    lineNumber: number,
    tabSize?: number,
): string

Colorize a line in a model.

§

create(
    domElement: HTMLElement,
    options?: IStandaloneEditorConstructionOptions,
    override?: IEditorOverrideServices,
): IStandaloneCodeEditor

Create a new editor under domElement. domElement should be empty (not contain other dom nodes). The editor will read the size of domElement.

§

createDiffEditor(
    domElement: HTMLElement,
    options?: IStandaloneDiffEditorConstructionOptions,
    override?: IEditorOverrideServices,
): IStandaloneDiffEditor

Create a new diff editor under domElement. domElement should be empty (not contain other dom nodes). The editor will read the size of domElement.

§

createModel(
    value: string,
    language?: string,
    uri?: Uri,
): ITextModel

Create a new editor model. You can specify the language that should be set for this model or let the language be inferred from the uri.

§

createMultiFileDiffEditor(
    domElement: HTMLElement,
    override?: IEditorOverrideServices,
): any

§

createWebWorker<T extends object>(
    opts: IInternalWebWorkerOptions,
): MonacoWebWorker<T>

Create a new web worker that has model syncing capabilities built in. Specify an AMD module to load that will create an object that will be proxied.

§

defineTheme(
    themeName: string,
    themeData: IStandaloneThemeData,
): void

Define a new theme or update an existing theme.

§

getDiffEditors(): readonly IDiffEditor[]

Get all the created diff editors.

§

getEditors(): readonly ICodeEditor[]

Get all the created editors.

§

getModel(uri: Uri): ITextModel

Get the model that has uri if it exists.

§

getModelMarkers(
    filter: {
        owner?: string;
        resource?: Uri;
        take?: number;
    },
): IMarker[]

Get markers for owner and/or resource

§

getModels(): ITextModel[]

Get all the created models.

§

registerCommand(
    id: string,
    handler: (accessor: any, ...args: any[]) => void,
): IDisposable

Register a command.

§

registerEditorOpener(opener: ICodeEditorOpener): IDisposable

Registers a handler that is called when a resource other than the current model should be opened in the editor (e.g. "go to definition"). The handler callback should return true if the request was handled and false otherwise.

Returns a disposable that can unregister the opener again.

If no handler is registered the default behavior is to do nothing for models other than the currently attached one.

§

registerLinkOpener(opener: ILinkOpener): IDisposable

Registers a handler that is called when a link is opened in any editor. The handler callback should return true if the link was handled and false otherwise. The handler that was registered last will be called first when a link is opened.

Returns a disposable that can unregister the opener again.

§

remeasureFonts(): void

Clears all cached font measurements and triggers re-measurement.

§

removeAllMarkers(owner: string): void

Remove all markers of an owner.

§

setModelLanguage(
    model: ITextModel,
    mimeTypeOrLanguageId: string,
): void

Change the language for a model.

§

setModelMarkers(
    model: ITextModel,
    owner: string,
    markers: IMarkerData[],
): void

Set the markers for a model.

§

setTheme(themeName: string): void

Switches to a theme.

§

tokenize(text: string, languageId: string): Token[][]

Tokenize text using language languageId

Events§

§

onDidChangeMarkers(
    listener: (e: readonly Uri[]) => void,
): IDisposable

Emitted when markers change for a model.

§

onDidChangeModelLanguage(
    listener: (
        e: { model: ITextModel; oldLanguage: string },
    ) => void,
): IDisposable

Emitted when a different language is set to a model.

§

onDidCreateDiffEditor(
    listener: (diffEditor: IDiffEditor) => void,
): IDisposable

Emitted when an diff editor is created.

§

onDidCreateEditor(
    listener: (codeEditor: ICodeEditor) => void,
): IDisposable

Emitted when an editor is created. Creating a diff editor might cause this listener to be invoked with the two editors.

§

onDidCreateModel(
    listener: (model: ITextModel) => void,
): IDisposable

Emitted when a model is created.

§

onWillDisposeModel(
    listener: (model: ITextModel) => void,
): IDisposable

Emitted right before a model is disposed.

Enumerations§

AccessibilitySupport
ContentWidgetPositionPreference

A positioning preference for rendering content widgets.

CursorChangeReason

Describes the reason the cursor has changed its position.

DefaultEndOfLine

The default end of line to use when instantiating models.

EditorAutoIndentStrategy

Configuration options for auto indentation in the editor

EditorOption
EndOfLinePreference

End of line character preference.

EndOfLineSequence

End of line character preference.

GlyphMarginLane

Vertical Lane in the glyph margin of the editor.

InjectedTextCursorStops
MinimapPosition

Position in the minimap to render the decoration.

MinimapSectionHeaderStyle

Section header style.

MouseTargetType

Type of hit element with the mouse in the editor.

OverlayWidgetPositionPreference

A positioning preference for rendering overlay widgets.

OverviewRulerLane

Vertical Lane in the overview ruler of the editor.

PositionAffinity
RenderLineNumbersType
RenderMinimap
ScrollbarVisibility
ScrollType
ShowLightbulbIconMode
TextDirection

Text Direction for a decoration.

TextEditorCursorBlinkingStyle

The kind of animation in which the editor's cursor should be rendered.

TextEditorCursorStyle

The style in which the editor's cursor should be rendered.

TrackedRangeStickiness

Describes the behavior of decorations when typing/editing near their edges. Note: Please do not edit the values, as they very carefully match DecorationRangeBehavior

WrappingIndent

Describes how to indent wrapped lines.

Classes§

ApplyUpdateResult
BareFontInfo
ConfigurationChangedEvent

An event describing that the configuration of the editor has changed.

FindMatch
FontInfo
TextModelResolvedOptions

Interfaces§

BracketPairColorizationOptions
EditorLayoutInfo

The internal layout details of the editor.

EditorMinimapLayoutInfo

The internal layout details of the editor.

EditorWrappingInfo
IActionDescriptor

Description of an action contribution

IBaseMouseTarget
IBracketPairColorizationOptions
IChange

A change

ICharChange

A character level change.

ICodeEditor

A rich code editor.

ICodeEditorOpener

Represents an object that can handle editor open operations (e.g. when "go to definition" is called with a resource other than the current model).

ICodeEditorViewState

A (serializable) state of the code editor.

IColorizerElementOptions
IColorizerOptions
ICommand

A command that modifies text / cursor state on a model.

ICommandDescriptor

Description of a command contribution

ICommandHandler
ICommandMetadata
IComputedEditorOptions

All computed editor options.

IContentSizeChangedEvent
IContentWidget

A content widget renders inline with the text and can be easily placed 'near' an editor position.

IContentWidgetPosition

A position for rendering content widgets.

IContentWidgetRenderedCoordinate

Coordinatees passed in IContentWidget.afterRender

IContextKey
ICursorPositionChangedEvent

An event describing that the cursor position has changed.

ICursorSelectionChangedEvent

An event describing that the cursor selection has changed.

ICursorState

A (serializable) state of the cursors.

ICursorStateComputer

A callback that can compute the cursor state after applying a series of edit operations.

ICursorStateComputerData

A helper for computing cursor state after a command.

IDecorationOptions
IDiffEditor

A rich diff editor.

IDiffEditorBaseOptions
IDiffEditorConstructionOptions

Configuration options for the diff editor.

IDiffEditorModel

A model for the diff editor.

IDiffEditorOptions

Configuration options for the diff editor.

IDiffEditorViewModel
IDiffEditorViewState

(Serializable) View state for the diff editor.

IDimension
IDropIntoEditorOptions

Configuration options for editor drop into behavior

IEditOperationBuilder

A builder and helper for edit operations for a command.

IEditor

An editor.

IEditorAction
IEditorCommentsOptions

Configuration options for editor comments

IEditorConstructionOptions

Configuration options for the editor.

IEditorContribution

An editor contribution that gets created every time a new editor gets created and gets disposed when the editor gets disposed.

IEditorDecorationsCollection

A collection of decorations

IEditorFindOptions

Configuration options for editor find widget

IEditorHoverOptions

Configuration options for editor hover

IEditorInlayHintsOptions

Configuration options for editor inlayHints

IEditorLightbulbOptions

Configuration options for editor lightbulb

IEditorMinimapOptions

Configuration options for editor minimap

IEditorMouseEvent

A mouse event originating from the editor.

IEditorOption
IEditorOptions

Configuration options for the editor.

IEditorOverrideServices
IEditorPaddingOptions

Configuration options for editor padding

IEditorParameterHintOptions

Configuration options for parameter hints

IEditorScrollbarOptions

Configuration options for editor scrollbars

IEditorStickyScrollOptions
IEditorZoom
IGlobalEditorOptions

Options which apply for all editors.

IGlyphMarginLanesModel
IGlyphMarginWidget

A glyph margin widget renders in the editor glyph margin.

IGlyphMarginWidgetPosition

A position for rendering glyph margin widgets.

IGotoLocationOptions

Configuration options for go to location

IGuidesOptions
IIdentifiedSingleEditOperation

A single edit operation, that has an identifier.

IInlineSuggestOptions
IInternalWebWorkerOptions
IKeybindingRule

A keybinding rule.

ILineChange

A line change

ILinkOpener
ILocalizedString
IMarker
IMarkerData

A structure defining a problem/warning/etc.

IModelChangedEvent

An event describing that an editor has had its model reset (i.e. editor.setModel()).

IModelContentChange
IModelContentChangedEvent

An event describing a change in the text of a model.

IModelDecoration

A decoration in the model.

IModelDecorationGlyphMarginOptions
IModelDecorationMinimapOptions

Options for rendering a model decoration in the minimap.

IModelDecorationOptions

Options for a model decoration.

IModelDecorationOverviewRulerOptions

Options for rendering a model decoration in the overview ruler.

IModelDecorationsChangedEvent

An event describing that model decorations have changed.

IModelDeltaDecoration

New model decorations.

IModelLanguageChangedEvent

An event describing that the current language associated with a model has changed.

IModelLanguageConfigurationChangedEvent

An event describing that the language configuration associated with a model has changed.

IModelOptionsChangedEvent
IMouseTargetContentEmpty
IMouseTargetContentEmptyData
IMouseTargetContentText
IMouseTargetContentTextData
IMouseTargetContentWidget
IMouseTargetMargin
IMouseTargetMarginData
IMouseTargetOutsideEditor
IMouseTargetOverlayWidget
IMouseTargetOverviewRuler
IMouseTargetScrollbar
IMouseTargetTextarea
IMouseTargetUnknown
IMouseTargetViewZone
IMouseTargetViewZoneData
INewScrollPosition
InjectedTextOptions

Configures text that is injected into the view without changing the underlying document.

InternalEditorRenderLineNumbersOptions
InternalEditorScrollbarOptions
InternalQuickSuggestionsOptions
IOverlayWidget

An overlay widgets renders on top of the text.

IOverlayWidgetPosition

A position for rendering overlay widgets.

IOverlayWidgetPositionCoordinates

Represents editor-relative coordinates of an overlay widget.

IPartialEditorMouseEvent
IPasteAsOptions

Configuration options for editor pasting as into behavior

IPasteEvent

A paste event originating from the editor.

IQuickSuggestionsOptions

Configuration options for quick suggestions

IRelatedInformation
IRulerOption
ISerializedModelContentChangedEvent
ISingleEditOperation

A single edit operation, that acts as a simple replace. i.e. Replace text at range with text in model.

ISmartSelectOptions
IStandaloneCodeEditor

A rich code editor.

IStandaloneDiffEditor

A rich diff editor.

IStandaloneDiffEditorConstructionOptions

The options to create a diff editor.

IStandaloneEditorConstructionOptions

The options to create an editor.

IStandaloneThemeData
ISuggestOptions

Configuration options for editor suggest widget

ITextModel

A model.

ITextModelUpdateOptions
ITextSnapshot

Text snapshot that works like an iterator. Will try to return chunks of roughly ~64KB size. Will return null when finished.

ITokenThemeRule
IUnicodeHighlightOptions

Configuration options for unicode highlighting.

IValidEditOperation
IViewState

A (serializable) state of the view.

IViewZone

A view zone is a full horizontal rectangle that 'pushes' text down. The editor reserves space for view zones when rendering.

IViewZoneChangeAccessor

An accessor that allows for zones to be added or removed.

IWordAtPosition

Word inside a model.

MonacoWebWorker

A web worker that can provide a proxy to an arbitrary file.

OverviewRulerPosition

A description for the overview ruler position.

ThemeColor
ThemeIcon