diff --git a/Antedit/README.md b/Antedit/README.md index 7ad05c5..327f1ad 100644 --- a/Antedit/README.md +++ b/Antedit/README.md @@ -4,8 +4,8 @@ the editor that powers VS Code. The editor functionality can be extended by its extension mechanism. Extension can be developed/released/isntalled by the editor itself. - ### Change logs +- 0.2.3-b: Allow reload current file via context menu in case of external changes - 0.2.2-b: Support horizotal scrolling on horizotal tabbars - 0.2.1-b: Add open file to right, editor actions are only attached to code editor - 0.2.0-b: Support diff mode in editor + fix new Monaco version compatible bug diff --git a/Antedit/build/release/Antedit.zip b/Antedit/build/release/Antedit.zip index f3bef56..2e6da16 100644 Binary files a/Antedit/build/release/Antedit.zip and b/Antedit/build/release/Antedit.zip differ diff --git a/Antedit/package.json b/Antedit/package.json index 4f032b8..bff9ed5 100644 --- a/Antedit/package.json +++ b/Antedit/package.json @@ -7,7 +7,7 @@ "author": "Xuan Sang LE", "email": "mrsang@iohub.dev" }, - "version": "0.2.2-b", + "version": "0.2.3-b", "category": "Development", "iconclass": "bi bi-journal-code", "mimes": [ diff --git a/Antedit/ts/BaseEditorModel.ts b/Antedit/ts/BaseEditorModel.ts index 6440a35..f09d2c8 100644 --- a/Antedit/ts/BaseEditorModel.ts +++ b/Antedit/ts/BaseEditorModel.ts @@ -159,7 +159,7 @@ namespace OS { * @type {boolean} * @memberof BaseEditorModel */ - //private editormux: boolean; + private editormux: boolean; /** @@ -176,7 +176,7 @@ namespace OS { this.tabbar = tabbar; this.editorSetup(editorarea); this.app = app; - // this.editormux = false; + this.editormux = false; this.onstatuschange = undefined; this.on("focus", () => { @@ -184,12 +184,10 @@ namespace OS { this.onstatuschange(this.getEditorStatus()); }); this.on("input", () => { - // console.log(this.editormux, this.currfile.dirty); - /*if (this.editormux) { + if (this.editormux) { this.editormux = false; - console.log("set editor mux to false"); return false; - }*/ + } if (!this.currfile.dirty) { this.currfile.dirty = true; this.currfile.text += "*"; @@ -401,6 +399,47 @@ namespace OS { return this.saveAs(); } + /** + * Reload the current openned file + * + * @return {*} {Promise} + * @memberof BaseEditorModel + */ + reload(): Promise { + return new Promise(async (ok,r) =>{ + try { + if (this.currfile.path.toString() === "Untitled") { + return ok(true); + } + if(this.currfile.dirty) + { + const ret = await this.app.openDialog("YesNoDialog", { + title: __("File modified"), + text: __("Continue without saving ?"), + }); + if(!ret) + { + return ok(true); + } + } + const d = await this.currfile.read(); + this.currfile.cache = d || ""; + this.currfile.dirty = false; + this.currfile.text = this.currfile.basename ? this.currfile.basename : this.currfile.path; + this.editormux = true; + this.setValue(this.currfile.cache); + this.tabbar.update(undefined); + } + catch(e){ + this.app.error( + __("Unable to open: {0}", this.currfile.path), + e + ); + r(e); + }; + }) + } + /** * Save the current file as another file * diff --git a/Antedit/ts/MonacoEditorModel.ts b/Antedit/ts/MonacoEditorModel.ts index 50c7a62..ade9c20 100644 --- a/Antedit/ts/MonacoEditorModel.ts +++ b/Antedit/ts/MonacoEditorModel.ts @@ -62,6 +62,10 @@ namespace OS { this.editor.setPosition(model.position); this.editor.revealLineInCenter(model.position.lineNumber); } + if(this.editor == this._code_editor) + { + this.editor.updateOptions({readOnly: false, domReadOnly: false}); + } } @@ -208,7 +212,7 @@ namespace OS { * @memberof MonacoEditorModel */ protected editorSetup(el: HTMLElement): void { - // create two editor instancs for code mode and diff mode + // create two editor instances for code mode and diff mode this.code_container = $("
") .css("width", "100%") .css("height", "100%"); @@ -220,7 +224,9 @@ namespace OS { $(el).append(this.diff_container); this._code_editor = monaco.editor.create(this.code_container[0], { value: "", - language: 'textplain' + language: 'textplain', + readOnly: false, + domReadOnly: false }); this._diff_editor = monaco.editor.createDiffEditor(this.diff_container[0],{ readOnly: true diff --git a/Antedit/ts/main.ts b/Antedit/ts/main.ts index b3b4ea2..7e36825 100644 --- a/Antedit/ts/main.ts +++ b/Antedit/ts/main.ts @@ -367,6 +367,7 @@ namespace OS { { return [ { text: "__(Close)", id: "close" }, + { text: "__(Reload)", id: "reload", shortcut: "A-R"}, { text: "__(Close All)", id: "close-all" }, { text: "__(Move to other side)", id: "mv-side" }, ]; @@ -385,6 +386,9 @@ namespace OS { case "close-all": model.closeAll(); break; + case "reload": + this.eum.active.reload(); + break; case "mv-side": if(!tab) { @@ -471,6 +475,7 @@ namespace OS { this.bindKey("ALT-F", () => this.menuAction("opendir")); this.bindKey("CTRL-S", () => this.menuAction("save")); this.bindKey("ALT-W", () => this.menuAction("saveas")); + this.bindKey("ALT-R", () => this.eum.active.reload()); const list_container = $(".list-container", this.find("editor-main-container")); list_container.each((i,el) => { diff --git a/Antedit/ts/monaco.d.ts b/Antedit/ts/monaco.d.ts index e8b6a01..3c915b7 100644 --- a/Antedit/ts/monaco.d.ts +++ b/Antedit/ts/monaco.d.ts @@ -10,6 +10,10 @@ declare let MonacoEnvironment: monaco.Environment | undefined; +interface Window { + MonacoEnvironment?: monaco.Environment | undefined; +} + declare namespace monaco { export type Thenable = PromiseLike; @@ -17,7 +21,7 @@ declare namespace monaco { export interface Environment { globalAPI?: boolean; baseUrl?: string; - getWorker?(workerId: string, label: string): Worker; + getWorker?(workerId: string, label: string): Promise | Worker; getWorkerUrl?(workerId: string, label: string): string; } @@ -93,25 +97,25 @@ declare namespace monaco { export class Uri implements UriComponents { static isUri(thing: any): thing is Uri; /** - * scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'. + * scheme is the 'http' part of 'http://www.example.com/some/path?query#fragment'. * The part before the first colon. */ readonly scheme: string; /** - * authority is the 'www.msft.com' part of 'http://www.msft.com/some/path?query#fragment'. + * authority is the 'www.example.com' part of 'http://www.example.com/some/path?query#fragment'. * The part between the first double slashes and the next slash. */ readonly authority: string; /** - * path is the '/some/path' part of 'http://www.msft.com/some/path?query#fragment'. + * path is the '/some/path' part of 'http://www.example.com/some/path?query#fragment'. */ readonly path: string; /** - * query is the 'query' part of 'http://www.msft.com/some/path?query#fragment'. + * query is the 'query' part of 'http://www.example.com/some/path?query#fragment'. */ readonly query: string; /** - * fragment is the 'fragment' part of 'http://www.msft.com/some/path?query#fragment'. + * fragment is the 'fragment' part of 'http://www.example.com/some/path?query#fragment'. */ readonly fragment: string; /** @@ -147,7 +151,7 @@ declare namespace monaco { fragment?: string | null; }): Uri; /** - * Creates a new Uri from a string, e.g. `http://www.msft.com/some/path`, + * Creates a new Uri from a string, e.g. `http://www.example.com/some/path`, * `file:///usr/home`, or `scheme:with/path`. * * @param value A string which represents an Uri (see `Uri#toString`). @@ -216,13 +220,13 @@ declare namespace monaco { query: string; fragment: string; } - /** * Virtual Key Codes, the value does not hold any inherent meaning. * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx * But these are "more general", as they should work across browsers & OS`s. */ export enum KeyCode { + DependsOnKbLayout = -1, /** * Placed first to cover the 0 value of the enum. */ @@ -247,42 +251,42 @@ declare namespace monaco { DownArrow = 18, Insert = 19, Delete = 20, - KEY_0 = 21, - KEY_1 = 22, - KEY_2 = 23, - KEY_3 = 24, - KEY_4 = 25, - KEY_5 = 26, - KEY_6 = 27, - KEY_7 = 28, - KEY_8 = 29, - KEY_9 = 30, - KEY_A = 31, - KEY_B = 32, - KEY_C = 33, - KEY_D = 34, - KEY_E = 35, - KEY_F = 36, - KEY_G = 37, - KEY_H = 38, - KEY_I = 39, - KEY_J = 40, - KEY_K = 41, - KEY_L = 42, - KEY_M = 43, - KEY_N = 44, - KEY_O = 45, - KEY_P = 46, - KEY_Q = 47, - KEY_R = 48, - KEY_S = 49, - KEY_T = 50, - KEY_U = 51, - KEY_V = 52, - KEY_W = 53, - KEY_X = 54, - KEY_Y = 55, - KEY_Z = 56, + Digit0 = 21, + Digit1 = 22, + Digit2 = 23, + Digit3 = 24, + Digit4 = 25, + Digit5 = 26, + Digit6 = 27, + Digit7 = 28, + Digit8 = 29, + Digit9 = 30, + KeyA = 31, + KeyB = 32, + KeyC = 33, + KeyD = 34, + KeyE = 35, + KeyF = 36, + KeyG = 37, + KeyH = 38, + KeyI = 39, + KeyJ = 40, + KeyK = 41, + KeyL = 42, + KeyM = 43, + KeyN = 44, + KeyO = 45, + KeyP = 46, + KeyQ = 47, + KeyR = 48, + KeyS = 49, + KeyT = 50, + KeyU = 51, + KeyV = 52, + KeyW = 53, + KeyX = 54, + KeyY = 55, + KeyZ = 56, Meta = 57, ContextMenu = 58, F1 = 59, @@ -310,57 +314,57 @@ declare namespace monaco { * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the ';:' key */ - US_SEMICOLON = 80, + Semicolon = 80, /** * For any country/region, the '+' key * For the US standard keyboard, the '=+' key */ - US_EQUAL = 81, + Equal = 81, /** * For any country/region, the ',' key * For the US standard keyboard, the ',<' key */ - US_COMMA = 82, + Comma = 82, /** * For any country/region, the '-' key * For the US standard keyboard, the '-_' key */ - US_MINUS = 83, + Minus = 83, /** * For any country/region, the '.' key * For the US standard keyboard, the '.>' key */ - US_DOT = 84, + Period = 84, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the '/?' key */ - US_SLASH = 85, + Slash = 85, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the '`~' key */ - US_BACKTICK = 86, + Backquote = 86, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the '[{' key */ - US_OPEN_SQUARE_BRACKET = 87, + BracketLeft = 87, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the '\|' key */ - US_BACKSLASH = 88, + Backslash = 88, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the ']}' key */ - US_CLOSE_SQUARE_BRACKET = 89, + BracketRight = 89, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the ''"' key */ - US_QUOTE = 90, + Quote = 90, /** * Used for miscellaneous characters; it can vary by keyboard. */ @@ -368,34 +372,52 @@ declare namespace monaco { /** * Either the angle bracket key or the backslash key on the RT 102-key keyboard. */ - OEM_102 = 92, - NUMPAD_0 = 93, - NUMPAD_1 = 94, - NUMPAD_2 = 95, - NUMPAD_3 = 96, - NUMPAD_4 = 97, - NUMPAD_5 = 98, - NUMPAD_6 = 99, - NUMPAD_7 = 100, - NUMPAD_8 = 101, - NUMPAD_9 = 102, - NUMPAD_MULTIPLY = 103, - NUMPAD_ADD = 104, + IntlBackslash = 92, + Numpad0 = 93, + Numpad1 = 94, + Numpad2 = 95, + Numpad3 = 96, + Numpad4 = 97, + Numpad5 = 98, + Numpad6 = 99, + Numpad7 = 100, + Numpad8 = 101, + Numpad9 = 102, + NumpadMultiply = 103, + NumpadAdd = 104, NUMPAD_SEPARATOR = 105, - NUMPAD_SUBTRACT = 106, - NUMPAD_DECIMAL = 107, - NUMPAD_DIVIDE = 108, + NumpadSubtract = 106, + NumpadDecimal = 107, + NumpadDivide = 108, /** * Cover all key codes when IME is processing input. */ KEY_IN_COMPOSITION = 109, ABNT_C1 = 110, ABNT_C2 = 111, + AudioVolumeMute = 112, + AudioVolumeUp = 113, + AudioVolumeDown = 114, + BrowserSearch = 115, + BrowserHome = 116, + BrowserBack = 117, + BrowserForward = 118, + MediaTrackNext = 119, + MediaTrackPrevious = 120, + MediaStop = 121, + MediaPlayPause = 122, + LaunchMediaPlayer = 123, + LaunchMail = 124, + LaunchApp2 = 125, + /** + * VK_CLEAR, 0x0C, CLEAR key + */ + Clear = 126, /** * Placed last to cover the length of the enum. * Please do not depend on this value! */ - MAX_VALUE = 112 + MAX_VALUE = 127 } export class KeyMod { static readonly CtrlCmd: number; @@ -409,6 +431,8 @@ declare namespace monaco { readonly value: string; readonly isTrusted?: boolean; readonly supportThemeIcons?: boolean; + readonly supportHtml?: boolean; + readonly baseUri?: UriComponents; uris?: { [href: string]: UriComponents; }; @@ -620,7 +644,7 @@ declare namespace monaco { */ strictContainsRange(range: IRange): boolean; /** - * Test if `otherRange` is strinctly in `range` (must start after, and end before). If the ranges are equal, will return false. + * Test if `otherRange` is strictly in `range` (must start after, and end before). If the ranges are equal, will return false. */ static strictContainsRange(range: IRange, otherRange: IRange): boolean; /** @@ -691,6 +715,7 @@ declare namespace monaco { */ static lift(range: undefined | null): null; static lift(range: IRange): Range; + static lift(range: IRange | undefined | null): Range | null; /** * Test if `obj` is an `IRange`. */ @@ -717,6 +742,7 @@ declare namespace monaco { * Test if the range spans multiple lines. */ static spansMultipleLines(range: IRange): boolean; + toJSON(): IRange; } /** @@ -788,6 +814,10 @@ declare namespace monaco { * Get the position at `positionLineNumber` and `positionColumn`. */ getPosition(): Position; + /** + * Get the position at the start of the selection. + */ + getSelectionStart(): Position; /** * Create a new selection with a different `selectionStartLineNumber` and `selectionStartColumn`. */ @@ -796,6 +826,10 @@ declare namespace monaco { * Create a `Selection` from one or two positions */ static fromPositions(start: IPosition, end?: IPosition): Selection; + /** + * Creates a `Selection` from a range, given a direction. + */ + static fromRange(range: Range, direction: SelectionDirection): Selection; /** * Create a `Selection` from an `ISelection`. */ @@ -861,12 +895,28 @@ declare namespace monaco.editor { */ export function onDidCreateEditor(listener: (codeEditor: ICodeEditor) => void): IDisposable; + /** + * Emitted when an diff editor is created. + * @event + */ + export function onDidCreateDiffEditor(listener: (diffEditor: IDiffEditor) => void): IDisposable; + + /** + * Get all the created editors. + */ + export function getEditors(): readonly ICodeEditor[]; + + /** + * Get all the created diff editors. + */ + export function getDiffEditors(): readonly IDiffEditor[]; + /** * Create a new diff editor under `domElement`. * `domElement` should be empty (not contain other dom nodes). * The editor will read the size of `domElement`. */ - export function createDiffEditor(domElement: HTMLElement, options?: IDiffEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneDiffEditor; + export function createDiffEditor(domElement: HTMLElement, options?: IStandaloneDiffEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneDiffEditor; export interface IDiffNavigatorOptions { readonly followsCaret?: boolean; @@ -892,6 +942,11 @@ declare namespace monaco.editor { */ export function setModelMarkers(model: ITextModel, owner: string, markers: IMarkerData[]): void; + /** + * Remove all markers of an owner. + */ + export function removeAllMarkers(owner: string): void; + /** * Get markers for owner and/or resource * @@ -944,7 +999,7 @@ declare namespace monaco.editor { * 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. */ - export function createWebWorker(opts: IWebWorkerOptions): MonacoWebWorker; + export function createWebWorker(opts: IWebWorkerOptions): MonacoWebWorker; /** * Colorize the contents of `domNode` using attribute `data-lang`. @@ -986,7 +1041,7 @@ declare namespace monaco.editor { */ export function registerCommand(id: string, handler: (accessor: any, ...args: any[]) => void): IDisposable; - export type BuiltinTheme = 'vs' | 'vs-dark' | 'hc-black'; + export type BuiltinTheme = 'vs' | 'vs-dark' | 'hc-black' | 'hc-light'; export interface IStandaloneThemeData { base: BuiltinTheme; @@ -1156,7 +1211,7 @@ declare namespace monaco.editor { maxTokenizationLineLength?: number; /** * Theme to be used for rendering. - * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'. + * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light'. * You can create custom themes via `monaco.editor.defineTheme`. * To switch a theme, use `monaco.editor.setTheme`. * **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false. @@ -1179,17 +1234,17 @@ declare namespace monaco.editor { model?: ITextModel | null; /** * The initial value of the auto created model in the editor. - * To not create automatically a model, use `model: null`. + * To not automatically create a model, use `model: null`. */ value?: string; /** * The initial language of the auto created model in the editor. - * To not create automatically a model, use `model: null`. + * To not automatically create a model, use `model: null`. */ language?: string; /** * Initial theme to be used for rendering. - * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'. + * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light. * You can create custom themes via `monaco.editor.defineTheme`. * To switch a theme, use `monaco.editor.setTheme`. * **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false. @@ -1207,15 +1262,20 @@ declare namespace monaco.editor { * Defaults to "https://go.microsoft.com/fwlink/?linkid=852450" */ accessibilityHelpUrl?: string; + /** + * Container element to use for ARIA messages. + * Defaults to document.body. + */ + ariaContainerElement?: HTMLElement; } /** * The options to create a diff editor. */ - export interface IDiffEditorConstructionOptions extends IDiffEditorOptions { + export interface IStandaloneDiffEditorConstructionOptions extends IDiffEditorConstructionOptions { /** * Initial theme to be used for rendering. - * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'. + * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light. * You can create custom themes via `monaco.editor.defineTheme`. * To switch a theme, use `monaco.editor.setTheme`. * **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false. @@ -1231,13 +1291,13 @@ declare namespace monaco.editor { export interface IStandaloneCodeEditor extends ICodeEditor { updateOptions(newOptions: IEditorOptions & IGlobalEditorOptions): void; addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null; - createContextKey(key: string, defaultValue: T): IContextKey; + createContextKey(key: string, defaultValue: T): IContextKey; addAction(descriptor: IActionDescriptor): IDisposable; } export interface IStandaloneDiffEditor extends IDiffEditor { addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null; - createContextKey(key: string, defaultValue: T): IContextKey; + createContextKey(key: string, defaultValue: T): IContextKey; addAction(descriptor: IActionDescriptor): IDisposable; getOriginalEditor(): IStandaloneCodeEditor; getModifiedEditor(): IStandaloneCodeEditor; @@ -1246,12 +1306,14 @@ declare namespace monaco.editor { (...args: any[]): void; } - export interface IContextKey { + export interface IContextKey { set(value: T): void; reset(): void; get(): T | undefined; } + export type ContextKeyValue = null | undefined | boolean | number | string | Array | Record; + export interface IEditorOverrideServices { [index: string]: any; } @@ -1324,6 +1386,44 @@ declare namespace monaco.editor { id: string; } + /** + * A single edit operation, that acts as a simple replace. + * i.e. Replace text at `range` with `text` in model. + */ + export interface ISingleEditOperation { + /** + * The range to replace. This can be empty to emulate a simple insert. + */ + range: IRange; + /** + * The text to replace with. This can be null to emulate a simple delete. + */ + text: string | null; + /** + * This indicates that this operation has "insert" semantics. + * i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved. + */ + forceMoveMarkers?: boolean; + } + + /** + * Word inside a model. + */ + export interface IWordAtPosition { + /** + * The word. + */ + readonly word: string; + /** + * The column where the word starts. + */ + readonly startColumn: number; + /** + * The column where the word ends. + */ + readonly endColumn: number; + } + /** * Vertical Lane in the overview ruler of the editor. */ @@ -1388,6 +1488,7 @@ declare namespace monaco.editor { * CSS class name describing the decoration. */ className?: string | null; + blockClassName?: string | null; /** * Message to be rendered when hovering over the glyph margin decoration. */ @@ -1402,7 +1503,8 @@ declare namespace monaco.editor { isWholeLine?: boolean; /** * Specifies the stack order of a decoration. - * A decoration with greater stack order is always in front of a decoration with a lower stack order. + * A decoration with greater stack order is always in front of a decoration with + * a lower stack order when the decorations are on the same line. */ zIndex?: number; /** @@ -1447,6 +1549,49 @@ declare namespace monaco.editor { * If set, the decoration will be rendered after the text with this CSS class name. */ afterContentClassName?: string | null; + /** + * If set, text will be injected in the view after the range. + */ + after?: InjectedTextOptions | null; + /** + * If set, text will be injected in the view before the range. + */ + before?: InjectedTextOptions | null; + } + + /** + * Configures text that is injected into the view without changing the underlying document. + */ + export interface InjectedTextOptions { + /** + * Sets the text to inject. Must be a single line. + */ + readonly content: string; + /** + * If set, the decoration will be rendered inline with the text with this CSS class name. + */ + readonly inlineClassName?: string | null; + /** + * If there is an `inlineClassName` which affects letter spacing. + */ + readonly inlineClassNameAffectsLetterSpacing?: boolean; + /** + * This field allows to attach data to this injected text. + * The data can be read when injected texts at a given position are queried. + */ + readonly attachedData?: unknown; + /** + * Configures cursor stops around injected text. + * Defaults to {@link InjectedTextCursorStops.Both}. + */ + readonly cursorStops?: InjectedTextCursorStops | null; + } + + export enum InjectedTextCursorStops { + Both = 0, + Right = 1, + Left = 2, + None = 3 } /** @@ -1485,24 +1630,6 @@ declare namespace monaco.editor { readonly options: IModelDecorationOptions; } - /** - * Word inside a model. - */ - export interface IWordAtPosition { - /** - * The word. - */ - readonly word: string; - /** - * The column where the word starts. - */ - readonly startColumn: number; - /** - * The column where the word ends. - */ - readonly endColumn: number; - } - /** * End of line character preference. */ @@ -1549,43 +1676,10 @@ declare namespace monaco.editor { CRLF = 1 } - /** - * A single edit operation, that acts as a simple replace. - * i.e. Replace text at `range` with `text` in model. - */ - export interface ISingleEditOperation { - /** - * The range to replace. This can be empty to emulate a simple insert. - */ - range: IRange; - /** - * The text to replace with. This can be null to emulate a simple delete. - */ - text: string | null; - /** - * This indicates that this operation has "insert" semantics. - * i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved. - */ - forceMoveMarkers?: boolean; - } - /** * A single edit operation, that has an identifier. */ - export interface IIdentifiedSingleEditOperation { - /** - * The range to replace. This can be empty to emulate a simple insert. - */ - range: IRange; - /** - * The text to replace with. This can be null to emulate a simple delete. - */ - text: string | null; - /** - * This indicates that this operation has "insert" semantics. - * i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved. - */ - forceMoveMarkers?: boolean; + export interface IIdentifiedSingleEditOperation extends ISingleEditOperation { } export interface IValidEditOperation { @@ -1616,6 +1710,12 @@ declare namespace monaco.editor { readonly insertSpaces: boolean; readonly defaultEOL: DefaultEndOfLine; readonly trimAutoWhitespace: boolean; + readonly bracketPairColorizationOptions: BracketPairColorizationOptions; + } + + export interface BracketPairColorizationOptions { + enabled: boolean; + independentColorPoolPerBracketType: boolean; } export interface ITextModelUpdateOptions { @@ -1623,6 +1723,7 @@ declare namespace monaco.editor { indentSize?: number; insertSpaces?: boolean; trimAutoWhitespace?: boolean; + bracketColorizationOptions?: BracketPairColorizationOptions; } export class FindMatch { @@ -1747,7 +1848,7 @@ declare namespace monaco.editor { */ getLineLastNonWhitespaceColumn(lineNumber: number): number; /** - * Create a valid position, + * Create a valid position. */ validatePosition(position: IPosition): Position; /** @@ -1782,7 +1883,7 @@ declare namespace monaco.editor { */ getPositionAt(offset: number): Position; /** - * Get a range covering the entire model + * Get a range covering the entire model. */ getFullModelRange(): Range; /** @@ -1838,7 +1939,7 @@ declare namespace monaco.editor { /** * Get the language associated with this model. */ - getModeId(): string; + getLanguageId(): string; /** * Get the word under or besides `position`. * @param position The position to look for a word. @@ -1912,6 +2013,11 @@ declare namespace monaco.editor { * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors). */ getOverviewRulerDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[]; + /** + * Gets all the decorations that contain injected text. + * @param ownerId If set, it will ignore decorations belonging to other owners. + */ + getInjectedTextDecorations(ownerId?: number): IModelDecoration[]; /** * Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs). */ @@ -1971,32 +2077,94 @@ declare namespace monaco.editor { * An event emitted when decorations of the model have changed. * @event */ - onDidChangeDecorations(listener: (e: IModelDecorationsChangedEvent) => void): IDisposable; + readonly onDidChangeDecorations: IEvent; /** * An event emitted when the model options have changed. * @event */ - onDidChangeOptions(listener: (e: IModelOptionsChangedEvent) => void): IDisposable; + readonly onDidChangeOptions: IEvent; /** * An event emitted when the language associated with the model has changed. * @event */ - onDidChangeLanguage(listener: (e: IModelLanguageChangedEvent) => void): IDisposable; + readonly onDidChangeLanguage: IEvent; /** * An event emitted when the language configuration associated with the model has changed. * @event */ - onDidChangeLanguageConfiguration(listener: (e: IModelLanguageConfigurationChangedEvent) => void): IDisposable; + readonly onDidChangeLanguageConfiguration: IEvent; + /** + * An event emitted when the model has been attached to the first editor or detached from the last editor. + * @event + */ + readonly onDidChangeAttached: IEvent; /** * An event emitted right before disposing the model. * @event */ - onWillDispose(listener: () => void): IDisposable; + readonly onWillDispose: IEvent; /** - * Destroy this model. This will unbind the model from the mode - * and make all necessary clean-up to release this object to the GC. + * Destroy this model. */ dispose(): void; + /** + * Returns if this model is attached to an editor or not. + */ + isAttachedToEditor(): boolean; + } + + export enum PositionAffinity { + /** + * Prefers the left most position. + */ + Left = 0, + /** + * Prefers the right most position. + */ + Right = 1, + /** + * No preference. + */ + None = 2, + /** + * If the given position is on injected text, prefers the position left of it. + */ + LeftOfInjectedText = 3, + /** + * If the given position is on injected text, prefers the position right of it. + */ + RightOfInjectedText = 4 + } + + /** + * A change + */ + export interface IChange { + readonly originalStartLineNumber: number; + readonly originalEndLineNumber: number; + readonly modifiedStartLineNumber: number; + readonly modifiedEndLineNumber: number; + } + + /** + * A character level change. + */ + export interface ICharChange extends IChange { + readonly originalStartColumn: number; + readonly originalEndColumn: number; + readonly modifiedStartColumn: number; + readonly modifiedEndColumn: number; + } + + /** + * A line change + */ + export interface ILineChange extends IChange { + readonly charChanges: ICharChange[] | undefined; + } + export interface IDimension { + width: number; + height: number; } /** @@ -2091,38 +2259,6 @@ declare namespace monaco.editor { readonly newModelUrl: Uri | null; } - export interface IDimension { - width: number; - height: number; - } - - /** - * A change - */ - export interface IChange { - readonly originalStartLineNumber: number; - readonly originalEndLineNumber: number; - readonly modifiedStartLineNumber: number; - readonly modifiedEndLineNumber: number; - } - - /** - * A character level change. - */ - export interface ICharChange extends IChange { - readonly originalStartColumn: number; - readonly originalEndColumn: number; - readonly modifiedStartColumn: number; - readonly modifiedEndColumn: number; - } - - /** - * A line change - */ - export interface ILineChange extends IChange { - readonly charChanges: ICharChange[] | undefined; - } - export interface IContentSizeChangedEvent { readonly contentWidth: number; readonly contentHeight: number; @@ -2248,7 +2384,7 @@ declare namespace monaco.editor { /** * Restores the view state of the editor from a serializable object generated by `saveViewState`. */ - restoreViewState(state: IEditorViewState): void; + restoreViewState(state: IEditorViewState | null): void; /** * Given a position, returns a column number that takes tab-widths into account. */ @@ -2260,8 +2396,9 @@ declare namespace monaco.editor { /** * Set the primary position of the cursor. This will remove any secondary cursors. * @param position New primary cursor's position + * @param source Source of the call that caused the position */ - setPosition(position: IPosition): void; + setPosition(position: IPosition, source?: string): void; /** * Scroll vertically as necessary and reveal a line. */ @@ -2307,28 +2444,34 @@ declare namespace monaco.editor { /** * Set the primary selection of the editor. This will remove any secondary cursors. * @param selection The new selection + * @param source Source of the call that caused the selection */ - setSelection(selection: IRange): void; + setSelection(selection: IRange, source?: string): void; /** * Set the primary selection of the editor. This will remove any secondary cursors. * @param selection The new selection + * @param source Source of the call that caused the selection */ - setSelection(selection: Range): void; + setSelection(selection: Range, source?: string): void; /** * Set the primary selection of the editor. This will remove any secondary cursors. * @param selection The new selection + * @param source Source of the call that caused the selection */ - setSelection(selection: ISelection): void; + setSelection(selection: ISelection, source?: string): void; /** * Set the primary selection of the editor. This will remove any secondary cursors. * @param selection The new selection + * @param source Source of the call that caused the selection */ - setSelection(selection: Selection): void; + setSelection(selection: Selection, source?: string): void; /** * Set the selections for all the cursors of the editor. * Cursors will be removed or added, as necessary. + * @param selections The new selection + * @param source Source of the call that caused the selection */ - setSelections(selections: readonly ISelection[]): void; + setSelections(selections: readonly ISelection[], source?: string): void; /** * Scroll vertically as necessary and reveal lines. */ @@ -2392,6 +2535,47 @@ declare namespace monaco.editor { * It is safe to call setModel(null) to simply detach the current model from the editor. */ setModel(model: IEditorModel | null): void; + /** + * Create a collection of decorations. All decorations added through this collection + * will get the ownerId of the editor (meaning they will not show up in other editors). + * These decorations will be automatically cleared when the editor's model changes. + */ + createDecorationsCollection(decorations?: IModelDeltaDecoration[]): IEditorDecorationsCollection; + } + + /** + * A collection of decorations + */ + export interface IEditorDecorationsCollection { + /** + * An event emitted when decorations change in the editor, + * but the change is not caused by us setting or clearing the collection. + */ + onDidChange: IEvent; + /** + * Get the decorations count. + */ + length: number; + /** + * Get the range for a decoration. + */ + getRange(index: number): Range | null; + /** + * Get all ranges for decorations. + */ + getRanges(): Range[]; + /** + * Determine if a decoration is in this collection. + */ + has(decoration: IModelDecoration): boolean; + /** + * Replace all previous decorations with `newDecorations`. + */ + set(newDecorations: IModelDeltaDecoration[]): void; + /** + * Remove all previous decorations. + */ + clear(): void; } /** @@ -2421,7 +2605,7 @@ declare namespace monaco.editor { }; /** - * An event describing that the current mode associated with a model has changed. + * An event describing that the current language associated with a model has changed. */ export interface IModelLanguageChangedEvent { /** @@ -2614,7 +2798,7 @@ declare namespace monaco.editor { /** * Configuration options for typing over closing quotes or brackets */ - export type EditorAutoClosingOvertypeStrategy = 'always' | 'auto' | 'never'; + export type EditorAutoClosingEditStrategy = 'always' | 'auto' | 'never'; /** * Configuration options for auto indentation in the editor @@ -2661,7 +2845,7 @@ declare namespace monaco.editor { /** * Control the rendering of line numbers. * If it is a function, it will be invoked when rendering a line number and the return value will be rendered. - * Otherwise, if it is a truey, line numbers will be rendered normally (equivalent of using an identity function). + * Otherwise, if it is a truthy, line numbers will be rendered normally (equivalent of using an identity function). * Otherwise, line numbers will not be rendered. * Defaults to `on`. */ @@ -2725,10 +2909,15 @@ declare namespace monaco.editor { */ extraEditorClassName?: string; /** - * Should the editor be read only. + * Should the editor be read only. See also `domReadOnly`. * Defaults to false. */ readOnly?: boolean; + /** + * Should the textarea used for input use the DOM `readonly` attribute. + * Defaults to false. + */ + domReadOnly?: boolean; /** * Enable linked editing. * Defaults to false. @@ -2836,7 +3025,7 @@ declare namespace monaco.editor { */ smoothScrolling?: boolean; /** - * Enable that the editor will install an interval to check if its container dom node size has changed. + * Enable that the editor will install a ResizeObserver to check if its container dom node size has changed. * Enabling this might have a severe performance impact. * Defaults to false. */ @@ -2879,12 +3068,10 @@ declare namespace monaco.editor { wrappingStrategy?: 'simple' | 'advanced'; /** * Configure word wrapping characters. A break will be introduced before these characters. - * Defaults to '([{‘“〈《「『【〔([{「£¥$£¥++'. */ wordWrapBreakBeforeCharacters?: string; /** * Configure word wrapping characters. A break will be introduced after these characters. - * Defaults to ' \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」'. */ wordWrapBreakAfterCharacters?: string; /** @@ -2963,8 +3150,9 @@ declare namespace monaco.editor { * Suggest options. */ suggest?: ISuggestOptions; + inlineSuggest?: IInlineSuggestOptions; /** - * Smart select opptions; + * Smart select options. */ smartSelect?: ISmartSelectOptions; /** @@ -2999,10 +3187,14 @@ declare namespace monaco.editor { * Defaults to language defined behavior. */ autoClosingQuotes?: EditorAutoClosingStrategy; + /** + * Options for pressing backspace near quotes or bracket pairs. + */ + autoClosingDelete?: EditorAutoClosingEditStrategy; /** * Options for typing over closing quotes or brackets. */ - autoClosingOvertype?: EditorAutoClosingOvertypeStrategy; + autoClosingOvertype?: EditorAutoClosingEditStrategy; /** * Options for auto surrounding. * Defaults to always allowing auto surrounding. @@ -3124,11 +3316,21 @@ declare namespace monaco.editor { * Defaults to true. */ foldingHighlight?: boolean; + /** + * Auto fold imports folding regions. + * Defaults to true. + */ + foldingImportsByDefault?: boolean; + /** + * Maximum number of foldable regions. + * Defaults to 5000. + */ + foldingMaximumRegions?: number; /** * Controls whether the fold actions in the gutter stay always visible or hide unless the mouse is over the gutter. * Defaults to 'mouseover'. */ - showFoldingControls?: 'always' | 'mouseover'; + showFoldingControls?: 'always' | 'never' | 'mouseover'; /** * Controls whether clicking on the empty content after a folded line will unfold the line. * Defaults to false. @@ -3141,24 +3343,14 @@ declare namespace monaco.editor { matchBrackets?: 'never' | 'near' | 'always'; /** * Enable rendering of whitespace. - * Defaults to none. + * Defaults to 'selection'. */ renderWhitespace?: 'none' | 'boundary' | 'selection' | 'trailing' | 'all'; /** * Enable rendering of control characters. - * Defaults to false. + * Defaults to true. */ renderControlCharacters?: boolean; - /** - * Enable rendering of indent guides. - * Defaults to true. - */ - renderIndentGuides?: boolean; - /** - * Enable highlighting of the active indent guide. - * Defaults to true. - */ - highlightActiveIndentGuide?: boolean; /** * Enable rendering of current line highlight. * Defaults to all. @@ -3214,13 +3406,33 @@ declare namespace monaco.editor { /** * Control the behavior and rendering of the inline hints. */ - inlineHints?: IEditorInlineHintsOptions; + inlayHints?: IEditorInlayHintsOptions; + /** + * Control if the editor should use shadow DOM. + */ + useShadowDOM?: boolean; + /** + * Controls the behavior of editor guides. + */ + guides?: IGuidesOptions; + /** + * Controls the behavior of the unicode highlight feature + * (by default, ambiguous and invisible characters are highlighted). + */ + unicodeHighlight?: IUnicodeHighlightOptions; + /** + * Configures bracket pair colorization (disabled by default). + */ + bracketPairColorization?: IBracketPairColorizationOptions; + /** + * Enables dropping into the editor from an external source. + * + * This shows a preview of the drop location and triggers an `onDropIntoEditor` event. + */ + enableDropIntoEditor?: boolean; } - /** - * Configuration options for the diff editor. - */ - export interface IDiffEditorOptions extends IEditorOptions { + export interface IDiffEditorBaseOptions { /** * Allow the user to resize the diff editor split view. * Defaults to true. @@ -3236,6 +3448,11 @@ declare namespace monaco.editor { * Defaults to 5000. */ maxComputationTime?: number; + /** + * Maximum supported file size in MB. + * Defaults to 50. + */ + maxFileSize?: number; /** * Compute the diff by ignoring leading/trailing whitespace * Defaults to true. @@ -3246,6 +3463,11 @@ declare namespace monaco.editor { * Defaults to true. */ renderIndicators?: boolean; + /** + * Shows icons in the glyph margin to revert changes. + * Default to true. + */ + renderMarginRevertIcon?: boolean; /** * Original model should be editable? * Defaults to false. @@ -3256,11 +3478,6 @@ declare namespace monaco.editor { * Defaults to false. */ diffCodeLens?: boolean; - /** - * Is the diff editor inside another editor - * Defaults to false - */ - isInEmbeddedEditor?: boolean; /** * Is the diff editor should render overview ruler * Defaults to true @@ -3270,14 +3487,12 @@ declare namespace monaco.editor { * Control the wrapping of the diff editor. */ diffWordWrap?: 'off' | 'on' | 'inherit'; - /** - * Aria label for original editor. - */ - originalAriaLabel?: string; - /** - * Aria label for modifed editor. - */ - modifiedAriaLabel?: string; + } + + /** + * Configuration options for the diff editor. + */ + export interface IDiffEditorOptions extends IEditorOptions, IDiffEditorBaseOptions { } /** @@ -3294,10 +3509,20 @@ declare namespace monaco.editor { get(id: T): FindComputedEditorOptionValueById; } - export interface IEditorOption { - readonly id: K1; + export interface IEditorOption { + readonly id: K; readonly name: string; defaultValue: V; + /** + * Might modify `value`. + */ + applyUpdate(value: V | undefined, update: V): ApplyUpdateResult; + } + + export class ApplyUpdateResult { + readonly newValue: T; + readonly didChange: boolean; + constructor(newValue: T, didChange: boolean); } /** @@ -3316,8 +3541,6 @@ declare namespace monaco.editor { ignoreEmptyLines?: boolean; } - export type EditorCommentsOptions = Readonly>; - /** * The kind of animation in which the editor's cursor should be rendered. */ @@ -3389,7 +3612,7 @@ declare namespace monaco.editor { /** * Controls if we seed search string in the Find Widget with editor selection. */ - seedSearchStringFromSelection?: boolean; + seedSearchStringFromSelection?: 'never' | 'always' | 'selection'; /** * Controls if Find in Selection flag is turned on in the editor. */ @@ -3401,8 +3624,6 @@ declare namespace monaco.editor { loop?: boolean; } - export type EditorFindOptions = Readonly>; - export type GoToLocationValues = 'peek' | 'gotoAndPeek' | 'goto'; /** @@ -3422,8 +3643,6 @@ declare namespace monaco.editor { alternativeReferenceCommand?: string; } - export type GoToLocationOptions = Readonly>; - /** * Configuration options for editor hover */ @@ -3443,10 +3662,13 @@ declare namespace monaco.editor { * Defaults to true. */ sticky?: boolean; + /** + * Should the hover be shown above the line if possible? + * Defaults to false. + */ + above?: boolean; } - export type EditorHoverOptions = Readonly>; - /** * A description for the overview ruler position. */ @@ -3572,17 +3794,15 @@ declare namespace monaco.editor { enabled?: boolean; } - export type EditorLightbulbOptions = Readonly>; - /** - * Configuration options for editor inlineHints + * Configuration options for editor inlayHints */ - export interface IEditorInlineHintsOptions { + export interface IEditorInlayHintsOptions { /** * Enable the inline hints. * Defaults to true. */ - enabled?: boolean; + enabled?: 'on' | 'off' | 'offUnlessPressed' | 'onUnlessPressed'; /** * Font size of inline hints. * Default to 90% of the editor font size. @@ -3593,10 +3813,13 @@ declare namespace monaco.editor { * Defaults to editor font family. */ fontFamily?: string; + /** + * Enables the padding around the inlay hint. + * Defaults to false. + */ + padding?: boolean; } - export type EditorInlineHintsOptions = Readonly>; - /** * Configuration options for editor minimap */ @@ -3606,6 +3829,10 @@ declare namespace monaco.editor { * Defaults to true. */ enabled?: boolean; + /** + * Control the rendering of minimap. + */ + autohide?: boolean; /** * Control the side of the minimap in editor. * Defaults to 'right'. @@ -3637,8 +3864,6 @@ declare namespace monaco.editor { scale?: number; } - export type EditorMinimapOptions = Readonly>; - /** * Configuration options for editor padding */ @@ -3653,11 +3878,6 @@ declare namespace monaco.editor { bottom?: number; } - export interface InternalEditorPaddingOptions { - readonly top: number; - readonly bottom: number; - } - /** * Configuration options for parameter hints */ @@ -3674,18 +3894,22 @@ declare namespace monaco.editor { cycle?: boolean; } - export type InternalParameterHintOptions = Readonly>; + export type QuickSuggestionsValue = 'on' | 'inline' | 'off'; /** * Configuration options for quick suggestions */ export interface IQuickSuggestionsOptions { - other?: boolean; - comments?: boolean; - strings?: boolean; + other?: boolean | QuickSuggestionsValue; + comments?: boolean | QuickSuggestionsValue; + strings?: boolean | QuickSuggestionsValue; } - export type ValidQuickSuggestionsOptions = boolean | Readonly>; + export interface InternalQuickSuggestionsOptions { + readonly other: QuickSuggestionsValue; + readonly comments: QuickSuggestionsValue; + readonly strings: QuickSuggestionsValue; + } export type LineNumbersType = 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string); @@ -3714,6 +3938,7 @@ declare namespace monaco.editor { /** * The size of arrows (if displayed). * Defaults to 11. + * **NOTE**: This option cannot be updated using `updateOptions()` */ arrowSize?: number; /** @@ -3729,16 +3954,19 @@ declare namespace monaco.editor { /** * Cast horizontal and vertical shadows when the content is scrolled. * Defaults to true. + * **NOTE**: This option cannot be updated using `updateOptions()` */ useShadows?: boolean; /** * Render arrows at the top and bottom of the vertical scrollbar. * Defaults to false. + * **NOTE**: This option cannot be updated using `updateOptions()` */ verticalHasArrows?: boolean; /** * Render arrows at the left and right of the horizontal scrollbar. * Defaults to false. + * **NOTE**: This option cannot be updated using `updateOptions()` */ horizontalHasArrows?: boolean; /** @@ -3749,6 +3977,7 @@ declare namespace monaco.editor { /** * Always consume mouse wheel events (always call preventDefault() and stopPropagation() on the browser events). * Defaults to true. + * **NOTE**: This option cannot be updated using `updateOptions()` */ alwaysConsumeMouseWheel?: boolean; /** @@ -3764,11 +3993,13 @@ declare namespace monaco.editor { /** * Width in pixels for the vertical slider. * Defaults to `verticalScrollbarSize`. + * **NOTE**: This option cannot be updated using `updateOptions()` */ verticalSliderSize?: number; /** * Height in pixels for the horizontal slider. * Defaults to `horizontalScrollbarSize`. + * **NOTE**: This option cannot be updated using `updateOptions()` */ horizontalSliderSize?: number; /** @@ -3794,6 +4025,96 @@ declare namespace monaco.editor { readonly scrollByPage: boolean; } + export type InUntrustedWorkspace = 'inUntrustedWorkspace'; + + /** + * Configuration options for unicode highlighting. + */ + export interface IUnicodeHighlightOptions { + /** + * Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII. + */ + nonBasicASCII?: boolean | InUntrustedWorkspace; + /** + * Controls whether characters that just reserve space or have no width at all are highlighted. + */ + invisibleCharacters?: boolean; + /** + * Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale. + */ + ambiguousCharacters?: boolean; + /** + * Controls whether characters in comments should also be subject to unicode highlighting. + */ + includeComments?: boolean | InUntrustedWorkspace; + /** + * Controls whether characters in strings should also be subject to unicode highlighting. + */ + includeStrings?: boolean | InUntrustedWorkspace; + /** + * Defines allowed characters that are not being highlighted. + */ + allowedCharacters?: Record; + /** + * Unicode characters that are common in allowed locales are not being highlighted. + */ + allowedLocales?: Record; + } + + export interface IInlineSuggestOptions { + /** + * Enable or disable the rendering of automatic inline completions. + */ + enabled?: boolean; + /** + * Configures the mode. + * Use `prefix` to only show ghost text if the text to replace is a prefix of the suggestion text. + * Use `subword` to only show ghost text if the replace text is a subword of the suggestion text. + * Use `subwordSmart` to only show ghost text if the replace text is a subword of the suggestion text, but the subword must start after the cursor position. + * Defaults to `prefix`. + */ + mode?: 'prefix' | 'subword' | 'subwordSmart'; + } + + export interface IBracketPairColorizationOptions { + /** + * Enable or disable bracket pair colorization. + */ + enabled?: boolean; + /** + * Use independent color pool per bracket type. + */ + independentColorPoolPerBracketType?: boolean; + } + + export interface IGuidesOptions { + /** + * Enable rendering of bracket pair guides. + * Defaults to false. + */ + bracketPairs?: boolean | 'active'; + /** + * Enable rendering of vertical bracket pair guides. + * Defaults to 'active'. + */ + bracketPairsHorizontal?: boolean | 'active'; + /** + * Enable highlighting of the active bracket pair. + * Defaults to true. + */ + highlightActiveBracketPair?: boolean; + /** + * Enable rendering of indent guides. + * Defaults to true. + */ + indentation?: boolean; + /** + * Enable highlighting of the active indent guide. + * Defaults to true. + */ + highlightActiveIndentation?: boolean | 'always'; + } + /** * Configuration options for editor suggest widget */ @@ -3811,7 +4132,7 @@ declare namespace monaco.editor { */ snippetsPreventQuickSuggestions?: boolean; /** - * Favours words that appear close to the cursor. + * Favors words that appear close to the cursor. */ localityBonus?: boolean; /** @@ -3826,6 +4147,14 @@ declare namespace monaco.editor { * Enable or disable the suggest status bar. */ showStatusBar?: boolean; + /** + * Enable or disable the rendering of the suggestion preview. + */ + preview?: boolean; + /** + * Configures the mode of the preview. + */ + previewMode?: 'prefix' | 'subword' | 'subwordSmart'; /** * Show details inline with the label. Defaults to true. */ @@ -3842,6 +4171,10 @@ declare namespace monaco.editor { * Show constructor-suggestions. */ showConstructors?: boolean; + /** + * Show deprecated-suggestions. + */ + showDeprecated?: boolean; /** * Show field-suggestions. */ @@ -3940,14 +4273,10 @@ declare namespace monaco.editor { showSnippets?: boolean; } - export type InternalSuggestOptions = Readonly>; - export interface ISmartSelectOptions { selectLeadingAndTrailingWhitespace?: boolean; } - export type SmartSelectOptions = Readonly>; - /** * Describes how to indent wrapped lines. */ @@ -3984,127 +4313,136 @@ declare namespace monaco.editor { accessibilityPageSize = 3, ariaLabel = 4, autoClosingBrackets = 5, - autoClosingOvertype = 6, - autoClosingQuotes = 7, - autoIndent = 8, - automaticLayout = 9, - autoSurround = 10, - codeLens = 11, - codeLensFontFamily = 12, - codeLensFontSize = 13, - colorDecorators = 14, - columnSelection = 15, - comments = 16, - contextmenu = 17, - copyWithSyntaxHighlighting = 18, - cursorBlinking = 19, - cursorSmoothCaretAnimation = 20, - cursorStyle = 21, - cursorSurroundingLines = 22, - cursorSurroundingLinesStyle = 23, - cursorWidth = 24, - disableLayerHinting = 25, - disableMonospaceOptimizations = 26, - dragAndDrop = 27, - emptySelectionClipboard = 28, - extraEditorClassName = 29, - fastScrollSensitivity = 30, - find = 31, - fixedOverflowWidgets = 32, - folding = 33, - foldingStrategy = 34, - foldingHighlight = 35, - unfoldOnClickAfterEndOfLine = 36, - fontFamily = 37, - fontInfo = 38, - fontLigatures = 39, - fontSize = 40, - fontWeight = 41, - formatOnPaste = 42, - formatOnType = 43, - glyphMargin = 44, - gotoLocation = 45, - hideCursorInOverviewRuler = 46, - highlightActiveIndentGuide = 47, - hover = 48, - inDiffEditor = 49, - letterSpacing = 50, - lightbulb = 51, - lineDecorationsWidth = 52, - lineHeight = 53, - lineNumbers = 54, - lineNumbersMinChars = 55, - linkedEditing = 56, - links = 57, - matchBrackets = 58, - minimap = 59, - mouseStyle = 60, - mouseWheelScrollSensitivity = 61, - mouseWheelZoom = 62, - multiCursorMergeOverlapping = 63, - multiCursorModifier = 64, - multiCursorPaste = 65, - occurrencesHighlight = 66, - overviewRulerBorder = 67, - overviewRulerLanes = 68, - padding = 69, - parameterHints = 70, - peekWidgetDefaultFocus = 71, - definitionLinkOpensInPeek = 72, - quickSuggestions = 73, - quickSuggestionsDelay = 74, - readOnly = 75, - renameOnType = 76, - renderControlCharacters = 77, - renderIndentGuides = 78, - renderFinalNewline = 79, - renderLineHighlight = 80, - renderLineHighlightOnlyWhenFocus = 81, - renderValidationDecorations = 82, - renderWhitespace = 83, - revealHorizontalRightPadding = 84, - roundedSelection = 85, - rulers = 86, - scrollbar = 87, - scrollBeyondLastColumn = 88, - scrollBeyondLastLine = 89, - scrollPredominantAxis = 90, - selectionClipboard = 91, - selectionHighlight = 92, - selectOnLineNumbers = 93, - showFoldingControls = 94, - showUnused = 95, - snippetSuggestions = 96, - smartSelect = 97, - smoothScrolling = 98, - stickyTabStops = 99, - stopRenderingLineAfter = 100, - suggest = 101, - suggestFontSize = 102, - suggestLineHeight = 103, - suggestOnTriggerCharacters = 104, - suggestSelection = 105, - tabCompletion = 106, - tabIndex = 107, - unusualLineTerminators = 108, - useTabStops = 109, - wordSeparators = 110, - wordWrap = 111, - wordWrapBreakAfterCharacters = 112, - wordWrapBreakBeforeCharacters = 113, - wordWrapColumn = 114, - wordWrapOverride1 = 115, - wordWrapOverride2 = 116, - wrappingIndent = 117, - wrappingStrategy = 118, - showDeprecated = 119, - inlineHints = 120, - editorClassName = 121, - pixelRatio = 122, - tabFocusMode = 123, - layoutInfo = 124, - wrappingInfo = 125 + autoClosingDelete = 6, + autoClosingOvertype = 7, + autoClosingQuotes = 8, + autoIndent = 9, + automaticLayout = 10, + autoSurround = 11, + bracketPairColorization = 12, + guides = 13, + codeLens = 14, + codeLensFontFamily = 15, + codeLensFontSize = 16, + colorDecorators = 17, + columnSelection = 18, + comments = 19, + contextmenu = 20, + copyWithSyntaxHighlighting = 21, + cursorBlinking = 22, + cursorSmoothCaretAnimation = 23, + cursorStyle = 24, + cursorSurroundingLines = 25, + cursorSurroundingLinesStyle = 26, + cursorWidth = 27, + disableLayerHinting = 28, + disableMonospaceOptimizations = 29, + domReadOnly = 30, + dragAndDrop = 31, + enableDropIntoEditor = 32, + emptySelectionClipboard = 33, + extraEditorClassName = 34, + fastScrollSensitivity = 35, + find = 36, + fixedOverflowWidgets = 37, + folding = 38, + foldingStrategy = 39, + foldingHighlight = 40, + foldingImportsByDefault = 41, + foldingMaximumRegions = 42, + unfoldOnClickAfterEndOfLine = 43, + fontFamily = 44, + fontInfo = 45, + fontLigatures = 46, + fontSize = 47, + fontWeight = 48, + formatOnPaste = 49, + formatOnType = 50, + glyphMargin = 51, + gotoLocation = 52, + hideCursorInOverviewRuler = 53, + hover = 54, + inDiffEditor = 55, + inlineSuggest = 56, + letterSpacing = 57, + lightbulb = 58, + lineDecorationsWidth = 59, + lineHeight = 60, + lineNumbers = 61, + lineNumbersMinChars = 62, + linkedEditing = 63, + links = 64, + matchBrackets = 65, + minimap = 66, + mouseStyle = 67, + mouseWheelScrollSensitivity = 68, + mouseWheelZoom = 69, + multiCursorMergeOverlapping = 70, + multiCursorModifier = 71, + multiCursorPaste = 72, + occurrencesHighlight = 73, + overviewRulerBorder = 74, + overviewRulerLanes = 75, + padding = 76, + parameterHints = 77, + peekWidgetDefaultFocus = 78, + definitionLinkOpensInPeek = 79, + quickSuggestions = 80, + quickSuggestionsDelay = 81, + readOnly = 82, + renameOnType = 83, + renderControlCharacters = 84, + renderFinalNewline = 85, + renderLineHighlight = 86, + renderLineHighlightOnlyWhenFocus = 87, + renderValidationDecorations = 88, + renderWhitespace = 89, + revealHorizontalRightPadding = 90, + roundedSelection = 91, + rulers = 92, + scrollbar = 93, + scrollBeyondLastColumn = 94, + scrollBeyondLastLine = 95, + scrollPredominantAxis = 96, + selectionClipboard = 97, + selectionHighlight = 98, + selectOnLineNumbers = 99, + showFoldingControls = 100, + showUnused = 101, + snippetSuggestions = 102, + smartSelect = 103, + smoothScrolling = 104, + stickyTabStops = 105, + stopRenderingLineAfter = 106, + suggest = 107, + suggestFontSize = 108, + suggestLineHeight = 109, + suggestOnTriggerCharacters = 110, + suggestSelection = 111, + tabCompletion = 112, + tabIndex = 113, + unicodeHighlighting = 114, + unusualLineTerminators = 115, + useShadowDOM = 116, + useTabStops = 117, + wordSeparators = 118, + wordWrap = 119, + wordWrapBreakAfterCharacters = 120, + wordWrapBreakBeforeCharacters = 121, + wordWrapColumn = 122, + wordWrapOverride1 = 123, + wordWrapOverride2 = 124, + wrappingIndent = 125, + wrappingStrategy = 126, + showDeprecated = 127, + inlayHints = 128, + editorClassName = 129, + pixelRatio = 130, + tabFocusMode = 131, + layoutInfo = 132, + wrappingInfo = 133 } + export const EditorOptions: { acceptSuggestionOnCommitCharacter: IEditorOption; acceptSuggestionOnEnter: IEditorOption; @@ -4112,18 +4450,21 @@ declare namespace monaco.editor { accessibilityPageSize: IEditorOption; ariaLabel: IEditorOption; autoClosingBrackets: IEditorOption; + autoClosingDelete: IEditorOption; autoClosingOvertype: IEditorOption; autoClosingQuotes: IEditorOption; autoIndent: IEditorOption; automaticLayout: IEditorOption; autoSurround: IEditorOption; + bracketPairColorization: IEditorOption>>; + bracketPairGuides: IEditorOption>>; stickyTabStops: IEditorOption; codeLens: IEditorOption; codeLensFontFamily: IEditorOption; codeLensFontSize: IEditorOption; colorDecorators: IEditorOption; columnSelection: IEditorOption; - comments: IEditorOption; + comments: IEditorOption>>; contextmenu: IEditorOption; copyWithSyntaxHighlighting: IEditorOption; cursorBlinking: IEditorOption; @@ -4134,15 +4475,19 @@ declare namespace monaco.editor { cursorWidth: IEditorOption; disableLayerHinting: IEditorOption; disableMonospaceOptimizations: IEditorOption; + domReadOnly: IEditorOption; dragAndDrop: IEditorOption; emptySelectionClipboard: IEditorOption; + enableDropIntoEditor: IEditorOption; extraEditorClassName: IEditorOption; fastScrollSensitivity: IEditorOption; - find: IEditorOption; + find: IEditorOption>>; fixedOverflowWidgets: IEditorOption; folding: IEditorOption; foldingStrategy: IEditorOption; foldingHighlight: IEditorOption; + foldingImportsByDefault: IEditorOption; + foldingMaximumRegions: IEditorOption; unfoldOnClickAfterEndOfLine: IEditorOption; fontFamily: IEditorOption; fontInfo: IEditorOption; @@ -4152,13 +4497,12 @@ declare namespace monaco.editor { formatOnPaste: IEditorOption; formatOnType: IEditorOption; glyphMargin: IEditorOption; - gotoLocation: IEditorOption; + gotoLocation: IEditorOption>>; hideCursorInOverviewRuler: IEditorOption; - highlightActiveIndentGuide: IEditorOption; - hover: IEditorOption; + hover: IEditorOption>>; inDiffEditor: IEditorOption; letterSpacing: IEditorOption; - lightbulb: IEditorOption; + lightbulb: IEditorOption>>; lineDecorationsWidth: IEditorOption; lineHeight: IEditorOption; lineNumbers: IEditorOption; @@ -4166,7 +4510,7 @@ declare namespace monaco.editor { linkedEditing: IEditorOption; links: IEditorOption; matchBrackets: IEditorOption; - minimap: IEditorOption; + minimap: IEditorOption>>; mouseStyle: IEditorOption; mouseWheelScrollSensitivity: IEditorOption; mouseWheelZoom: IEditorOption; @@ -4176,16 +4520,15 @@ declare namespace monaco.editor { occurrencesHighlight: IEditorOption; overviewRulerBorder: IEditorOption; overviewRulerLanes: IEditorOption; - padding: IEditorOption; - parameterHints: IEditorOption; + padding: IEditorOption>>; + parameterHints: IEditorOption>>; peekWidgetDefaultFocus: IEditorOption; definitionLinkOpensInPeek: IEditorOption; - quickSuggestions: IEditorOption; + quickSuggestions: IEditorOption; quickSuggestionsDelay: IEditorOption; readOnly: IEditorOption; renameOnType: IEditorOption; renderControlCharacters: IEditorOption; - renderIndentGuides: IEditorOption; renderFinalNewline: IEditorOption; renderLineHighlight: IEditorOption; renderLineHighlightOnlyWhenFocus: IEditorOption; @@ -4201,22 +4544,25 @@ declare namespace monaco.editor { selectionClipboard: IEditorOption; selectionHighlight: IEditorOption; selectOnLineNumbers: IEditorOption; - showFoldingControls: IEditorOption; + showFoldingControls: IEditorOption; showUnused: IEditorOption; showDeprecated: IEditorOption; - inlineHints: IEditorOption; + inlayHints: IEditorOption>>; snippetSuggestions: IEditorOption; - smartSelect: IEditorOption; + smartSelect: IEditorOption>>; smoothScrolling: IEditorOption; stopRenderingLineAfter: IEditorOption; - suggest: IEditorOption; + suggest: IEditorOption>>; + inlineSuggest: IEditorOption>>; suggestFontSize: IEditorOption; suggestLineHeight: IEditorOption; suggestOnTriggerCharacters: IEditorOption; suggestSelection: IEditorOption; tabCompletion: IEditorOption; tabIndex: IEditorOption; + unicodeHighlight: IEditorOption; unusualLineTerminators: IEditorOption; + useShadowDOM: IEditorOption; useTabStops: IEditorOption; wordSeparators: IEditorOption; wordWrap: IEditorOption; @@ -4244,6 +4590,18 @@ declare namespace monaco.editor { export type FindComputedEditorOptionValueById = NonNullable]>>; + export interface IEditorConstructionOptions extends IEditorOptions { + /** + * The initial editor dimension (to avoid measuring the container). + */ + dimension?: IDimension; + /** + * Place overflow widgets inside an external DOM node. + * Defaults to an internal DOM node. + */ + overflowWidgetsDomNode?: HTMLElement; + } + /** * A view zone is a full horizontal rectangle that 'pushes' text down. * The editor reserves space for view zones when rendering. @@ -4257,8 +4615,13 @@ declare namespace monaco.editor { /** * The column after which this zone should appear. * If not set, the maxLineColumn of `afterLineNumber` will be used. + * This is relevant for wrapped lines. */ afterColumn?: number; + /** + * If the `afterColumn` has multiple view columns, the affinity specifies which one to use. Defaults to `none`. + */ + afterColumnAffinity?: PositionAffinity; /** * Suppress mouse down events. * If set, the editor will attach a mouse down listener to the view zone and .preventDefault on it. @@ -4358,6 +4721,11 @@ declare namespace monaco.editor { * Placement preference for position, in order of preference. */ preference: ContentWidgetPositionPreference[]; + /** + * Placement preference when multiple view positions refer to the same (model) position. + * This plays a role when injected text is involved. + */ + positionAffinity?: PositionAffinity; } /** @@ -4368,6 +4736,9 @@ declare namespace monaco.editor { * Render this content widget in a location where it could overflow the editor's view dom node. */ allowEditorOverflow?: boolean; + /** + * Call preventDefault() on mousedown events that target the content widget. + */ suppressMouseDown?: boolean; /** * Get a unique identifier of the content widget. @@ -4505,18 +4876,11 @@ declare namespace monaco.editor { OUTSIDE_EDITOR = 13 } - /** - * Target hit with the mouse in the editor. - */ - export interface IMouseTarget { + export interface IBaseMouseTarget { /** * The target element */ readonly element: Element | null; - /** - * The target type - */ - readonly type: MouseTargetType; /** * The 'approximate' editor position */ @@ -4529,12 +4893,104 @@ declare namespace monaco.editor { * The 'approximate' editor range */ readonly range: Range | null; - /** - * Some extra detail. - */ - readonly detail: any; } + export interface IMouseTargetUnknown extends IBaseMouseTarget { + readonly type: MouseTargetType.UNKNOWN; + } + + export interface IMouseTargetTextarea extends IBaseMouseTarget { + readonly type: MouseTargetType.TEXTAREA; + readonly position: null; + readonly range: null; + } + + export interface IMouseTargetMarginData { + readonly isAfterLines: boolean; + readonly glyphMarginLeft: number; + readonly glyphMarginWidth: number; + readonly lineNumbersWidth: number; + readonly offsetX: number; + } + + export interface IMouseTargetMargin extends IBaseMouseTarget { + readonly type: MouseTargetType.GUTTER_GLYPH_MARGIN | MouseTargetType.GUTTER_LINE_NUMBERS | MouseTargetType.GUTTER_LINE_DECORATIONS; + readonly position: Position; + readonly range: Range; + readonly detail: IMouseTargetMarginData; + } + + export interface IMouseTargetViewZoneData { + readonly viewZoneId: string; + readonly positionBefore: Position | null; + readonly positionAfter: Position | null; + readonly position: Position; + readonly afterLineNumber: number; + } + + export interface IMouseTargetViewZone extends IBaseMouseTarget { + readonly type: MouseTargetType.GUTTER_VIEW_ZONE | MouseTargetType.CONTENT_VIEW_ZONE; + readonly position: Position; + readonly range: Range; + readonly detail: IMouseTargetViewZoneData; + } + + export interface IMouseTargetContentTextData { + readonly mightBeForeignElement: boolean; + } + + export interface IMouseTargetContentText extends IBaseMouseTarget { + readonly type: MouseTargetType.CONTENT_TEXT; + readonly position: Position; + readonly range: Range; + readonly detail: IMouseTargetContentTextData; + } + + export interface IMouseTargetContentEmptyData { + readonly isAfterLines: boolean; + readonly horizontalDistanceToText?: number; + } + + export interface IMouseTargetContentEmpty extends IBaseMouseTarget { + readonly type: MouseTargetType.CONTENT_EMPTY; + readonly position: Position; + readonly range: Range; + readonly detail: IMouseTargetContentEmptyData; + } + + export interface IMouseTargetContentWidget extends IBaseMouseTarget { + readonly type: MouseTargetType.CONTENT_WIDGET; + readonly position: null; + readonly range: null; + readonly detail: string; + } + + export interface IMouseTargetOverlayWidget extends IBaseMouseTarget { + readonly type: MouseTargetType.OVERLAY_WIDGET; + readonly position: null; + readonly range: null; + readonly detail: string; + } + + export interface IMouseTargetScrollbar extends IBaseMouseTarget { + readonly type: MouseTargetType.SCROLLBAR; + readonly position: Position; + readonly range: Range; + } + + export interface IMouseTargetOverviewRuler extends IBaseMouseTarget { + readonly type: MouseTargetType.OVERVIEW_RULER; + } + + export interface IMouseTargetOutsideEditor extends IBaseMouseTarget { + readonly type: MouseTargetType.OUTSIDE_EDITOR; + } + + /** + * Target hit with the mouse in the editor. + */ + export type IMouseTarget = (IMouseTargetUnknown | IMouseTargetTextarea | IMouseTargetMargin | IMouseTargetViewZone | IMouseTargetContentText | IMouseTargetContentEmpty | IMouseTargetContentWidget | IMouseTargetOverlayWidget | IMouseTargetScrollbar | IMouseTargetOverviewRuler | IMouseTargetOutsideEditor); + /** * A mouse event originating from the editor. */ @@ -4553,19 +5009,7 @@ declare namespace monaco.editor { */ export interface IPasteEvent { readonly range: Range; - readonly mode: string | null; - } - - export interface IEditorConstructionOptions extends IEditorOptions { - /** - * The initial editor dimension (to avoid measuring the container). - */ - dimension?: IDimension; - /** - * Place overflow widgets inside an external DOM node. - * Defaults to an internal DOM node. - */ - overflowWidgetsDomNode?: HTMLElement; + readonly languageId: string | null; } export interface IDiffEditorConstructionOptions extends IDiffEditorOptions { @@ -4578,6 +5022,19 @@ declare namespace monaco.editor { * Defaults to an internal DOM node. */ overflowWidgetsDomNode?: HTMLElement; + /** + * Aria label for original editor. + */ + originalAriaLabel?: string; + /** + * Aria label for modified editor. + */ + modifiedAriaLabel?: string; + /** + * Is the diff editor inside another editor + * Defaults to false + */ + isInEmbeddedEditor?: boolean; } /** @@ -4588,135 +5045,140 @@ declare namespace monaco.editor { * An event emitted when the content of the current model has changed. * @event */ - onDidChangeModelContent(listener: (e: IModelContentChangedEvent) => void): IDisposable; + readonly onDidChangeModelContent: IEvent; /** * An event emitted when the language of the current model has changed. * @event */ - onDidChangeModelLanguage(listener: (e: IModelLanguageChangedEvent) => void): IDisposable; + readonly onDidChangeModelLanguage: IEvent; /** * An event emitted when the language configuration of the current model has changed. * @event */ - onDidChangeModelLanguageConfiguration(listener: (e: IModelLanguageConfigurationChangedEvent) => void): IDisposable; + readonly onDidChangeModelLanguageConfiguration: IEvent; /** * An event emitted when the options of the current model has changed. * @event */ - onDidChangeModelOptions(listener: (e: IModelOptionsChangedEvent) => void): IDisposable; + readonly onDidChangeModelOptions: IEvent; /** * An event emitted when the configuration of the editor has changed. (e.g. `editor.updateOptions()`) * @event */ - onDidChangeConfiguration(listener: (e: ConfigurationChangedEvent) => void): IDisposable; + readonly onDidChangeConfiguration: IEvent; /** * An event emitted when the cursor position has changed. * @event */ - onDidChangeCursorPosition(listener: (e: ICursorPositionChangedEvent) => void): IDisposable; + readonly onDidChangeCursorPosition: IEvent; /** * An event emitted when the cursor selection has changed. * @event */ - onDidChangeCursorSelection(listener: (e: ICursorSelectionChangedEvent) => void): IDisposable; + readonly onDidChangeCursorSelection: IEvent; /** * An event emitted when the model of this editor has changed (e.g. `editor.setModel()`). * @event */ - onDidChangeModel(listener: (e: IModelChangedEvent) => void): IDisposable; + readonly onDidChangeModel: IEvent; /** * An event emitted when the decorations of the current model have changed. * @event */ - onDidChangeModelDecorations(listener: (e: IModelDecorationsChangedEvent) => void): IDisposable; + readonly onDidChangeModelDecorations: IEvent; /** * An event emitted when the text inside this editor gained focus (i.e. cursor starts blinking). * @event */ - onDidFocusEditorText(listener: () => void): IDisposable; + readonly onDidFocusEditorText: IEvent; /** * An event emitted when the text inside this editor lost focus (i.e. cursor stops blinking). * @event */ - onDidBlurEditorText(listener: () => void): IDisposable; + readonly onDidBlurEditorText: IEvent; /** * An event emitted when the text inside this editor or an editor widget gained focus. * @event */ - onDidFocusEditorWidget(listener: () => void): IDisposable; + readonly onDidFocusEditorWidget: IEvent; /** * An event emitted when the text inside this editor or an editor widget lost focus. * @event */ - onDidBlurEditorWidget(listener: () => void): IDisposable; + readonly onDidBlurEditorWidget: IEvent; /** * An event emitted after composition has started. */ - onDidCompositionStart(listener: () => void): IDisposable; + readonly onDidCompositionStart: IEvent; /** * An event emitted after composition has ended. */ - onDidCompositionEnd(listener: () => void): IDisposable; + readonly onDidCompositionEnd: IEvent; /** * An event emitted when editing failed because the editor is read-only. * @event */ - onDidAttemptReadOnlyEdit(listener: () => void): IDisposable; + readonly onDidAttemptReadOnlyEdit: IEvent; /** * An event emitted when users paste text in the editor. * @event */ - onDidPaste(listener: (e: IPasteEvent) => void): IDisposable; + readonly onDidPaste: IEvent; /** * An event emitted on a "mouseup". * @event */ - onMouseUp(listener: (e: IEditorMouseEvent) => void): IDisposable; + readonly onMouseUp: IEvent; /** * An event emitted on a "mousedown". * @event */ - onMouseDown(listener: (e: IEditorMouseEvent) => void): IDisposable; + readonly onMouseDown: IEvent; /** * An event emitted on a "contextmenu". * @event */ - onContextMenu(listener: (e: IEditorMouseEvent) => void): IDisposable; + readonly onContextMenu: IEvent; /** * An event emitted on a "mousemove". * @event */ - onMouseMove(listener: (e: IEditorMouseEvent) => void): IDisposable; + readonly onMouseMove: IEvent; /** * An event emitted on a "mouseleave". * @event */ - onMouseLeave(listener: (e: IPartialEditorMouseEvent) => void): IDisposable; + readonly onMouseLeave: IEvent; /** * An event emitted on a "keyup". * @event */ - onKeyUp(listener: (e: IKeyboardEvent) => void): IDisposable; + readonly onKeyUp: IEvent; /** * An event emitted on a "keydown". * @event */ - onKeyDown(listener: (e: IKeyboardEvent) => void): IDisposable; + readonly onKeyDown: IEvent; /** * An event emitted when the layout of the editor has changed. * @event */ - onDidLayoutChange(listener: (e: EditorLayoutInfo) => void): IDisposable; + readonly onDidLayoutChange: IEvent; /** * An event emitted when the content width or content height in the editor has changed. * @event */ - onDidContentSizeChange(listener: (e: IContentSizeChangedEvent) => void): IDisposable; + readonly onDidContentSizeChange: IEvent; /** * An event emitted when the scroll in the editor has changed. * @event */ - onDidScrollChange(listener: (e: IScrollEvent) => void): IDisposable; + readonly onDidScrollChange: IEvent; + /** + * An event emitted when hidden areas change in the editor (e.g. due to folding). + * @event + */ + readonly onDidChangeHiddenAreas: IEvent; /** * Saves current view state of the editor in a serializable object. */ @@ -4724,7 +5186,7 @@ declare namespace monaco.editor { /** * Restores the view state of the editor from a serializable object generated by `saveViewState`. */ - restoreViewState(state: ICodeEditorViewState): void; + restoreViewState(state: ICodeEditorViewState | null): void; /** * Returns true if the text inside this editor or an editor widget has focus. */ @@ -4734,7 +5196,7 @@ declare namespace monaco.editor { * @id Unique identifier of the contribution. * @return The contribution or null if contribution not found. */ - getContribution(id: string): T; + getContribution(id: string): T | null; /** * Type the getModel() of IEditor. */ @@ -4762,7 +5224,7 @@ declare namespace monaco.editor { getRawOptions(): IEditorOptions; /** * Get value of the current model attached to this editor. - * @see `ITextModel.getValue` + * @see {@link ITextModel.getValue} */ getValue(options?: { preserveBOM: boolean; @@ -4770,7 +5232,7 @@ declare namespace monaco.editor { }): string; /** * Set the value of the current model attached to this editor. - * @see `ITextModel.setValue` + * @see {@link ITextModel.setValue} */ setValue(newValue: string): void; /** @@ -4850,11 +5312,19 @@ declare namespace monaco.editor { * Get all the decorations on a line (filtering out decorations from other editors). */ getLineDecorations(lineNumber: number): IModelDecoration[] | null; + /** + * Get all the decorations for a range (filtering out decorations from other editors). + */ + getDecorationsInRange(range: Range): IModelDecoration[] | null; /** * All decorations added through this call will get the ownerId of this editor. - * @see `ITextModel.deltaDecorations` + * @deprecated */ deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[]; + /** + * Remove previously added decorations. + */ + removeDecorations(decorationIds: string[]): void; /** * Get the layout info for the editor. */ @@ -4943,6 +5413,7 @@ declare namespace monaco.editor { * Apply the same font settings as the editor to `target`. */ applyFontInfo(target: HTMLElement): void; + setBanner(bannerDomNode: HTMLElement | null, height: number): void; } /** @@ -4957,14 +5428,14 @@ declare namespace monaco.editor { */ export interface IDiffEditor extends IEditor { /** - * @see ICodeEditor.getDomNode + * @see {@link ICodeEditor.getContainerDomNode} */ - getDomNode(): HTMLElement; + getContainerDomNode(): HTMLElement; /** * An event emitted when the diff information computed by this diff editor has been updated. * @event */ - onDidUpdateDiff(listener: () => void): IDisposable; + readonly onDidUpdateDiff: IEvent; /** * Saves current view state of the editor in a serializable object. */ @@ -4972,7 +5443,7 @@ declare namespace monaco.editor { /** * Restores the view state of the editor from a serializable object generated by `saveViewState`. */ - restoreViewState(state: IDiffEditorViewState): void; + restoreViewState(state: IDiffEditorViewState | null): void; /** * Type the getModel() of IEditor. */ @@ -5030,7 +5501,6 @@ declare namespace monaco.editor { export class BareFontInfo { readonly _bareFontInfoBrand: void; - readonly zoomLevel: number; readonly pixelRatio: number; readonly fontFamily: string; readonly fontWeight: string; @@ -5047,6 +5517,34 @@ declare namespace monaco.editor { declare namespace monaco.languages { + export interface IRelativePattern { + /** + * A base file path to which this pattern will be matched against relatively. + */ + readonly base: string; + /** + * A file glob pattern like `*.{ts,js}` that will be matched on file paths + * relative to the base path. + * + * Example: Given a base of `/home/work/folder` and a file path of `/home/work/folder/index.js`, + * the file glob pattern will match on `index.js`. + */ + readonly pattern: string; + } + + export type LanguageSelector = string | LanguageFilter | ReadonlyArray; + + export interface LanguageFilter { + readonly language?: string; + readonly scheme?: string; + readonly pattern?: string | IRelativePattern; + readonly notebookType?: string; + /** + * This provider is implemented in the UI thread. + */ + readonly hasAccessToAllModels?: boolean; + readonly exclusive?: boolean; + } /** * Register information about a new language. @@ -5061,7 +5559,7 @@ declare namespace monaco.languages { export function getEncodedLanguageId(languageId: string): number; /** - * An event emitted when a language is first time needed (e.g. a model has it set). + * An event emitted when a language is needed for the first time (e.g. a model has it set). * @event */ export function onLanguage(languageId: string, callback: () => void): IDisposable; @@ -5107,11 +5605,11 @@ declare namespace monaco.languages { * 3322 2222 2222 1111 1111 1100 0000 0000 * 1098 7654 3210 9876 5432 1098 7654 3210 * - ------------------------------------------- - * bbbb bbbb bfff ffff ffFF FTTT LLLL LLLL + * bbbb bbbb bfff ffff ffFF FFTT LLLL LLLL * - ------------------------------------------- * - L = EncodedLanguageId (8 bits): Use `getEncodedLanguageId` to get the encoded ID of a language. - * - T = StandardTokenType (3 bits): Other = 0, Comment = 1, String = 2, RegEx = 4. - * - F = FontStyle (3 bits): None = 0, Italic = 1, Bold = 2, Underline = 4. + * - T = StandardTokenType (2 bits): Other = 0, Comment = 1, String = 2, RegEx = 3. + * - F = FontStyle (4 bits): None = 0, Italic = 1, Bold = 2, Underline = 4, Strikethrough = 8. * - f = foreground ColorId (9 bits) * - b = background ColorId (9 bits) * - The color value for each colorId is defined in IStandaloneThemeData.customTokenColors: @@ -5126,6 +5624,13 @@ declare namespace monaco.languages { endState: IState; } + /** + * A factory for token providers. + */ + export interface TokensProviderFactory { + create(): ProviderResult; + } + /** * A "manual" provider of tokens. */ @@ -5165,129 +5670,160 @@ declare namespace monaco.languages { export function setColorMap(colorMap: string[] | null): void; /** - * Set the tokens provider for a language (manual implementation). + * Register a tokens provider factory for a language. This tokenizer will be exclusive with a tokenizer + * set using `setTokensProvider` or one created using `setMonarchTokensProvider`, but will work together + * with a tokens provider set using `registerDocumentSemanticTokensProvider` or `registerDocumentRangeSemanticTokensProvider`. + */ + export function registerTokensProviderFactory(languageId: string, factory: TokensProviderFactory): IDisposable; + + /** + * Set the tokens provider for a language (manual implementation). This tokenizer will be exclusive + * with a tokenizer created using `setMonarchTokensProvider`, or with `registerTokensProviderFactory`, + * but will work together with a tokens provider set using `registerDocumentSemanticTokensProvider` + * or `registerDocumentRangeSemanticTokensProvider`. */ export function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider | Thenable): IDisposable; /** - * Set the tokens provider for a language (monarch implementation). + * Set the tokens provider for a language (monarch implementation). This tokenizer will be exclusive + * with a tokenizer set using `setTokensProvider`, or with `registerTokensProviderFactory`, but will + * work together with a tokens provider set using `registerDocumentSemanticTokensProvider` or + * `registerDocumentRangeSemanticTokensProvider`. */ export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage | Thenable): IDisposable; /** * Register a reference provider (used by e.g. reference search). */ - export function registerReferenceProvider(languageId: string, provider: ReferenceProvider): IDisposable; + export function registerReferenceProvider(languageSelector: LanguageSelector, provider: ReferenceProvider): IDisposable; /** * Register a rename provider (used by e.g. rename symbol). */ - export function registerRenameProvider(languageId: string, provider: RenameProvider): IDisposable; + export function registerRenameProvider(languageSelector: LanguageSelector, provider: RenameProvider): IDisposable; /** * Register a signature help provider (used by e.g. parameter hints). */ - export function registerSignatureHelpProvider(languageId: string, provider: SignatureHelpProvider): IDisposable; + export function registerSignatureHelpProvider(languageSelector: LanguageSelector, provider: SignatureHelpProvider): IDisposable; /** * Register a hover provider (used by e.g. editor hover). */ - export function registerHoverProvider(languageId: string, provider: HoverProvider): IDisposable; + export function registerHoverProvider(languageSelector: LanguageSelector, provider: HoverProvider): IDisposable; /** * Register a document symbol provider (used by e.g. outline). */ - export function registerDocumentSymbolProvider(languageId: string, provider: DocumentSymbolProvider): IDisposable; + export function registerDocumentSymbolProvider(languageSelector: LanguageSelector, provider: DocumentSymbolProvider): IDisposable; /** * Register a document highlight provider (used by e.g. highlight occurrences). */ - export function registerDocumentHighlightProvider(languageId: string, provider: DocumentHighlightProvider): IDisposable; + export function registerDocumentHighlightProvider(languageSelector: LanguageSelector, provider: DocumentHighlightProvider): IDisposable; /** * Register an linked editing range provider. */ - export function registerLinkedEditingRangeProvider(languageId: string, provider: LinkedEditingRangeProvider): IDisposable; + export function registerLinkedEditingRangeProvider(languageSelector: LanguageSelector, provider: LinkedEditingRangeProvider): IDisposable; /** * Register a definition provider (used by e.g. go to definition). */ - export function registerDefinitionProvider(languageId: string, provider: DefinitionProvider): IDisposable; + export function registerDefinitionProvider(languageSelector: LanguageSelector, provider: DefinitionProvider): IDisposable; /** * Register a implementation provider (used by e.g. go to implementation). */ - export function registerImplementationProvider(languageId: string, provider: ImplementationProvider): IDisposable; + export function registerImplementationProvider(languageSelector: LanguageSelector, provider: ImplementationProvider): IDisposable; /** * Register a type definition provider (used by e.g. go to type definition). */ - export function registerTypeDefinitionProvider(languageId: string, provider: TypeDefinitionProvider): IDisposable; + export function registerTypeDefinitionProvider(languageSelector: LanguageSelector, provider: TypeDefinitionProvider): IDisposable; /** * Register a code lens provider (used by e.g. inline code lenses). */ - export function registerCodeLensProvider(languageId: string, provider: CodeLensProvider): IDisposable; + export function registerCodeLensProvider(languageSelector: LanguageSelector, provider: CodeLensProvider): IDisposable; /** * Register a code action provider (used by e.g. quick fix). */ - export function registerCodeActionProvider(languageId: string, provider: CodeActionProvider): IDisposable; + export function registerCodeActionProvider(languageSelector: LanguageSelector, provider: CodeActionProvider, metadata?: CodeActionProviderMetadata): IDisposable; /** * Register a formatter that can handle only entire models. */ - export function registerDocumentFormattingEditProvider(languageId: string, provider: DocumentFormattingEditProvider): IDisposable; + export function registerDocumentFormattingEditProvider(languageSelector: LanguageSelector, provider: DocumentFormattingEditProvider): IDisposable; /** * Register a formatter that can handle a range inside a model. */ - export function registerDocumentRangeFormattingEditProvider(languageId: string, provider: DocumentRangeFormattingEditProvider): IDisposable; + export function registerDocumentRangeFormattingEditProvider(languageSelector: LanguageSelector, provider: DocumentRangeFormattingEditProvider): IDisposable; /** * Register a formatter than can do formatting as the user types. */ - export function registerOnTypeFormattingEditProvider(languageId: string, provider: OnTypeFormattingEditProvider): IDisposable; + export function registerOnTypeFormattingEditProvider(languageSelector: LanguageSelector, provider: OnTypeFormattingEditProvider): IDisposable; /** * Register a link provider that can find links in text. */ - export function registerLinkProvider(languageId: string, provider: LinkProvider): IDisposable; + export function registerLinkProvider(languageSelector: LanguageSelector, provider: LinkProvider): IDisposable; /** * Register a completion item provider (use by e.g. suggestions). */ - export function registerCompletionItemProvider(languageId: string, provider: CompletionItemProvider): IDisposable; + export function registerCompletionItemProvider(languageSelector: LanguageSelector, provider: CompletionItemProvider): IDisposable; /** * Register a document color provider (used by Color Picker, Color Decorator). */ - export function registerColorProvider(languageId: string, provider: DocumentColorProvider): IDisposable; + export function registerColorProvider(languageSelector: LanguageSelector, provider: DocumentColorProvider): IDisposable; /** * Register a folding range provider */ - export function registerFoldingRangeProvider(languageId: string, provider: FoldingRangeProvider): IDisposable; + export function registerFoldingRangeProvider(languageSelector: LanguageSelector, provider: FoldingRangeProvider): IDisposable; /** * Register a declaration provider */ - export function registerDeclarationProvider(languageId: string, provider: DeclarationProvider): IDisposable; + export function registerDeclarationProvider(languageSelector: LanguageSelector, provider: DeclarationProvider): IDisposable; /** * Register a selection range provider */ - export function registerSelectionRangeProvider(languageId: string, provider: SelectionRangeProvider): IDisposable; + export function registerSelectionRangeProvider(languageSelector: LanguageSelector, provider: SelectionRangeProvider): IDisposable; /** - * Register a document semantic tokens provider + * Register a document semantic tokens provider. A semantic tokens provider will complement and enhance a + * simple top-down tokenizer. Simple top-down tokenizers can be set either via `setMonarchTokensProvider` + * or `setTokensProvider`. + * + * For the best user experience, register both a semantic tokens provider and a top-down tokenizer. */ - export function registerDocumentSemanticTokensProvider(languageId: string, provider: DocumentSemanticTokensProvider): IDisposable; + export function registerDocumentSemanticTokensProvider(languageSelector: LanguageSelector, provider: DocumentSemanticTokensProvider): IDisposable; /** - * Register a document range semantic tokens provider + * Register a document range semantic tokens provider. A semantic tokens provider will complement and enhance a + * simple top-down tokenizer. Simple top-down tokenizers can be set either via `setMonarchTokensProvider` + * or `setTokensProvider`. + * + * For the best user experience, register both a semantic tokens provider and a top-down tokenizer. */ - export function registerDocumentRangeSemanticTokensProvider(languageId: string, provider: DocumentRangeSemanticTokensProvider): IDisposable; + export function registerDocumentRangeSemanticTokensProvider(languageSelector: LanguageSelector, provider: DocumentRangeSemanticTokensProvider): IDisposable; + + /** + * Register an inline completions provider. + */ + export function registerInlineCompletionsProvider(languageSelector: LanguageSelector, provider: InlineCompletionsProvider): IDisposable; + + /** + * Register an inlay hints provider. + */ + export function registerInlayHintsProvider(languageSelector: LanguageSelector, provider: InlayHintsProvider): IDisposable; /** * Contains additional diagnostic information about the context in which @@ -5313,6 +5849,25 @@ declare namespace monaco.languages { * Provide commands for the given document and range. */ provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): ProviderResult; + /** + * Given a code action fill in the edit. Will only invoked when missing. + */ + resolveCodeAction?(codeAction: CodeAction, token: CancellationToken): ProviderResult; + } + + /** + * Metadata about the type of code actions that a {@link CodeActionProvider} provides. + */ + export interface CodeActionProviderMetadata { + /** + * List of code action kinds that a {@link CodeActionProvider} may return. + * + * This list is used to determine if a given `CodeActionProvider` should be invoked or not. + * To avoid unnecessary computation, every `CodeActionProvider` should list use `providedCodeActionKinds`. The + * list of kinds may either be generic, such as `["quickfix", "refactor", "source"]`, or list out every kind provided, + * such as `["quickfix.removeLine", "source.fixAll" ...]`. + */ + readonly providedCodeActionKinds?: readonly string[]; } /** @@ -5370,6 +5925,11 @@ declare namespace monaco.languages { * settings will be used. */ surroundingPairs?: IAutoClosingPair[]; + /** + * Defines a list of bracket pairs that are colorized depending on their nesting level. + * If not set, the configured brackets will be used. + */ + colorizedBracketPairs?: CharacterPair[]; /** * Defines what characters must be after the cursor for bracket or quote autoclosing to occur when using the \'languageDefined\' autoclosing setting. * @@ -5544,7 +6104,7 @@ declare namespace monaco.languages { } /** - * A provider result represents the values a provider, like the [`HoverProvider`](#HoverProvider), + * A provider result represents the values a provider, like the {@link HoverProvider}, * may return. For once this is the actual result type `T`, like `Hover`, or a thenable that resolves * to that type `T`. In addition, `null` and `undefined` can be returned - either directly or from a * thenable. @@ -5613,22 +6173,9 @@ declare namespace monaco.languages { } export interface CompletionItemLabel { - /** - * The function or variable. Rendered leftmost. - */ - name: string; - /** - * The parameters without the return type. Render after `name`. - */ - parameters?: string; - /** - * The fully qualified name, like package name or file path. Rendered after `signature`. - */ - qualifier?: string; - /** - * The return-type of a function or type of a property/variable. Rendered rightmost. - */ - type?: string; + label: string; + detail?: string; + description?: string; } export enum CompletionItemTag { @@ -5647,6 +6194,11 @@ declare namespace monaco.languages { InsertAsSnippet = 4 } + export interface CompletionItemRanges { + insert: IRange; + replace: IRange; + } + /** * A completion item represents a text snippet that is * proposed to complete text that is being typed. @@ -5679,13 +6231,13 @@ declare namespace monaco.languages { documentation?: string | IMarkdownString; /** * A string that should be used when comparing this item - * with other items. When `falsy` the [label](#CompletionItem.label) + * with other items. When `falsy` the {@link CompletionItem.label label} * is used. */ sortText?: string; /** * A string that should be used when filtering a set of - * completion items. When `falsy` the [label](#CompletionItem.label) + * completion items. When `falsy` the {@link CompletionItem.label label} * is used. */ filterText?: string; @@ -5698,27 +6250,23 @@ declare namespace monaco.languages { /** * A string or snippet that should be inserted in a document when selecting * this completion. - * is used. */ insertText: string; /** - * Addition rules (as bitmask) that should be applied when inserting + * Additional rules (as bitmask) that should be applied when inserting * this completion. */ insertTextRules?: CompletionItemInsertTextRule; /** * A range of text that should be replaced by this completion item. * - * Defaults to a range from the start of the [current word](#TextDocument.getWordRangeAtPosition) to the + * Defaults to a range from the start of the {@link TextDocument.getWordRangeAtPosition current word} to the * current position. * - * *Note:* The range must be a [single line](#Range.isSingleLine) and it must - * [contain](#Range.contains) the position at which completion has been [requested](#CompletionItemProvider.provideCompletionItems). + * *Note:* The range must be a {@link Range.isSingleLine single line} and it must + * {@link Range.contains contain} the position at which completion has been {@link CompletionItemProvider.provideCompletionItems requested}. */ - range: IRange | { - insert: IRange; - replace: IRange; - }; + range: IRange | CompletionItemRanges; /** * An optional set of characters that when pressed while this completion is active will accept it first and * then type that character. *Note* that all commit characters should have `length=1` and that superfluous @@ -5754,7 +6302,7 @@ declare namespace monaco.languages { /** * Contains additional information about the context in which - * [completion provider](#CompletionItemProvider.provideCompletionItems) is triggered. + * {@link CompletionItemProvider.provideCompletionItems completion provider} is triggered. */ export interface CompletionContext { /** @@ -5775,10 +6323,10 @@ declare namespace monaco.languages { * * When computing *complete* completion items is expensive, providers can optionally implement * the `resolveCompletionItem`-function. In that case it is enough to return completion - * items with a [label](#CompletionItem.label) from the - * [provideCompletionItems](#CompletionItemProvider.provideCompletionItems)-function. Subsequently, + * items with a {@link CompletionItem.label label} from the + * {@link CompletionItemProvider.provideCompletionItems provideCompletionItems}-function. Subsequently, * when a completion item is shown in the UI and gains focus this provider is asked to resolve - * the item, like adding [doc-comment](#CompletionItem.documentation) or [details](#CompletionItem.detail). + * the item, like adding {@link CompletionItem.documentation doc-comment} or {@link CompletionItem.detail details}. */ export interface CompletionItemProvider { triggerCharacters?: string[]; @@ -5787,14 +6335,101 @@ declare namespace monaco.languages { */ provideCompletionItems(model: editor.ITextModel, position: Position, context: CompletionContext, token: CancellationToken): ProviderResult; /** - * Given a completion item fill in more data, like [doc-comment](#CompletionItem.documentation) - * or [details](#CompletionItem.detail). + * Given a completion item fill in more data, like {@link CompletionItem.documentation doc-comment} + * or {@link CompletionItem.detail details}. * * The editor will only resolve a completion item once. */ resolveCompletionItem?(item: CompletionItem, token: CancellationToken): ProviderResult; } + /** + * How an {@link InlineCompletionsProvider inline completion provider} was triggered. + */ + export enum InlineCompletionTriggerKind { + /** + * Completion was triggered automatically while editing. + * It is sufficient to return a single completion item in this case. + */ + Automatic = 0, + /** + * Completion was triggered explicitly by a user gesture. + * Return multiple completion items to enable cycling through them. + */ + Explicit = 1 + } + + export interface InlineCompletionContext { + /** + * How the completion was triggered. + */ + readonly triggerKind: InlineCompletionTriggerKind; + readonly selectedSuggestionInfo: SelectedSuggestionInfo | undefined; + } + + export interface SelectedSuggestionInfo { + range: IRange; + text: string; + isSnippetText: boolean; + completionKind: CompletionItemKind; + } + + export interface InlineCompletion { + /** + * The text to insert. + * If the text contains a line break, the range must end at the end of a line. + * If existing text should be replaced, the existing text must be a prefix of the text to insert. + * + * The text can also be a snippet. In that case, a preview with default parameters is shown. + * When accepting the suggestion, the full snippet is inserted. + */ + readonly insertText: string | { + snippet: string; + }; + /** + * A text that is used to decide if this inline completion should be shown. + * An inline completion is shown if the text to replace is a subword of the filter text. + */ + readonly filterText?: string; + /** + * An optional array of additional text edits that are applied when + * selecting this completion. Edits must not overlap with the main edit + * nor with themselves. + */ + readonly additionalTextEdits?: editor.ISingleEditOperation[]; + /** + * The range to replace. + * Must begin and end on the same line. + */ + readonly range?: IRange; + readonly command?: Command; + /** + * If set to `true`, unopened closing brackets are removed and unclosed opening brackets are closed. + * Defaults to `false`. + */ + readonly completeBracketPairs?: boolean; + } + + export interface InlineCompletions { + readonly items: readonly TItem[]; + /** + * A list of commands associated with the inline completions of this list. + */ + readonly commands?: Command[]; + } + + export interface InlineCompletionsProvider { + provideInlineCompletions(model: editor.ITextModel, position: Position, context: InlineCompletionContext, token: CancellationToken): ProviderResult; + /** + * Will be called when an item is shown. + */ + handleItemDidShow?(completions: T, item: T['items'][number]): void; + /** + * Will be called when a completions list is no longer in use and can be garbage-collected. + */ + freeInlineCompletions(completions: T): void; + } + export interface CodeAction { title: string; command?: Command; @@ -5933,7 +6568,7 @@ declare namespace monaco.languages { */ range: IRange; /** - * The highlight kind, default is [text](#DocumentHighlightKind.Text). + * The highlight kind, default is {@link DocumentHighlightKind.Text text}. */ kind?: DocumentHighlightKind; } @@ -6260,12 +6895,12 @@ declare namespace monaco.languages { */ label: string; /** - * An [edit](#TextEdit) which is applied to a document when selecting + * An {@link TextEdit edit} which is applied to a document when selecting * this presentation for the color. */ textEdit?: TextEdit; /** - * An optional array of additional [text edits](#TextEdit) that are applied when + * An optional array of additional {@link TextEdit text edits} that are applied when * selecting this color presentation. */ additionalTextEdits?: TextEdit[]; @@ -6337,10 +6972,10 @@ declare namespace monaco.languages { */ end: number; /** - * Describes the [Kind](#FoldingRangeKind) of the folding range such as [Comment](#FoldingRangeKind.Comment) or - * [Region](#FoldingRangeKind.Region). The kind is used to categorize folding ranges and used by commands + * Describes the {@link FoldingRangeKind Kind} of the folding range such as {@link FoldingRangeKind.Comment Comment} or + * {@link FoldingRangeKind.Region Region}. The kind is used to categorize folding ranges and used by commands * like 'Fold all comments'. See - * [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds. + * {@link FoldingRangeKind} for an enumeration of standardized kinds. */ kind?: FoldingRangeKind; } @@ -6361,7 +6996,7 @@ declare namespace monaco.languages { */ static readonly Region: FoldingRangeKind; /** - * Creates a new [FoldingRangeKind](#FoldingRangeKind). + * Creates a new {@link FoldingRangeKind}. * * @param value of the kind. */ @@ -6385,22 +7020,24 @@ declare namespace monaco.languages { maxSize?: number; } - export interface WorkspaceFileEdit { - oldUri?: Uri; - newUri?: Uri; + export interface IWorkspaceFileEdit { + oldResource?: Uri; + newResource?: Uri; options?: WorkspaceFileEditOptions; metadata?: WorkspaceEditMetadata; } - export interface WorkspaceTextEdit { + export interface IWorkspaceTextEdit { resource: Uri; - edit: TextEdit; - modelVersionId?: number; + textEdit: TextEdit & { + insertAsSnippet?: boolean; + }; + versionId: number | undefined; metadata?: WorkspaceEditMetadata; } export interface WorkspaceEdit { - edits: Array; + edits: Array; } export interface Rejection { @@ -6441,24 +7078,38 @@ declare namespace monaco.languages { resolveCodeLens?(model: editor.ITextModel, codeLens: CodeLens, token: CancellationToken): ProviderResult; } - export enum InlineHintKind { - Other = 0, + export enum InlayHintKind { Type = 1, Parameter = 2 } - export interface InlineHint { - text: string; - range: IRange; - kind: InlineHintKind; - description?: string | IMarkdownString; - whitespaceBefore?: boolean; - whitespaceAfter?: boolean; + export interface InlayHintLabelPart { + label: string; + tooltip?: string | IMarkdownString; + command?: Command; + location?: Location; } - export interface InlineHintsProvider { - onDidChangeInlineHints?: IEvent | undefined; - provideInlineHints(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult; + export interface InlayHint { + label: string | InlayHintLabelPart[]; + tooltip?: string | IMarkdownString; + textEdits?: TextEdit[]; + position: IPosition; + kind?: InlayHintKind; + paddingLeft?: boolean; + paddingRight?: boolean; + } + + export interface InlayHintList { + hints: InlayHint[]; + dispose(): void; + } + + export interface InlayHintsProvider { + displayName?: string; + onDidChangeInlayHints?: IEvent; + provideInlayHints(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult; + resolveInlayHint?(hint: InlayHint, token: CancellationToken): ProviderResult; } export interface SemanticTokensLegend { @@ -6646,7 +7297,11 @@ declare namespace monaco.languages { declare namespace monaco.worker { - export interface IMirrorModel { + export interface IMirrorTextModel { + readonly version: number; + } + + export interface IMirrorModel extends IMirrorTextModel { readonly uri: Uri; readonly version: number; getValue(): string; @@ -6672,6 +7327,480 @@ declare namespace monaco.worker { * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +declare namespace monaco.languages.css { + export interface CSSFormatConfiguration { + /** separate selectors with newline (e.g. "a,\nbr" or "a, br"): Default: true */ + newlineBetweenSelectors?: boolean; + /** add a new line after every css rule: Default: true */ + newlineBetweenRules?: boolean; + /** ensure space around selector separators: '>', '+', '~' (e.g. "a>b" -> "a > b"): Default: false */ + spaceAroundSelectorSeparator?: boolean; + /** put braces on the same line as rules (`collapse`), or put braces on own line, Allman / ANSI style (`expand`). Default `collapse` */ + braceStyle?: 'collapse' | 'expand'; + /** whether existing line breaks before elements should be preserved. Default: true */ + preserveNewLines?: boolean; + /** maximum number of line breaks to be preserved in one chunk. Default: unlimited */ + maxPreserveNewLines?: number; + } + export interface Options { + readonly validate?: boolean; + readonly lint?: { + readonly compatibleVendorPrefixes?: 'ignore' | 'warning' | 'error'; + readonly vendorPrefix?: 'ignore' | 'warning' | 'error'; + readonly duplicateProperties?: 'ignore' | 'warning' | 'error'; + readonly emptyRules?: 'ignore' | 'warning' | 'error'; + readonly importStatement?: 'ignore' | 'warning' | 'error'; + readonly boxModel?: 'ignore' | 'warning' | 'error'; + readonly universalSelector?: 'ignore' | 'warning' | 'error'; + readonly zeroUnits?: 'ignore' | 'warning' | 'error'; + readonly fontFaceProperties?: 'ignore' | 'warning' | 'error'; + readonly hexColorLength?: 'ignore' | 'warning' | 'error'; + readonly argumentsInColorFunction?: 'ignore' | 'warning' | 'error'; + readonly unknownProperties?: 'ignore' | 'warning' | 'error'; + readonly ieHack?: 'ignore' | 'warning' | 'error'; + readonly unknownVendorSpecificProperties?: 'ignore' | 'warning' | 'error'; + readonly propertyIgnoredDueToDisplay?: 'ignore' | 'warning' | 'error'; + readonly important?: 'ignore' | 'warning' | 'error'; + readonly float?: 'ignore' | 'warning' | 'error'; + readonly idSelector?: 'ignore' | 'warning' | 'error'; + }; + /** + * Configures the CSS data types known by the langauge service. + */ + readonly data?: CSSDataConfiguration; + /** + * Settings for the CSS formatter. + */ + readonly format?: CSSFormatConfiguration; + } + export interface ModeConfiguration { + /** + * Defines whether the built-in completionItemProvider is enabled. + */ + readonly completionItems?: boolean; + /** + * Defines whether the built-in hoverProvider is enabled. + */ + readonly hovers?: boolean; + /** + * Defines whether the built-in documentSymbolProvider is enabled. + */ + readonly documentSymbols?: boolean; + /** + * Defines whether the built-in definitions provider is enabled. + */ + readonly definitions?: boolean; + /** + * Defines whether the built-in references provider is enabled. + */ + readonly references?: boolean; + /** + * Defines whether the built-in references provider is enabled. + */ + readonly documentHighlights?: boolean; + /** + * Defines whether the built-in rename provider is enabled. + */ + readonly rename?: boolean; + /** + * Defines whether the built-in color provider is enabled. + */ + readonly colors?: boolean; + /** + * Defines whether the built-in foldingRange provider is enabled. + */ + readonly foldingRanges?: boolean; + /** + * Defines whether the built-in diagnostic provider is enabled. + */ + readonly diagnostics?: boolean; + /** + * Defines whether the built-in selection range provider is enabled. + */ + readonly selectionRanges?: boolean; + /** + * Defines whether the built-in document formatting edit provider is enabled. + */ + readonly documentFormattingEdits?: boolean; + /** + * Defines whether the built-in document formatting range edit provider is enabled. + */ + readonly documentRangeFormattingEdits?: boolean; + } + export interface LanguageServiceDefaults { + readonly languageId: string; + readonly onDidChange: IEvent; + readonly modeConfiguration: ModeConfiguration; + readonly options: Options; + setOptions(options: Options): void; + setModeConfiguration(modeConfiguration: ModeConfiguration): void; + /** @deprecated Use options instead */ + readonly diagnosticsOptions: DiagnosticsOptions; + /** @deprecated Use setOptions instead */ + setDiagnosticsOptions(options: DiagnosticsOptions): void; + } + /** @deprecated Use Options instead */ + export type DiagnosticsOptions = Options; + export const cssDefaults: LanguageServiceDefaults; + export const scssDefaults: LanguageServiceDefaults; + export const lessDefaults: LanguageServiceDefaults; + export interface CSSDataConfiguration { + /** + * Defines whether the standard CSS properties, at-directives, pseudoClasses and pseudoElements are shown. + */ + useDefaultDataProvider?: boolean; + /** + * Provides a set of custom data providers. + */ + dataProviders?: { + [providerId: string]: CSSDataV1; + }; + } + /** + * Custom CSS properties, at-directives, pseudoClasses and pseudoElements + * https://github.com/microsoft/vscode-css-languageservice/blob/main/docs/customData.md + */ + export interface CSSDataV1 { + version: 1 | 1.1; + properties?: IPropertyData[]; + atDirectives?: IAtDirectiveData[]; + pseudoClasses?: IPseudoClassData[]; + pseudoElements?: IPseudoElementData[]; + } + export type EntryStatus = 'standard' | 'experimental' | 'nonstandard' | 'obsolete'; + export interface IReference { + name: string; + url: string; + } + export interface IPropertyData { + name: string; + description?: string | MarkupContent; + browsers?: string[]; + restrictions?: string[]; + status?: EntryStatus; + syntax?: string; + values?: IValueData[]; + references?: IReference[]; + relevance?: number; + } + export interface IAtDirectiveData { + name: string; + description?: string | MarkupContent; + browsers?: string[]; + status?: EntryStatus; + references?: IReference[]; + } + export interface IPseudoClassData { + name: string; + description?: string | MarkupContent; + browsers?: string[]; + status?: EntryStatus; + references?: IReference[]; + } + export interface IPseudoElementData { + name: string; + description?: string | MarkupContent; + browsers?: string[]; + status?: EntryStatus; + references?: IReference[]; + } + export interface IValueData { + name: string; + description?: string | MarkupContent; + browsers?: string[]; + status?: EntryStatus; + references?: IReference[]; + } + export interface MarkupContent { + kind: MarkupKind; + value: string; + } + export type MarkupKind = 'plaintext' | 'markdown'; +} + +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +declare namespace monaco.languages.html { + export interface HTMLFormatConfiguration { + readonly tabSize: number; + readonly insertSpaces: boolean; + readonly wrapLineLength: number; + readonly unformatted: string; + readonly contentUnformatted: string; + readonly indentInnerHtml: boolean; + readonly preserveNewLines: boolean; + readonly maxPreserveNewLines: number | undefined; + readonly indentHandlebars: boolean; + readonly endWithNewline: boolean; + readonly extraLiners: string; + readonly wrapAttributes: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline'; + } + export interface CompletionConfiguration { + readonly [providerId: string]: boolean; + } + export interface Options { + /** + * Settings for the HTML formatter. + */ + readonly format?: HTMLFormatConfiguration; + /** + * Code completion settings. + */ + readonly suggest?: CompletionConfiguration; + /** + * Configures the HTML data types known by the HTML langauge service. + */ + readonly data?: HTMLDataConfiguration; + } + export interface ModeConfiguration { + /** + * Defines whether the built-in completionItemProvider is enabled. + */ + readonly completionItems?: boolean; + /** + * Defines whether the built-in hoverProvider is enabled. + */ + readonly hovers?: boolean; + /** + * Defines whether the built-in documentSymbolProvider is enabled. + */ + readonly documentSymbols?: boolean; + /** + * Defines whether the built-in definitions provider is enabled. + */ + readonly links?: boolean; + /** + * Defines whether the built-in references provider is enabled. + */ + readonly documentHighlights?: boolean; + /** + * Defines whether the built-in rename provider is enabled. + */ + readonly rename?: boolean; + /** + * Defines whether the built-in color provider is enabled. + */ + readonly colors?: boolean; + /** + * Defines whether the built-in foldingRange provider is enabled. + */ + readonly foldingRanges?: boolean; + /** + * Defines whether the built-in diagnostic provider is enabled. + */ + readonly diagnostics?: boolean; + /** + * Defines whether the built-in selection range provider is enabled. + */ + readonly selectionRanges?: boolean; + /** + * Defines whether the built-in documentFormattingEdit provider is enabled. + */ + readonly documentFormattingEdits?: boolean; + /** + * Defines whether the built-in documentRangeFormattingEdit provider is enabled. + */ + readonly documentRangeFormattingEdits?: boolean; + } + export interface LanguageServiceDefaults { + readonly languageId: string; + readonly modeConfiguration: ModeConfiguration; + readonly onDidChange: IEvent; + readonly options: Options; + setOptions(options: Options): void; + setModeConfiguration(modeConfiguration: ModeConfiguration): void; + } + export const htmlLanguageService: LanguageServiceRegistration; + export const htmlDefaults: LanguageServiceDefaults; + export const handlebarLanguageService: LanguageServiceRegistration; + export const handlebarDefaults: LanguageServiceDefaults; + export const razorLanguageService: LanguageServiceRegistration; + export const razorDefaults: LanguageServiceDefaults; + export interface LanguageServiceRegistration extends IDisposable { + readonly defaults: LanguageServiceDefaults; + } + /** + * Registers a new HTML language service for the languageId. + * Note: 'html', 'handlebar' and 'razor' are registered by default. + * + * Use this method to register additional language ids with a HTML service. + * The language server has to be registered before an editor model is opened. + */ + export function registerHTMLLanguageService(languageId: string, options?: Options, modeConfiguration?: ModeConfiguration): LanguageServiceRegistration; + export interface HTMLDataConfiguration { + /** + * Defines whether the standard HTML tags and attributes are shown + */ + readonly useDefaultDataProvider?: boolean; + /** + * Provides a set of custom data providers. + */ + readonly dataProviders?: { + [providerId: string]: HTMLDataV1; + }; + } + /** + * Custom HTML tags attributes and attribute values + * https://github.com/microsoft/vscode-html-languageservice/blob/main/docs/customData.md + */ + export interface HTMLDataV1 { + readonly version: 1 | 1.1; + readonly tags?: ITagData[]; + readonly globalAttributes?: IAttributeData[]; + readonly valueSets?: IValueSet[]; + } + export interface IReference { + readonly name: string; + readonly url: string; + } + export interface ITagData { + readonly name: string; + readonly description?: string | MarkupContent; + readonly attributes: IAttributeData[]; + readonly references?: IReference[]; + } + export interface IAttributeData { + readonly name: string; + readonly description?: string | MarkupContent; + readonly valueSet?: string; + readonly values?: IValueData[]; + readonly references?: IReference[]; + } + export interface IValueData { + readonly name: string; + readonly description?: string | MarkupContent; + readonly references?: IReference[]; + } + export interface IValueSet { + readonly name: string; + readonly values: IValueData[]; + } + export interface MarkupContent { + readonly kind: MarkupKind; + readonly value: string; + } + export type MarkupKind = 'plaintext' | 'markdown'; +} + +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +declare namespace monaco.languages.json { + export interface DiagnosticsOptions { + /** + * If set, the validator will be enabled and perform syntax and schema based validation, + * unless `DiagnosticsOptions.schemaValidation` is set to `ignore`. + */ + readonly validate?: boolean; + /** + * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. + * `DiagnosticsOptions.allowComments` will override this setting. + */ + readonly allowComments?: boolean; + /** + * A list of known schemas and/or associations of schemas to file names. + */ + readonly schemas?: { + /** + * The URI of the schema, which is also the identifier of the schema. + */ + readonly uri: string; + /** + * A list of glob patterns that describe for which file URIs the JSON schema will be used. + * '*' and '**' wildcards are supported. Exclusion patterns start with '!'. + * For example '*.schema.json', 'package.json', '!foo*.schema.json', 'foo/**\/BADRESP.json'. + * A match succeeds when there is at least one pattern matching and last matching pattern does not start with '!'. + */ + readonly fileMatch?: string[]; + /** + * The schema for the given URI. + */ + readonly schema?: any; + }[]; + /** + * If set, the schema service would load schema content on-demand with 'fetch' if available + */ + readonly enableSchemaRequest?: boolean; + /** + * The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used. + */ + readonly schemaValidation?: SeverityLevel; + /** + * The severity of problems that occurred when resolving and loading schemas. If set to 'ignore', schema resolving problems are not reported. If not set, 'warning' is used. + */ + readonly schemaRequest?: SeverityLevel; + /** + * The severity of reported trailing commas. If not set, trailing commas will be reported as errors. + */ + readonly trailingCommas?: SeverityLevel; + /** + * The severity of reported comments. If not set, 'DiagnosticsOptions.allowComments' defines whether comments are ignored or reported as errors. + */ + readonly comments?: SeverityLevel; + } + export type SeverityLevel = 'error' | 'warning' | 'ignore'; + export interface ModeConfiguration { + /** + * Defines whether the built-in documentFormattingEdit provider is enabled. + */ + readonly documentFormattingEdits?: boolean; + /** + * Defines whether the built-in documentRangeFormattingEdit provider is enabled. + */ + readonly documentRangeFormattingEdits?: boolean; + /** + * Defines whether the built-in completionItemProvider is enabled. + */ + readonly completionItems?: boolean; + /** + * Defines whether the built-in hoverProvider is enabled. + */ + readonly hovers?: boolean; + /** + * Defines whether the built-in documentSymbolProvider is enabled. + */ + readonly documentSymbols?: boolean; + /** + * Defines whether the built-in tokens provider is enabled. + */ + readonly tokens?: boolean; + /** + * Defines whether the built-in color provider is enabled. + */ + readonly colors?: boolean; + /** + * Defines whether the built-in foldingRange provider is enabled. + */ + readonly foldingRanges?: boolean; + /** + * Defines whether the built-in diagnostic provider is enabled. + */ + readonly diagnostics?: boolean; + /** + * Defines whether the built-in selection range provider is enabled. + */ + readonly selectionRanges?: boolean; + } + export interface LanguageServiceDefaults { + readonly languageId: string; + readonly onDidChange: IEvent; + readonly diagnosticsOptions: DiagnosticsOptions; + readonly modeConfiguration: ModeConfiguration; + setDiagnosticsOptions(options: DiagnosticsOptions): void; + setModeConfiguration(modeConfiguration: ModeConfiguration): void; + } + export const jsonDefaults: LanguageServiceDefaults; +} + +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ declare namespace monaco.languages.typescript { export enum ModuleKind { @@ -6715,15 +7844,7 @@ declare namespace monaco.languages.typescript { interface MapLike { [index: string]: T; } - type CompilerOptionsValue = - | string - | number - | boolean - | (string | number)[] - | string[] - | MapLike - | null - | undefined; + type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | null | undefined; interface CompilerOptions { allowJs?: boolean; allowSyntheticDefaultImports?: boolean; @@ -6811,12 +7932,26 @@ declare namespace monaco.languages.typescript { noSemanticValidation?: boolean; noSyntaxValidation?: boolean; noSuggestionDiagnostics?: boolean; + /** + * Limit diagnostic computation to only visible files. + * Defaults to false. + */ + onlyVisible?: boolean; diagnosticCodesToIgnore?: number[]; } export interface WorkerOptions { /** A full HTTP path to a JavaScript file which adds a function `customTSWorkerFactory` to the self inside a web-worker */ customWorkerPath?: string; } + interface InlayHintsOptions { + readonly includeInlayParameterNameHints?: 'none' | 'literals' | 'all'; + readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; + readonly includeInlayFunctionParameterTypeHints?: boolean; + readonly includeInlayVariableTypeHints?: boolean; + readonly includeInlayPropertyDeclarationTypeHints?: boolean; + readonly includeInlayFunctionLikeReturnTypeHints?: boolean; + readonly includeInlayEnumMemberValueHints?: boolean; + } interface IExtraLib { content: string; version: number; @@ -6847,11 +7982,9 @@ declare namespace monaco.languages.typescript { category: 0 | 1 | 2 | 3; code: number; /** TypeScriptWorker removes all but the `fileName` property to avoid serializing circular JSON structures. */ - file: - | { - fileName: string; - } - | undefined; + file: { + fileName: string; + } | undefined; start: number | undefined; length: number | undefined; messageText: string | DiagnosticMessageChain; @@ -6875,6 +8008,7 @@ declare namespace monaco.languages.typescript { */ readonly onDidExtraLibsChange: IEvent; readonly workerOptions: WorkerOptions; + readonly inlayHintsOptions: InlayHintsOptions; /** * Get the current extra libs registered with the language service. */ @@ -6896,12 +8030,10 @@ declare namespace monaco.languages.typescript { * files that won't be loaded as editor documents, like `jquery.d.ts`. * @param libs An array of entries to register. */ - setExtraLibs( - libs: { - content: string; - filePath?: string; - }[] - ): void; + setExtraLibs(libs: { + content: string; + filePath?: string; + }[]): void; /** * Get current TypeScript compiler options for the language service. */ @@ -6937,6 +8069,10 @@ declare namespace monaco.languages.typescript { * to the worker on start or restart. */ getEagerModelSync(): boolean; + /** + * Configure inlay hints options. + */ + setInlayHintsOptions(options: InlayHintsOptions): void; } export interface TypeScriptWorker { /** @@ -6969,20 +8105,12 @@ declare namespace monaco.languages.typescript { * Get code completion details for the given file, position, and entry. * @returns `Promise` */ - getCompletionEntryDetails( - fileName: string, - position: number, - entry: string - ): Promise; + getCompletionEntryDetails(fileName: string, position: number, entry: string): Promise; /** * Get signature help items for the item at the given file and position. * @returns `Promise` */ - getSignatureHelpItems( - fileName: string, - position: number, - options: any - ): Promise; + getSignatureHelpItems(fileName: string, position: number, options: any): Promise; /** * Get quick info for the item at the given position in the file. * @returns `Promise` @@ -6992,18 +8120,12 @@ declare namespace monaco.languages.typescript { * Get other ranges which are related to the item at the given position in the file (often used for highlighting). * @returns `Promise | undefined>` */ - getOccurrencesAtPosition( - fileName: string, - position: number - ): Promise | undefined>; + getOccurrencesAtPosition(fileName: string, position: number): Promise | undefined>; /** * Get the definition of the item at the given position in the file. * @returns `Promise | undefined>` */ - getDefinitionAtPosition( - fileName: string, - position: number - ): Promise | undefined>; + getDefinitionAtPosition(fileName: string, position: number): Promise | undefined>; /** * Get references to the item at the given position in the file. * @returns `Promise` @@ -7025,34 +8147,18 @@ declare namespace monaco.languages.typescript { * @param options `typescript.FormatCodeOptions` * @returns `Promise` */ - getFormattingEditsForRange( - fileName: string, - start: number, - end: number, - options: any - ): Promise; + getFormattingEditsForRange(fileName: string, start: number, end: number, options: any): Promise; /** * Get formatting changes which should be applied after the given keystroke. * @param options `typescript.FormatCodeOptions` * @returns `Promise` */ - getFormattingEditsAfterKeystroke( - fileName: string, - postion: number, - ch: string, - options: any - ): Promise; + getFormattingEditsAfterKeystroke(fileName: string, postion: number, ch: string, options: any): Promise; /** * Get other occurrences which should be updated when renaming the item at the given file and position. * @returns `Promise` */ - findRenameLocations( - fileName: string, - positon: number, - findInStrings: boolean, - findInComments: boolean, - providePrefixAndSuffixTextForRename: boolean - ): Promise; + findRenameLocations(fileName: string, positon: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename: boolean): Promise; /** * Get edits which should be applied to rename the item at the given file and position (or a failure reason). * @param options `typescript.RenameInfoOptions` @@ -7069,13 +8175,13 @@ declare namespace monaco.languages.typescript { * @param formatOptions `typescript.FormatCodeOptions` * @returns `Promise>` */ - getCodeFixesAtPosition( - fileName: string, - start: number, - end: number, - errorCodes: number[], - formatOptions: any - ): Promise>; + getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: any): Promise>; + /** + * Get inlay hints in the range of the file. + * @param fileName + * @returns `Promise` + */ + provideInlayHints(fileName: string, start: number, end: number): Promise>; } export const typescriptVersion: string; export const typescriptDefaults: LanguageServiceDefaults; @@ -7083,288 +8189,3 @@ declare namespace monaco.languages.typescript { export const getTypeScriptWorker: () => Promise<(...uris: Uri[]) => Promise>; export const getJavaScriptWorker: () => Promise<(...uris: Uri[]) => Promise>; } - -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - - -declare namespace monaco.languages.css { - export interface DiagnosticsOptions { - readonly validate?: boolean; - readonly lint?: { - readonly compatibleVendorPrefixes?: 'ignore' | 'warning' | 'error'; - readonly vendorPrefix?: 'ignore' | 'warning' | 'error'; - readonly duplicateProperties?: 'ignore' | 'warning' | 'error'; - readonly emptyRules?: 'ignore' | 'warning' | 'error'; - readonly importStatement?: 'ignore' | 'warning' | 'error'; - readonly boxModel?: 'ignore' | 'warning' | 'error'; - readonly universalSelector?: 'ignore' | 'warning' | 'error'; - readonly zeroUnits?: 'ignore' | 'warning' | 'error'; - readonly fontFaceProperties?: 'ignore' | 'warning' | 'error'; - readonly hexColorLength?: 'ignore' | 'warning' | 'error'; - readonly argumentsInColorFunction?: 'ignore' | 'warning' | 'error'; - readonly unknownProperties?: 'ignore' | 'warning' | 'error'; - readonly ieHack?: 'ignore' | 'warning' | 'error'; - readonly unknownVendorSpecificProperties?: 'ignore' | 'warning' | 'error'; - readonly propertyIgnoredDueToDisplay?: 'ignore' | 'warning' | 'error'; - readonly important?: 'ignore' | 'warning' | 'error'; - readonly float?: 'ignore' | 'warning' | 'error'; - readonly idSelector?: 'ignore' | 'warning' | 'error'; - }; - } - export interface ModeConfiguration { - /** - * Defines whether the built-in completionItemProvider is enabled. - */ - readonly completionItems?: boolean; - /** - * Defines whether the built-in hoverProvider is enabled. - */ - readonly hovers?: boolean; - /** - * Defines whether the built-in documentSymbolProvider is enabled. - */ - readonly documentSymbols?: boolean; - /** - * Defines whether the built-in definitions provider is enabled. - */ - readonly definitions?: boolean; - /** - * Defines whether the built-in references provider is enabled. - */ - readonly references?: boolean; - /** - * Defines whether the built-in references provider is enabled. - */ - readonly documentHighlights?: boolean; - /** - * Defines whether the built-in rename provider is enabled. - */ - readonly rename?: boolean; - /** - * Defines whether the built-in color provider is enabled. - */ - readonly colors?: boolean; - /** - * Defines whether the built-in foldingRange provider is enabled. - */ - readonly foldingRanges?: boolean; - /** - * Defines whether the built-in diagnostic provider is enabled. - */ - readonly diagnostics?: boolean; - /** - * Defines whether the built-in selection range provider is enabled. - */ - readonly selectionRanges?: boolean; - } - export interface LanguageServiceDefaults { - readonly languageId: string; - readonly onDidChange: IEvent; - readonly diagnosticsOptions: DiagnosticsOptions; - readonly modeConfiguration: ModeConfiguration; - setDiagnosticsOptions(options: DiagnosticsOptions): void; - setModeConfiguration(modeConfiguration: ModeConfiguration): void; - } - export const cssDefaults: LanguageServiceDefaults; - export const scssDefaults: LanguageServiceDefaults; - export const lessDefaults: LanguageServiceDefaults; -} - -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - - -declare namespace monaco.languages.json { - export interface DiagnosticsOptions { - /** - * If set, the validator will be enabled and perform syntax validation as well as schema based validation. - */ - readonly validate?: boolean; - /** - * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. - */ - readonly allowComments?: boolean; - /** - * A list of known schemas and/or associations of schemas to file names. - */ - readonly schemas?: { - /** - * The URI of the schema, which is also the identifier of the schema. - */ - readonly uri: string; - /** - * A list of file names that are associated to the schema. The '*' wildcard can be used. For example '*.schema.json', 'package.json' - */ - readonly fileMatch?: string[]; - /** - * The schema for the given URI. - */ - readonly schema?: any; - }[]; - /** - * If set, the schema service would load schema content on-demand with 'fetch' if available - */ - readonly enableSchemaRequest?: boolean; - /** - * The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used. - */ - readonly schemaValidation?: SeverityLevel; - /** - * The severity of problems that occurred when resolving and loading schemas. If set to 'ignore', schema resolving problems are not reported. If not set, 'warning' is used. - */ - readonly schemaRequest?: SeverityLevel; - } - export type SeverityLevel = 'error' | 'warning' | 'ignore'; - export interface ModeConfiguration { - /** - * Defines whether the built-in documentFormattingEdit provider is enabled. - */ - readonly documentFormattingEdits?: boolean; - /** - * Defines whether the built-in documentRangeFormattingEdit provider is enabled. - */ - readonly documentRangeFormattingEdits?: boolean; - /** - * Defines whether the built-in completionItemProvider is enabled. - */ - readonly completionItems?: boolean; - /** - * Defines whether the built-in hoverProvider is enabled. - */ - readonly hovers?: boolean; - /** - * Defines whether the built-in documentSymbolProvider is enabled. - */ - readonly documentSymbols?: boolean; - /** - * Defines whether the built-in tokens provider is enabled. - */ - readonly tokens?: boolean; - /** - * Defines whether the built-in color provider is enabled. - */ - readonly colors?: boolean; - /** - * Defines whether the built-in foldingRange provider is enabled. - */ - readonly foldingRanges?: boolean; - /** - * Defines whether the built-in diagnostic provider is enabled. - */ - readonly diagnostics?: boolean; - /** - * Defines whether the built-in selection range provider is enabled. - */ - readonly selectionRanges?: boolean; - } - export interface LanguageServiceDefaults { - readonly languageId: string; - readonly onDidChange: IEvent; - readonly diagnosticsOptions: DiagnosticsOptions; - readonly modeConfiguration: ModeConfiguration; - setDiagnosticsOptions(options: DiagnosticsOptions): void; - setModeConfiguration(modeConfiguration: ModeConfiguration): void; - } - export const jsonDefaults: LanguageServiceDefaults; -} - -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - - -declare namespace monaco.languages.html { - export interface HTMLFormatConfiguration { - readonly tabSize: number; - readonly insertSpaces: boolean; - readonly wrapLineLength: number; - readonly unformatted: string; - readonly contentUnformatted: string; - readonly indentInnerHtml: boolean; - readonly preserveNewLines: boolean; - readonly maxPreserveNewLines: number; - readonly indentHandlebars: boolean; - readonly endWithNewline: boolean; - readonly extraLiners: string; - readonly wrapAttributes: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline'; - } - export interface CompletionConfiguration { - [provider: string]: boolean; - } - export interface Options { - /** - * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. - */ - readonly format?: HTMLFormatConfiguration; - /** - * A list of known schemas and/or associations of schemas to file names. - */ - readonly suggest?: CompletionConfiguration; - } - export interface ModeConfiguration { - /** - * Defines whether the built-in completionItemProvider is enabled. - */ - readonly completionItems?: boolean; - /** - * Defines whether the built-in hoverProvider is enabled. - */ - readonly hovers?: boolean; - /** - * Defines whether the built-in documentSymbolProvider is enabled. - */ - readonly documentSymbols?: boolean; - /** - * Defines whether the built-in definitions provider is enabled. - */ - readonly links?: boolean; - /** - * Defines whether the built-in references provider is enabled. - */ - readonly documentHighlights?: boolean; - /** - * Defines whether the built-in rename provider is enabled. - */ - readonly rename?: boolean; - /** - * Defines whether the built-in color provider is enabled. - */ - readonly colors?: boolean; - /** - * Defines whether the built-in foldingRange provider is enabled. - */ - readonly foldingRanges?: boolean; - /** - * Defines whether the built-in diagnostic provider is enabled. - */ - readonly diagnostics?: boolean; - /** - * Defines whether the built-in selection range provider is enabled. - */ - readonly selectionRanges?: boolean; - /** - * Defines whether the built-in documentFormattingEdit provider is enabled. - */ - readonly documentFormattingEdits?: boolean; - /** - * Defines whether the built-in documentRangeFormattingEdit provider is enabled. - */ - readonly documentRangeFormattingEdits?: boolean; - } - export interface LanguageServiceDefaults { - readonly languageId: string; - readonly modeConfiguration: ModeConfiguration; - readonly onDidChange: IEvent; - readonly options: Options; - setOptions(options: Options): void; - } - export const htmlDefaults: LanguageServiceDefaults; - export const handlebarDefaults: LanguageServiceDefaults; - export const razorDefaults: LanguageServiceDefaults; -} \ No newline at end of file diff --git a/packages.json b/packages.json index b308aa6..fbcbe63 100644 --- a/packages.json +++ b/packages.json @@ -45,7 +45,7 @@ "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Antedit/README.md", "category": "Development", "author": "Xuan Sang LE", - "version": "0.2.2-b", + "version": "0.2.3-b", "dependencies": ["MonacoCore@0.33.0-r"], "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Antedit/build/release/Antedit.zip" },