This commit is contained in:
Peng Lyu 2019-09-04 11:33:44 -07:00
parent 02fb6bfd43
commit 0a4ed9a829
5 changed files with 279 additions and 63 deletions

View file

@ -1,5 +1,31 @@
# Monaco Editor Changelog # Monaco Editor Changelog
## [0.18.0] (04.09.2019)
### New & Noteworthy
* Minimap enhancement
* Selections and find results are now rendered in the minimap.
* Model decorations now support `IModelDecorationOptions.minimap`, once set the decoration will be rendered in the minimap
* New editor options
* `autoClosingOvertype`: it controls whether the editor allows [typing over closing quotes or brackets](https://github.com/microsoft/vscode/issues/37315#issuecomment-515200477).
* `cursorSurroundingLines`: it controls how many visible lines to display around the cursor while moving the cursor towards beginning or end of a file.
* `renderWhitespace: "selection"`: the editor can render whitespaces only in selection.
### API changes
* `DeclarationProvider`: The declaration provider interface defines the contract between extensions and the go to declaration feature.
* `SelectionRangeProvider` Provide smart selection ranges for the given positions, see VS Code [issue](https://github.com/microsoft/vscode/issues/67872).
* CodeLensProvider should now return `CodeLensList` instead of `ICodeLensSymbol[]`.
* `DocumentSymbol` has a new property `tags` to support more types.
* View Zone id is now `string` instead of `number`.
### Thank you
Contributions to `monaco-json`:
* [Ԝеѕ @wesinator](https://github.com/wesinator): Add .har extension [#9](https://github.com/microsoft/monaco-json/pull/9)
## [0.17.1] (25.06.2019) ## [0.17.1] (25.06.2019)
* Update monaco-typescript to TypeScript 3.5.0. * Update monaco-typescript to TypeScript 3.5.0.

147
monaco.d.ts vendored
View file

@ -1,6 +1,6 @@
/*!----------------------------------------------------------- /*!-----------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Type definitions for monaco-editor v0.17.1 * Type definitions for monaco-editor v0.18.0
* Released under the MIT license * Released under the MIT license
*-----------------------------------------------------------*/ *-----------------------------------------------------------*/
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
@ -10,6 +10,8 @@
declare namespace monaco { declare namespace monaco {
// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.
export type Thenable<T> = PromiseLike<T>; export type Thenable<T> = PromiseLike<T>;
export interface IDisposable { export interface IDisposable {
@ -32,7 +34,8 @@ declare namespace monaco {
export enum MarkerTag { export enum MarkerTag {
Unnecessary = 1 Unnecessary = 1,
Deprecated = 2
} }
export enum MarkerSeverity { export enum MarkerSeverity {
@ -458,7 +461,7 @@ declare namespace monaco {
readonly column: number; readonly column: number;
constructor(lineNumber: number, column: number); constructor(lineNumber: number, column: number);
/** /**
* Create a new postion from this position. * Create a new position from this position.
* *
* @param newLineNumber new line number * @param newLineNumber new line number
* @param newColumn new column * @param newColumn new column
@ -588,6 +591,14 @@ declare namespace monaco {
* Test if `otherRange` is in `range`. If the ranges are equal, will return true. * Test if `otherRange` is in `range`. If the ranges are equal, will return true.
*/ */
static containsRange(range: IRange, otherRange: IRange): boolean; static containsRange(range: IRange, otherRange: IRange): boolean;
/**
* Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.
*/
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.
*/
static strictContainsRange(range: IRange, otherRange: IRange): boolean;
/** /**
* A reunion of the two ranges. * A reunion of the two ranges.
* The smallest position will be used as the start point, and the largest one as the end point. * The smallest position will be used as the start point, and the largest one as the end point.
@ -991,6 +1002,10 @@ declare namespace monaco.editor {
* A label to be used to identify the web worker for debugging purposes. * A label to be used to identify the web worker for debugging purposes.
*/ */
label?: string; label?: string;
/**
* An object that can be used by the web worker to make calls back to the main thread.
*/
host?: any;
} }
/** /**
@ -1185,25 +1200,45 @@ declare namespace monaco.editor {
} }
/** /**
* Options for rendering a model decoration in the overview ruler. * Position in the minimap to render the decoration.
*/ */
export interface IModelDecorationOverviewRulerOptions { export enum MinimapPosition {
Inline = 1
}
export interface IDecorationOptions {
/** /**
* CSS color to render in the overview ruler. * CSS color to render.
* e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry * e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
*/ */
color: string | ThemeColor | undefined; color: string | ThemeColor | undefined;
/** /**
* CSS color to render in the overview ruler. * CSS color to render.
* e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry * e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
*/ */
darkColor?: string | ThemeColor; darkColor?: string | ThemeColor;
}
/**
* Options for rendering a model decoration in the overview ruler.
*/
export interface IModelDecorationOverviewRulerOptions extends IDecorationOptions {
/** /**
* The position in the overview ruler. * The position in the overview ruler.
*/ */
position: OverviewRulerLane; position: OverviewRulerLane;
} }
/**
* Options for rendering a model decoration in the overview ruler.
*/
export interface IModelDecorationMinimapOptions extends IDecorationOptions {
/**
* The position in the overview ruler.
*/
position: MinimapPosition;
}
/** /**
* Options for a model decoration. * Options for a model decoration.
*/ */
@ -1238,6 +1273,10 @@ declare namespace monaco.editor {
* If set, render this decoration in the overview ruler. * If set, render this decoration in the overview ruler.
*/ */
overviewRuler?: IModelDecorationOverviewRulerOptions | null; overviewRuler?: IModelDecorationOverviewRulerOptions | null;
/**
* If set, render this decoration in the minimap.
*/
minimap?: IModelDecorationMinimapOptions | null;
/** /**
* If set, the decoration will be rendered in the glyph margin with this CSS class name. * If set, the decoration will be rendered in the glyph margin with this CSS class name.
*/ */
@ -2460,6 +2499,11 @@ declare namespace monaco.editor {
*/ */
export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never'; export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never';
/**
* Configuration options for typing over closing quotes or brackets
*/
export type EditorAutoClosingOvertypeStrategy = 'always' | 'auto' | 'never';
/** /**
* Configuration options for editor minimap * Configuration options for editor minimap
*/ */
@ -2615,6 +2659,11 @@ declare namespace monaco.editor {
* Defaults to true. * Defaults to true.
*/ */
lineNumbers?: 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string); lineNumbers?: 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string);
/**
* Controls the minimal number of visible leading and trailing lines surrounding the cursor.
* Defaults to 0.
*/
cursorSurroundingLines?: number;
/** /**
* Render last line number when the file ends with a newline. * Render last line number when the file ends with a newline.
* Defaults to true. * Defaults to true.
@ -2883,6 +2932,10 @@ declare namespace monaco.editor {
* Defaults to language defined behavior. * Defaults to language defined behavior.
*/ */
autoClosingQuotes?: EditorAutoClosingStrategy; autoClosingQuotes?: EditorAutoClosingStrategy;
/**
* Options for typing over closing quotes or brackets.
*/
autoClosingOvertype?: EditorAutoClosingOvertypeStrategy;
/** /**
* Options for auto surrounding. * Options for auto surrounding.
* Defaults to always allowing auto surrounding. * Defaults to always allowing auto surrounding.
@ -3008,7 +3061,7 @@ declare namespace monaco.editor {
* Enable rendering of whitespace. * Enable rendering of whitespace.
* Defaults to none. * Defaults to none.
*/ */
renderWhitespace?: 'none' | 'boundary' | 'all'; renderWhitespace?: 'none' | 'boundary' | 'selection' | 'all';
/** /**
* Enable rendering of control characters. * Enable rendering of control characters.
* Defaults to false. * Defaults to false.
@ -3263,6 +3316,7 @@ declare namespace monaco.editor {
readonly ariaLabel: string; readonly ariaLabel: string;
readonly renderLineNumbers: RenderLineNumbersType; readonly renderLineNumbers: RenderLineNumbersType;
readonly renderCustomLineNumbers: ((lineNumber: number) => string) | null; readonly renderCustomLineNumbers: ((lineNumber: number) => string) | null;
readonly cursorSurroundingLines: number;
readonly renderFinalNewline: boolean; readonly renderFinalNewline: boolean;
readonly selectOnLineNumbers: boolean; readonly selectOnLineNumbers: boolean;
readonly glyphMargin: boolean; readonly glyphMargin: boolean;
@ -3280,7 +3334,7 @@ declare namespace monaco.editor {
readonly scrollBeyondLastColumn: number; readonly scrollBeyondLastColumn: number;
readonly smoothScrolling: boolean; readonly smoothScrolling: boolean;
readonly stopRenderingLineAfter: number; readonly stopRenderingLineAfter: number;
readonly renderWhitespace: 'none' | 'boundary' | 'all'; readonly renderWhitespace: 'none' | 'boundary' | 'selection' | 'all';
readonly renderControlCharacters: boolean; readonly renderControlCharacters: boolean;
readonly fontLigatures: boolean; readonly fontLigatures: boolean;
readonly renderIndentGuides: boolean; readonly renderIndentGuides: boolean;
@ -3345,6 +3399,7 @@ declare namespace monaco.editor {
readonly wordSeparators: string; readonly wordSeparators: string;
readonly autoClosingBrackets: EditorAutoClosingStrategy; readonly autoClosingBrackets: EditorAutoClosingStrategy;
readonly autoClosingQuotes: EditorAutoClosingStrategy; readonly autoClosingQuotes: EditorAutoClosingStrategy;
readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy;
readonly autoSurround: EditorAutoSurroundStrategy; readonly autoSurround: EditorAutoSurroundStrategy;
readonly autoIndent: boolean; readonly autoIndent: boolean;
readonly useTabStops: boolean; readonly useTabStops: boolean;
@ -3486,6 +3541,7 @@ declare namespace monaco.editor {
readonly wordSeparators: boolean; readonly wordSeparators: boolean;
readonly autoClosingBrackets: boolean; readonly autoClosingBrackets: boolean;
readonly autoClosingQuotes: boolean; readonly autoClosingQuotes: boolean;
readonly autoClosingOvertype: boolean;
readonly autoSurround: boolean; readonly autoSurround: boolean;
readonly autoIndent: boolean; readonly autoIndent: boolean;
readonly useTabStops: boolean; readonly useTabStops: boolean;
@ -3565,17 +3621,17 @@ declare namespace monaco.editor {
* @param zone Zone to create * @param zone Zone to create
* @return A unique identifier to the view zone. * @return A unique identifier to the view zone.
*/ */
addZone(zone: IViewZone): number; addZone(zone: IViewZone): string;
/** /**
* Remove a zone * Remove a zone
* @param id A unique identifier to the view zone, as returned by the `addZone` call. * @param id A unique identifier to the view zone, as returned by the `addZone` call.
*/ */
removeZone(id: number): void; removeZone(id: string): void;
/** /**
* Change a zone's position. * Change a zone's position.
* The editor will rescan the `afterLineNumber` and `afterColumn` properties of a view zone. * The editor will rescan the `afterLineNumber` and `afterColumn` properties of a view zone.
*/ */
layoutZone(id: number): void; layoutZone(id: string): void;
} }
/** /**
@ -4014,7 +4070,7 @@ declare namespace monaco.editor {
* @param edits The edits to execute. * @param edits The edits to execute.
* @param endCursorState Cursor state after the edits were applied. * @param endCursorState Cursor state after the edits were applied.
*/ */
executeEdits(source: string, edits: IIdentifiedSingleEditOperation[], endCursorState?: Selection[]): boolean; executeEdits(source: string, edits: IIdentifiedSingleEditOperation[], endCursorState?: ICursorStateComputer | Selection[]): boolean;
/** /**
* Execute multiple (concomitant) commands on the editor. * Execute multiple (concomitant) commands on the editor.
* @param source The source of the call. * @param source The source of the call.
@ -4276,7 +4332,7 @@ declare namespace monaco.languages {
* - f = foreground ColorId (9 bits) * - f = foreground ColorId (9 bits)
* - b = background ColorId (9 bits) * - b = background ColorId (9 bits)
* - The color value for each colorId is defined in IStandaloneThemeData.customTokenColors: * - The color value for each colorId is defined in IStandaloneThemeData.customTokenColors:
* e.g colorId = 1 is stored in IStandaloneThemeData.customTokenColors[1]. Color id = 0 means no color, * e.g. colorId = 1 is stored in IStandaloneThemeData.customTokenColors[1]. Color id = 0 means no color,
* id = 1 is for the default foreground color, id = 2 for the default background. * id = 1 is for the default foreground color, id = 2 for the default background.
*/ */
tokens: Uint32Array; tokens: Uint32Array;
@ -4415,6 +4471,16 @@ declare namespace monaco.languages {
*/ */
export function registerFoldingRangeProvider(languageId: string, provider: FoldingRangeProvider): IDisposable; export function registerFoldingRangeProvider(languageId: string, provider: FoldingRangeProvider): IDisposable;
/**
* Register a declaration provider
*/
export function registerDeclarationProvider(languageId: string, provider: DeclarationProvider): IDisposable;
/**
* Register a selection range provider
*/
export function registerSelectionRangeProvider(languageId: string, provider: SelectionRangeProvider): IDisposable;
/** /**
* Contains additional diagnostic information about the context in which * Contains additional diagnostic information about the context in which
* a [code action](#CodeActionProvider.provideCodeActions) is run. * a [code action](#CodeActionProvider.provideCodeActions) is run.
@ -4438,7 +4504,7 @@ declare namespace monaco.languages {
/** /**
* Provide commands for the given document and range. * Provide commands for the given document and range.
*/ */
provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): (Command | CodeAction)[] | Promise<(Command | CodeAction)[]>; provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): CodeActionList | Promise<CodeActionList>;
} }
/** /**
@ -4511,7 +4577,9 @@ declare namespace monaco.languages {
* *
* @deprecated Will be replaced by a better API soon. * @deprecated Will be replaced by a better API soon.
*/ */
__electricCharacterSupport?: IBracketElectricCharacterContribution; __electricCharacterSupport?: {
docComment?: IDocComment;
};
} }
/** /**
@ -4586,10 +4654,6 @@ declare namespace monaco.languages {
action: EnterAction; action: EnterAction;
} }
export interface IBracketElectricCharacterContribution {
docComment?: IDocComment;
}
/** /**
* Definition of documentation comments (e.g. Javadoc/JSdoc) * Definition of documentation comments (e.g. Javadoc/JSdoc)
*/ */
@ -4738,6 +4802,10 @@ declare namespace monaco.languages {
Snippet = 25 Snippet = 25
} }
export enum CompletionItemTag {
Deprecated = 1
}
export enum CompletionItemInsertTextRule { export enum CompletionItemInsertTextRule {
/** /**
* Adjust whitespace/indentation of multiline insert texts to * Adjust whitespace/indentation of multiline insert texts to
@ -4766,6 +4834,11 @@ declare namespace monaco.languages {
* an icon is chosen by the editor. * an icon is chosen by the editor.
*/ */
kind: CompletionItemKind; kind: CompletionItemKind;
/**
* A modifier to the `kind` which affect how the item
* is rendered, e.g. Deprecated is rendered with a strikeout
*/
tags?: ReadonlyArray<CompletionItemTag>;
/** /**
* A human-readable string with additional information * A human-readable string with additional information
* about this item, like type or symbol information. * about this item, like type or symbol information.
@ -4899,6 +4972,10 @@ declare namespace monaco.languages {
isPreferred?: boolean; isPreferred?: boolean;
} }
export interface CodeActionList extends IDisposable {
readonly actions: ReadonlyArray<CodeAction>;
}
/** /**
* Represents a parameter of a callable-signature. A parameter can * Represents a parameter of a callable-signature. A parameter can
* have a label and a doc-comment. * have a label and a doc-comment.
@ -4958,6 +5035,10 @@ declare namespace monaco.languages {
activeParameter: number; activeParameter: number;
} }
export interface SignatureHelpResult extends IDisposable {
value: SignatureHelp;
}
export enum SignatureHelpTriggerKind { export enum SignatureHelpTriggerKind {
Invoke = 1, Invoke = 1,
TriggerCharacter = 2, TriggerCharacter = 2,
@ -4981,7 +5062,7 @@ declare namespace monaco.languages {
/** /**
* Provide help for the signature at the given position and document. * Provide help for the signature at the given position and document.
*/ */
provideSignatureHelp(model: editor.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelp>; provideSignatureHelp(model: editor.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelpResult>;
} }
/** /**
@ -5167,10 +5248,15 @@ declare namespace monaco.languages {
TypeParameter = 25 TypeParameter = 25
} }
export enum SymbolTag {
Deprecated = 1
}
export interface DocumentSymbol { export interface DocumentSymbol {
name: string; name: string;
detail: string; detail: string;
kind: SymbolKind; kind: SymbolKind;
tags: ReadonlyArray<SymbolTag>;
containerName?: string; containerName?: string;
range: IRange; range: IRange;
selectionRange: IRange; selectionRange: IRange;
@ -5259,6 +5345,7 @@ declare namespace monaco.languages {
export interface ILink { export interface ILink {
range: IRange; range: IRange;
url?: Uri | string; url?: Uri | string;
tooltip?: string;
} }
export interface ILinksList { export interface ILinksList {
@ -5347,7 +5434,6 @@ declare namespace monaco.languages {
} }
export interface SelectionRange { export interface SelectionRange {
kind: string;
range: IRange; range: IRange;
} }
@ -5454,16 +5540,21 @@ declare namespace monaco.languages {
arguments?: any[]; arguments?: any[];
} }
export interface ICodeLensSymbol { export interface CodeLens {
range: IRange; range: IRange;
id?: string; id?: string;
command?: Command; command?: Command;
} }
export interface CodeLensList {
lenses: CodeLens[];
dispose(): void;
}
export interface CodeLensProvider { export interface CodeLensProvider {
onDidChange?: IEvent<this>; onDidChange?: IEvent<this>;
provideCodeLenses(model: editor.ITextModel, token: CancellationToken): ProviderResult<ICodeLensSymbol[]>; provideCodeLenses(model: editor.ITextModel, token: CancellationToken): ProviderResult<CodeLensList>;
resolveCodeLens?(model: editor.ITextModel, codeLens: ICodeLensSymbol, token: CancellationToken): ProviderResult<ICodeLensSymbol>; resolveCodeLens?(model: editor.ITextModel, codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;
} }
export interface ILanguageExtensionPoint { export interface ILanguageExtensionPoint {
@ -5611,7 +5702,11 @@ declare namespace monaco.worker {
getValue(): string; getValue(): string;
} }
export interface IWorkerContext { export interface IWorkerContext<H = undefined> {
/**
* A proxy to the main thread host object.
*/
host: H;
/** /**
* Get all available mirror models in this worker. * Get all available mirror models in this worker.
*/ */

16
package-lock.json generated
View file

@ -1,6 +1,6 @@
{ {
"name": "monaco-editor", "name": "monaco-editor",
"version": "0.17.1", "version": "0.18.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -1166,7 +1166,7 @@
}, },
"event-stream": { "event-stream": {
"version": "3.3.4", "version": "3.3.4",
"resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz",
"integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -3061,9 +3061,9 @@
"dev": true "dev": true
}, },
"monaco-editor-core": { "monaco-editor-core": {
"version": "0.17.0", "version": "0.18.0",
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.17.0.tgz", "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.18.0.tgz",
"integrity": "sha512-8q7b0itiX4UDv6e2F/EJc53G0iLL7P905IZsemu/bXffS7mIcjKKtX+TlzT13YbkuGFC/86Q32ANXERaJTM+mw==", "integrity": "sha512-URcHNAqH9X2JvO2skkIisAL4XAcZXxrDC8kcyr453sXQpOHUxicZpXHQb4/arXGvxrWvei3a6zZzpdT1gjeVJA==",
"dev": true "dev": true
}, },
"monaco-html": { "monaco-html": {
@ -3073,9 +3073,9 @@
"dev": true "dev": true
}, },
"monaco-json": { "monaco-json": {
"version": "2.5.1", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-2.5.1.tgz", "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-2.6.0.tgz",
"integrity": "sha512-ceOjp5qf054EAVSzGSRHPnggogAwTkyKqivlwwXM7u383l7p4x4/AmkIQb63oUW+zbLEZMXTRFrCgmIBePZwFA==", "integrity": "sha512-1yq2brOAyfCZJ0NZraXlKmP6RREbpv2pLzi+hlIqrhIbp39/QU8I0VkCVIlvdeVmvhBJudORONVlKdp3va0gCA==",
"dev": true "dev": true
}, },
"monaco-languages": { "monaco-languages": {

View file

@ -1,7 +1,7 @@
{ {
"name": "monaco-editor", "name": "monaco-editor",
"private": true, "private": true,
"version": "0.17.1", "version": "0.18.0",
"description": "A browser based code editor", "description": "A browser based code editor",
"author": "Microsoft Corporation", "author": "Microsoft Corporation",
"license": "MIT", "license": "MIT",
@ -24,9 +24,9 @@
"gulp-typedoc": "^2.2.2", "gulp-typedoc": "^2.2.2",
"http-server": "^0.11.1", "http-server": "^0.11.1",
"monaco-css": "2.5.0", "monaco-css": "2.5.0",
"monaco-editor-core": "0.17.0", "monaco-editor-core": "0.18.0",
"monaco-html": "2.5.2", "monaco-html": "2.5.2",
"monaco-json": "2.5.1", "monaco-json": "2.6.0",
"monaco-languages": "1.7.0", "monaco-languages": "1.7.0",
"monaco-typescript": "3.5.0", "monaco-typescript": "3.5.0",
"rimraf": "^2.6.3", "rimraf": "^2.6.3",

View file

@ -1,6 +1,6 @@
/*!----------------------------------------------------------- /*!-----------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Type definitions for monaco-editor v0.17.1 * Type definitions for monaco-editor v0.18.0
* Released under the MIT license * Released under the MIT license
*-----------------------------------------------------------*/ *-----------------------------------------------------------*/
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
@ -10,6 +10,8 @@
declare namespace monaco { declare namespace monaco {
// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.
export type Thenable<T> = PromiseLike<T>; export type Thenable<T> = PromiseLike<T>;
export interface IDisposable { export interface IDisposable {
@ -32,7 +34,8 @@ declare namespace monaco {
export enum MarkerTag { export enum MarkerTag {
Unnecessary = 1 Unnecessary = 1,
Deprecated = 2
} }
export enum MarkerSeverity { export enum MarkerSeverity {
@ -458,7 +461,7 @@ declare namespace monaco {
readonly column: number; readonly column: number;
constructor(lineNumber: number, column: number); constructor(lineNumber: number, column: number);
/** /**
* Create a new postion from this position. * Create a new position from this position.
* *
* @param newLineNumber new line number * @param newLineNumber new line number
* @param newColumn new column * @param newColumn new column
@ -588,6 +591,14 @@ declare namespace monaco {
* Test if `otherRange` is in `range`. If the ranges are equal, will return true. * Test if `otherRange` is in `range`. If the ranges are equal, will return true.
*/ */
static containsRange(range: IRange, otherRange: IRange): boolean; static containsRange(range: IRange, otherRange: IRange): boolean;
/**
* Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.
*/
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.
*/
static strictContainsRange(range: IRange, otherRange: IRange): boolean;
/** /**
* A reunion of the two ranges. * A reunion of the two ranges.
* The smallest position will be used as the start point, and the largest one as the end point. * The smallest position will be used as the start point, and the largest one as the end point.
@ -991,6 +1002,10 @@ declare namespace monaco.editor {
* A label to be used to identify the web worker for debugging purposes. * A label to be used to identify the web worker for debugging purposes.
*/ */
label?: string; label?: string;
/**
* An object that can be used by the web worker to make calls back to the main thread.
*/
host?: any;
} }
/** /**
@ -1185,25 +1200,45 @@ declare namespace monaco.editor {
} }
/** /**
* Options for rendering a model decoration in the overview ruler. * Position in the minimap to render the decoration.
*/ */
export interface IModelDecorationOverviewRulerOptions { export enum MinimapPosition {
Inline = 1
}
export interface IDecorationOptions {
/** /**
* CSS color to render in the overview ruler. * CSS color to render.
* e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry * e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
*/ */
color: string | ThemeColor | undefined; color: string | ThemeColor | undefined;
/** /**
* CSS color to render in the overview ruler. * CSS color to render.
* e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry * e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
*/ */
darkColor?: string | ThemeColor; darkColor?: string | ThemeColor;
}
/**
* Options for rendering a model decoration in the overview ruler.
*/
export interface IModelDecorationOverviewRulerOptions extends IDecorationOptions {
/** /**
* The position in the overview ruler. * The position in the overview ruler.
*/ */
position: OverviewRulerLane; position: OverviewRulerLane;
} }
/**
* Options for rendering a model decoration in the overview ruler.
*/
export interface IModelDecorationMinimapOptions extends IDecorationOptions {
/**
* The position in the overview ruler.
*/
position: MinimapPosition;
}
/** /**
* Options for a model decoration. * Options for a model decoration.
*/ */
@ -1238,6 +1273,10 @@ declare namespace monaco.editor {
* If set, render this decoration in the overview ruler. * If set, render this decoration in the overview ruler.
*/ */
overviewRuler?: IModelDecorationOverviewRulerOptions | null; overviewRuler?: IModelDecorationOverviewRulerOptions | null;
/**
* If set, render this decoration in the minimap.
*/
minimap?: IModelDecorationMinimapOptions | null;
/** /**
* If set, the decoration will be rendered in the glyph margin with this CSS class name. * If set, the decoration will be rendered in the glyph margin with this CSS class name.
*/ */
@ -2460,6 +2499,11 @@ declare namespace monaco.editor {
*/ */
export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never'; export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never';
/**
* Configuration options for typing over closing quotes or brackets
*/
export type EditorAutoClosingOvertypeStrategy = 'always' | 'auto' | 'never';
/** /**
* Configuration options for editor minimap * Configuration options for editor minimap
*/ */
@ -2615,6 +2659,11 @@ declare namespace monaco.editor {
* Defaults to true. * Defaults to true.
*/ */
lineNumbers?: 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string); lineNumbers?: 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string);
/**
* Controls the minimal number of visible leading and trailing lines surrounding the cursor.
* Defaults to 0.
*/
cursorSurroundingLines?: number;
/** /**
* Render last line number when the file ends with a newline. * Render last line number when the file ends with a newline.
* Defaults to true. * Defaults to true.
@ -2883,6 +2932,10 @@ declare namespace monaco.editor {
* Defaults to language defined behavior. * Defaults to language defined behavior.
*/ */
autoClosingQuotes?: EditorAutoClosingStrategy; autoClosingQuotes?: EditorAutoClosingStrategy;
/**
* Options for typing over closing quotes or brackets.
*/
autoClosingOvertype?: EditorAutoClosingOvertypeStrategy;
/** /**
* Options for auto surrounding. * Options for auto surrounding.
* Defaults to always allowing auto surrounding. * Defaults to always allowing auto surrounding.
@ -3008,7 +3061,7 @@ declare namespace monaco.editor {
* Enable rendering of whitespace. * Enable rendering of whitespace.
* Defaults to none. * Defaults to none.
*/ */
renderWhitespace?: 'none' | 'boundary' | 'all'; renderWhitespace?: 'none' | 'boundary' | 'selection' | 'all';
/** /**
* Enable rendering of control characters. * Enable rendering of control characters.
* Defaults to false. * Defaults to false.
@ -3263,6 +3316,7 @@ declare namespace monaco.editor {
readonly ariaLabel: string; readonly ariaLabel: string;
readonly renderLineNumbers: RenderLineNumbersType; readonly renderLineNumbers: RenderLineNumbersType;
readonly renderCustomLineNumbers: ((lineNumber: number) => string) | null; readonly renderCustomLineNumbers: ((lineNumber: number) => string) | null;
readonly cursorSurroundingLines: number;
readonly renderFinalNewline: boolean; readonly renderFinalNewline: boolean;
readonly selectOnLineNumbers: boolean; readonly selectOnLineNumbers: boolean;
readonly glyphMargin: boolean; readonly glyphMargin: boolean;
@ -3280,7 +3334,7 @@ declare namespace monaco.editor {
readonly scrollBeyondLastColumn: number; readonly scrollBeyondLastColumn: number;
readonly smoothScrolling: boolean; readonly smoothScrolling: boolean;
readonly stopRenderingLineAfter: number; readonly stopRenderingLineAfter: number;
readonly renderWhitespace: 'none' | 'boundary' | 'all'; readonly renderWhitespace: 'none' | 'boundary' | 'selection' | 'all';
readonly renderControlCharacters: boolean; readonly renderControlCharacters: boolean;
readonly fontLigatures: boolean; readonly fontLigatures: boolean;
readonly renderIndentGuides: boolean; readonly renderIndentGuides: boolean;
@ -3345,6 +3399,7 @@ declare namespace monaco.editor {
readonly wordSeparators: string; readonly wordSeparators: string;
readonly autoClosingBrackets: EditorAutoClosingStrategy; readonly autoClosingBrackets: EditorAutoClosingStrategy;
readonly autoClosingQuotes: EditorAutoClosingStrategy; readonly autoClosingQuotes: EditorAutoClosingStrategy;
readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy;
readonly autoSurround: EditorAutoSurroundStrategy; readonly autoSurround: EditorAutoSurroundStrategy;
readonly autoIndent: boolean; readonly autoIndent: boolean;
readonly useTabStops: boolean; readonly useTabStops: boolean;
@ -3486,6 +3541,7 @@ declare namespace monaco.editor {
readonly wordSeparators: boolean; readonly wordSeparators: boolean;
readonly autoClosingBrackets: boolean; readonly autoClosingBrackets: boolean;
readonly autoClosingQuotes: boolean; readonly autoClosingQuotes: boolean;
readonly autoClosingOvertype: boolean;
readonly autoSurround: boolean; readonly autoSurround: boolean;
readonly autoIndent: boolean; readonly autoIndent: boolean;
readonly useTabStops: boolean; readonly useTabStops: boolean;
@ -3565,17 +3621,17 @@ declare namespace monaco.editor {
* @param zone Zone to create * @param zone Zone to create
* @return A unique identifier to the view zone. * @return A unique identifier to the view zone.
*/ */
addZone(zone: IViewZone): number; addZone(zone: IViewZone): string;
/** /**
* Remove a zone * Remove a zone
* @param id A unique identifier to the view zone, as returned by the `addZone` call. * @param id A unique identifier to the view zone, as returned by the `addZone` call.
*/ */
removeZone(id: number): void; removeZone(id: string): void;
/** /**
* Change a zone's position. * Change a zone's position.
* The editor will rescan the `afterLineNumber` and `afterColumn` properties of a view zone. * The editor will rescan the `afterLineNumber` and `afterColumn` properties of a view zone.
*/ */
layoutZone(id: number): void; layoutZone(id: string): void;
} }
/** /**
@ -4014,7 +4070,7 @@ declare namespace monaco.editor {
* @param edits The edits to execute. * @param edits The edits to execute.
* @param endCursorState Cursor state after the edits were applied. * @param endCursorState Cursor state after the edits were applied.
*/ */
executeEdits(source: string, edits: IIdentifiedSingleEditOperation[], endCursorState?: Selection[]): boolean; executeEdits(source: string, edits: IIdentifiedSingleEditOperation[], endCursorState?: ICursorStateComputer | Selection[]): boolean;
/** /**
* Execute multiple (concomitant) commands on the editor. * Execute multiple (concomitant) commands on the editor.
* @param source The source of the call. * @param source The source of the call.
@ -4276,7 +4332,7 @@ declare namespace monaco.languages {
* - f = foreground ColorId (9 bits) * - f = foreground ColorId (9 bits)
* - b = background ColorId (9 bits) * - b = background ColorId (9 bits)
* - The color value for each colorId is defined in IStandaloneThemeData.customTokenColors: * - The color value for each colorId is defined in IStandaloneThemeData.customTokenColors:
* e.g colorId = 1 is stored in IStandaloneThemeData.customTokenColors[1]. Color id = 0 means no color, * e.g. colorId = 1 is stored in IStandaloneThemeData.customTokenColors[1]. Color id = 0 means no color,
* id = 1 is for the default foreground color, id = 2 for the default background. * id = 1 is for the default foreground color, id = 2 for the default background.
*/ */
tokens: Uint32Array; tokens: Uint32Array;
@ -4415,6 +4471,16 @@ declare namespace monaco.languages {
*/ */
export function registerFoldingRangeProvider(languageId: string, provider: FoldingRangeProvider): IDisposable; export function registerFoldingRangeProvider(languageId: string, provider: FoldingRangeProvider): IDisposable;
/**
* Register a declaration provider
*/
export function registerDeclarationProvider(languageId: string, provider: DeclarationProvider): IDisposable;
/**
* Register a selection range provider
*/
export function registerSelectionRangeProvider(languageId: string, provider: SelectionRangeProvider): IDisposable;
/** /**
* Contains additional diagnostic information about the context in which * Contains additional diagnostic information about the context in which
* a [code action](#CodeActionProvider.provideCodeActions) is run. * a [code action](#CodeActionProvider.provideCodeActions) is run.
@ -4438,7 +4504,7 @@ declare namespace monaco.languages {
/** /**
* Provide commands for the given document and range. * Provide commands for the given document and range.
*/ */
provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): (Command | CodeAction)[] | Promise<(Command | CodeAction)[]>; provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): CodeActionList | Promise<CodeActionList>;
} }
/** /**
@ -4511,7 +4577,9 @@ declare namespace monaco.languages {
* *
* @deprecated Will be replaced by a better API soon. * @deprecated Will be replaced by a better API soon.
*/ */
__electricCharacterSupport?: IBracketElectricCharacterContribution; __electricCharacterSupport?: {
docComment?: IDocComment;
};
} }
/** /**
@ -4586,10 +4654,6 @@ declare namespace monaco.languages {
action: EnterAction; action: EnterAction;
} }
export interface IBracketElectricCharacterContribution {
docComment?: IDocComment;
}
/** /**
* Definition of documentation comments (e.g. Javadoc/JSdoc) * Definition of documentation comments (e.g. Javadoc/JSdoc)
*/ */
@ -4738,6 +4802,10 @@ declare namespace monaco.languages {
Snippet = 25 Snippet = 25
} }
export enum CompletionItemTag {
Deprecated = 1
}
export enum CompletionItemInsertTextRule { export enum CompletionItemInsertTextRule {
/** /**
* Adjust whitespace/indentation of multiline insert texts to * Adjust whitespace/indentation of multiline insert texts to
@ -4766,6 +4834,11 @@ declare namespace monaco.languages {
* an icon is chosen by the editor. * an icon is chosen by the editor.
*/ */
kind: CompletionItemKind; kind: CompletionItemKind;
/**
* A modifier to the `kind` which affect how the item
* is rendered, e.g. Deprecated is rendered with a strikeout
*/
tags?: ReadonlyArray<CompletionItemTag>;
/** /**
* A human-readable string with additional information * A human-readable string with additional information
* about this item, like type or symbol information. * about this item, like type or symbol information.
@ -4899,6 +4972,10 @@ declare namespace monaco.languages {
isPreferred?: boolean; isPreferred?: boolean;
} }
export interface CodeActionList extends IDisposable {
readonly actions: ReadonlyArray<CodeAction>;
}
/** /**
* Represents a parameter of a callable-signature. A parameter can * Represents a parameter of a callable-signature. A parameter can
* have a label and a doc-comment. * have a label and a doc-comment.
@ -4958,6 +5035,10 @@ declare namespace monaco.languages {
activeParameter: number; activeParameter: number;
} }
export interface SignatureHelpResult extends IDisposable {
value: SignatureHelp;
}
export enum SignatureHelpTriggerKind { export enum SignatureHelpTriggerKind {
Invoke = 1, Invoke = 1,
TriggerCharacter = 2, TriggerCharacter = 2,
@ -4981,7 +5062,7 @@ declare namespace monaco.languages {
/** /**
* Provide help for the signature at the given position and document. * Provide help for the signature at the given position and document.
*/ */
provideSignatureHelp(model: editor.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelp>; provideSignatureHelp(model: editor.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelpResult>;
} }
/** /**
@ -5167,10 +5248,15 @@ declare namespace monaco.languages {
TypeParameter = 25 TypeParameter = 25
} }
export enum SymbolTag {
Deprecated = 1
}
export interface DocumentSymbol { export interface DocumentSymbol {
name: string; name: string;
detail: string; detail: string;
kind: SymbolKind; kind: SymbolKind;
tags: ReadonlyArray<SymbolTag>;
containerName?: string; containerName?: string;
range: IRange; range: IRange;
selectionRange: IRange; selectionRange: IRange;
@ -5259,6 +5345,7 @@ declare namespace monaco.languages {
export interface ILink { export interface ILink {
range: IRange; range: IRange;
url?: Uri | string; url?: Uri | string;
tooltip?: string;
} }
export interface ILinksList { export interface ILinksList {
@ -5347,7 +5434,6 @@ declare namespace monaco.languages {
} }
export interface SelectionRange { export interface SelectionRange {
kind: string;
range: IRange; range: IRange;
} }
@ -5454,16 +5540,21 @@ declare namespace monaco.languages {
arguments?: any[]; arguments?: any[];
} }
export interface ICodeLensSymbol { export interface CodeLens {
range: IRange; range: IRange;
id?: string; id?: string;
command?: Command; command?: Command;
} }
export interface CodeLensList {
lenses: CodeLens[];
dispose(): void;
}
export interface CodeLensProvider { export interface CodeLensProvider {
onDidChange?: IEvent<this>; onDidChange?: IEvent<this>;
provideCodeLenses(model: editor.ITextModel, token: CancellationToken): ProviderResult<ICodeLensSymbol[]>; provideCodeLenses(model: editor.ITextModel, token: CancellationToken): ProviderResult<CodeLensList>;
resolveCodeLens?(model: editor.ITextModel, codeLens: ICodeLensSymbol, token: CancellationToken): ProviderResult<ICodeLensSymbol>; resolveCodeLens?(model: editor.ITextModel, codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;
} }
export interface ILanguageExtensionPoint { export interface ILanguageExtensionPoint {
@ -5611,7 +5702,11 @@ declare namespace monaco.worker {
getValue(): string; getValue(): string;
} }
export interface IWorkerContext { export interface IWorkerContext<H = undefined> {
/**
* A proxy to the main thread host object.
*/
host: H;
/** /**
* Get all available mirror models in this worker. * Get all available mirror models in this worker.
*/ */