diff --git a/CHANGELOG.md b/CHANGELOG.md index 87ebe658..e9c04e39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # 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) * Update monaco-typescript to TypeScript 3.5.0. diff --git a/monaco.d.ts b/monaco.d.ts index 72b35917..70470fa8 100644 --- a/monaco.d.ts +++ b/monaco.d.ts @@ -1,6 +1,6 @@ /*!----------------------------------------------------------- * 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 *-----------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------- @@ -10,6 +10,8 @@ declare namespace monaco { + // THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. + export type Thenable = PromiseLike; export interface IDisposable { @@ -32,7 +34,8 @@ declare namespace monaco { export enum MarkerTag { - Unnecessary = 1 + Unnecessary = 1, + Deprecated = 2 } export enum MarkerSeverity { @@ -458,7 +461,7 @@ declare namespace monaco { readonly 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 newColumn new column @@ -588,6 +591,14 @@ declare namespace monaco { * Test if `otherRange` is in `range`. If the ranges are equal, will return true. */ 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. * 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. */ 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 */ 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 */ darkColor?: string | ThemeColor; + } + + /** + * Options for rendering a model decoration in the overview ruler. + */ + export interface IModelDecorationOverviewRulerOptions extends IDecorationOptions { /** * The position in the overview ruler. */ 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. */ @@ -1238,6 +1273,10 @@ declare namespace monaco.editor { * If set, render this decoration in the overview ruler. */ 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. */ @@ -2460,6 +2499,11 @@ declare namespace monaco.editor { */ 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 */ @@ -2615,6 +2659,11 @@ declare namespace monaco.editor { * Defaults to true. */ 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. * Defaults to true. @@ -2883,6 +2932,10 @@ declare namespace monaco.editor { * Defaults to language defined behavior. */ autoClosingQuotes?: EditorAutoClosingStrategy; + /** + * Options for typing over closing quotes or brackets. + */ + autoClosingOvertype?: EditorAutoClosingOvertypeStrategy; /** * Options for auto surrounding. * Defaults to always allowing auto surrounding. @@ -3008,7 +3061,7 @@ declare namespace monaco.editor { * Enable rendering of whitespace. * Defaults to none. */ - renderWhitespace?: 'none' | 'boundary' | 'all'; + renderWhitespace?: 'none' | 'boundary' | 'selection' | 'all'; /** * Enable rendering of control characters. * Defaults to false. @@ -3263,6 +3316,7 @@ declare namespace monaco.editor { readonly ariaLabel: string; readonly renderLineNumbers: RenderLineNumbersType; readonly renderCustomLineNumbers: ((lineNumber: number) => string) | null; + readonly cursorSurroundingLines: number; readonly renderFinalNewline: boolean; readonly selectOnLineNumbers: boolean; readonly glyphMargin: boolean; @@ -3280,7 +3334,7 @@ declare namespace monaco.editor { readonly scrollBeyondLastColumn: number; readonly smoothScrolling: boolean; readonly stopRenderingLineAfter: number; - readonly renderWhitespace: 'none' | 'boundary' | 'all'; + readonly renderWhitespace: 'none' | 'boundary' | 'selection' | 'all'; readonly renderControlCharacters: boolean; readonly fontLigatures: boolean; readonly renderIndentGuides: boolean; @@ -3345,6 +3399,7 @@ declare namespace monaco.editor { readonly wordSeparators: string; readonly autoClosingBrackets: EditorAutoClosingStrategy; readonly autoClosingQuotes: EditorAutoClosingStrategy; + readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy; readonly autoSurround: EditorAutoSurroundStrategy; readonly autoIndent: boolean; readonly useTabStops: boolean; @@ -3486,6 +3541,7 @@ declare namespace monaco.editor { readonly wordSeparators: boolean; readonly autoClosingBrackets: boolean; readonly autoClosingQuotes: boolean; + readonly autoClosingOvertype: boolean; readonly autoSurround: boolean; readonly autoIndent: boolean; readonly useTabStops: boolean; @@ -3565,17 +3621,17 @@ declare namespace monaco.editor { * @param zone Zone to create * @return A unique identifier to the view zone. */ - addZone(zone: IViewZone): number; + addZone(zone: IViewZone): string; /** * Remove a zone * @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. * 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 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. * @param source The source of the call. @@ -4276,7 +4332,7 @@ declare namespace monaco.languages { * - f = foreground ColorId (9 bits) * - b = background ColorId (9 bits) * - 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. */ tokens: Uint32Array; @@ -4415,6 +4471,16 @@ declare namespace monaco.languages { */ 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 * a [code action](#CodeActionProvider.provideCodeActions) is run. @@ -4438,7 +4504,7 @@ declare namespace monaco.languages { /** * 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; } /** @@ -4511,7 +4577,9 @@ declare namespace monaco.languages { * * @deprecated Will be replaced by a better API soon. */ - __electricCharacterSupport?: IBracketElectricCharacterContribution; + __electricCharacterSupport?: { + docComment?: IDocComment; + }; } /** @@ -4586,10 +4654,6 @@ declare namespace monaco.languages { action: EnterAction; } - export interface IBracketElectricCharacterContribution { - docComment?: IDocComment; - } - /** * Definition of documentation comments (e.g. Javadoc/JSdoc) */ @@ -4738,6 +4802,10 @@ declare namespace monaco.languages { Snippet = 25 } + export enum CompletionItemTag { + Deprecated = 1 + } + export enum CompletionItemInsertTextRule { /** * Adjust whitespace/indentation of multiline insert texts to @@ -4766,6 +4834,11 @@ declare namespace monaco.languages { * an icon is chosen by the editor. */ kind: CompletionItemKind; + /** + * A modifier to the `kind` which affect how the item + * is rendered, e.g. Deprecated is rendered with a strikeout + */ + tags?: ReadonlyArray; /** * A human-readable string with additional information * about this item, like type or symbol information. @@ -4899,6 +4972,10 @@ declare namespace monaco.languages { isPreferred?: boolean; } + export interface CodeActionList extends IDisposable { + readonly actions: ReadonlyArray; + } + /** * Represents a parameter of a callable-signature. A parameter can * have a label and a doc-comment. @@ -4958,6 +5035,10 @@ declare namespace monaco.languages { activeParameter: number; } + export interface SignatureHelpResult extends IDisposable { + value: SignatureHelp; + } + export enum SignatureHelpTriggerKind { Invoke = 1, TriggerCharacter = 2, @@ -4981,7 +5062,7 @@ declare namespace monaco.languages { /** * Provide help for the signature at the given position and document. */ - provideSignatureHelp(model: editor.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult; + provideSignatureHelp(model: editor.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult; } /** @@ -5167,10 +5248,15 @@ declare namespace monaco.languages { TypeParameter = 25 } + export enum SymbolTag { + Deprecated = 1 + } + export interface DocumentSymbol { name: string; detail: string; kind: SymbolKind; + tags: ReadonlyArray; containerName?: string; range: IRange; selectionRange: IRange; @@ -5259,6 +5345,7 @@ declare namespace monaco.languages { export interface ILink { range: IRange; url?: Uri | string; + tooltip?: string; } export interface ILinksList { @@ -5347,7 +5434,6 @@ declare namespace monaco.languages { } export interface SelectionRange { - kind: string; range: IRange; } @@ -5454,16 +5540,21 @@ declare namespace monaco.languages { arguments?: any[]; } - export interface ICodeLensSymbol { + export interface CodeLens { range: IRange; id?: string; command?: Command; } + export interface CodeLensList { + lenses: CodeLens[]; + dispose(): void; + } + export interface CodeLensProvider { onDidChange?: IEvent; - provideCodeLenses(model: editor.ITextModel, token: CancellationToken): ProviderResult; - resolveCodeLens?(model: editor.ITextModel, codeLens: ICodeLensSymbol, token: CancellationToken): ProviderResult; + provideCodeLenses(model: editor.ITextModel, token: CancellationToken): ProviderResult; + resolveCodeLens?(model: editor.ITextModel, codeLens: CodeLens, token: CancellationToken): ProviderResult; } export interface ILanguageExtensionPoint { @@ -5611,7 +5702,11 @@ declare namespace monaco.worker { getValue(): string; } - export interface IWorkerContext { + export interface IWorkerContext { + /** + * A proxy to the main thread host object. + */ + host: H; /** * Get all available mirror models in this worker. */ diff --git a/package-lock.json b/package-lock.json index 3b98257d..0d9ade6a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "monaco-editor", - "version": "0.17.1", + "version": "0.18.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1166,7 +1166,7 @@ }, "event-stream": { "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=", "dev": true, "requires": { @@ -3061,9 +3061,9 @@ "dev": true }, "monaco-editor-core": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.17.0.tgz", - "integrity": "sha512-8q7b0itiX4UDv6e2F/EJc53G0iLL7P905IZsemu/bXffS7mIcjKKtX+TlzT13YbkuGFC/86Q32ANXERaJTM+mw==", + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.18.0.tgz", + "integrity": "sha512-URcHNAqH9X2JvO2skkIisAL4XAcZXxrDC8kcyr453sXQpOHUxicZpXHQb4/arXGvxrWvei3a6zZzpdT1gjeVJA==", "dev": true }, "monaco-html": { @@ -3073,9 +3073,9 @@ "dev": true }, "monaco-json": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-2.5.1.tgz", - "integrity": "sha512-ceOjp5qf054EAVSzGSRHPnggogAwTkyKqivlwwXM7u383l7p4x4/AmkIQb63oUW+zbLEZMXTRFrCgmIBePZwFA==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-2.6.0.tgz", + "integrity": "sha512-1yq2brOAyfCZJ0NZraXlKmP6RREbpv2pLzi+hlIqrhIbp39/QU8I0VkCVIlvdeVmvhBJudORONVlKdp3va0gCA==", "dev": true }, "monaco-languages": { diff --git a/package.json b/package.json index 439ea368..aa908fc9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "monaco-editor", "private": true, - "version": "0.17.1", + "version": "0.18.0", "description": "A browser based code editor", "author": "Microsoft Corporation", "license": "MIT", @@ -24,9 +24,9 @@ "gulp-typedoc": "^2.2.2", "http-server": "^0.11.1", "monaco-css": "2.5.0", - "monaco-editor-core": "0.17.0", + "monaco-editor-core": "0.18.0", "monaco-html": "2.5.2", - "monaco-json": "2.5.1", + "monaco-json": "2.6.0", "monaco-languages": "1.7.0", "monaco-typescript": "3.5.0", "rimraf": "^2.6.3", diff --git a/website/playground/monaco.d.ts.txt b/website/playground/monaco.d.ts.txt index 72b35917..70470fa8 100644 --- a/website/playground/monaco.d.ts.txt +++ b/website/playground/monaco.d.ts.txt @@ -1,6 +1,6 @@ /*!----------------------------------------------------------- * 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 *-----------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------- @@ -10,6 +10,8 @@ declare namespace monaco { + // THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. + export type Thenable = PromiseLike; export interface IDisposable { @@ -32,7 +34,8 @@ declare namespace monaco { export enum MarkerTag { - Unnecessary = 1 + Unnecessary = 1, + Deprecated = 2 } export enum MarkerSeverity { @@ -458,7 +461,7 @@ declare namespace monaco { readonly 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 newColumn new column @@ -588,6 +591,14 @@ declare namespace monaco { * Test if `otherRange` is in `range`. If the ranges are equal, will return true. */ 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. * 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. */ 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 */ 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 */ darkColor?: string | ThemeColor; + } + + /** + * Options for rendering a model decoration in the overview ruler. + */ + export interface IModelDecorationOverviewRulerOptions extends IDecorationOptions { /** * The position in the overview ruler. */ 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. */ @@ -1238,6 +1273,10 @@ declare namespace monaco.editor { * If set, render this decoration in the overview ruler. */ 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. */ @@ -2460,6 +2499,11 @@ declare namespace monaco.editor { */ 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 */ @@ -2615,6 +2659,11 @@ declare namespace monaco.editor { * Defaults to true. */ 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. * Defaults to true. @@ -2883,6 +2932,10 @@ declare namespace monaco.editor { * Defaults to language defined behavior. */ autoClosingQuotes?: EditorAutoClosingStrategy; + /** + * Options for typing over closing quotes or brackets. + */ + autoClosingOvertype?: EditorAutoClosingOvertypeStrategy; /** * Options for auto surrounding. * Defaults to always allowing auto surrounding. @@ -3008,7 +3061,7 @@ declare namespace monaco.editor { * Enable rendering of whitespace. * Defaults to none. */ - renderWhitespace?: 'none' | 'boundary' | 'all'; + renderWhitespace?: 'none' | 'boundary' | 'selection' | 'all'; /** * Enable rendering of control characters. * Defaults to false. @@ -3263,6 +3316,7 @@ declare namespace monaco.editor { readonly ariaLabel: string; readonly renderLineNumbers: RenderLineNumbersType; readonly renderCustomLineNumbers: ((lineNumber: number) => string) | null; + readonly cursorSurroundingLines: number; readonly renderFinalNewline: boolean; readonly selectOnLineNumbers: boolean; readonly glyphMargin: boolean; @@ -3280,7 +3334,7 @@ declare namespace monaco.editor { readonly scrollBeyondLastColumn: number; readonly smoothScrolling: boolean; readonly stopRenderingLineAfter: number; - readonly renderWhitespace: 'none' | 'boundary' | 'all'; + readonly renderWhitespace: 'none' | 'boundary' | 'selection' | 'all'; readonly renderControlCharacters: boolean; readonly fontLigatures: boolean; readonly renderIndentGuides: boolean; @@ -3345,6 +3399,7 @@ declare namespace monaco.editor { readonly wordSeparators: string; readonly autoClosingBrackets: EditorAutoClosingStrategy; readonly autoClosingQuotes: EditorAutoClosingStrategy; + readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy; readonly autoSurround: EditorAutoSurroundStrategy; readonly autoIndent: boolean; readonly useTabStops: boolean; @@ -3486,6 +3541,7 @@ declare namespace monaco.editor { readonly wordSeparators: boolean; readonly autoClosingBrackets: boolean; readonly autoClosingQuotes: boolean; + readonly autoClosingOvertype: boolean; readonly autoSurround: boolean; readonly autoIndent: boolean; readonly useTabStops: boolean; @@ -3565,17 +3621,17 @@ declare namespace monaco.editor { * @param zone Zone to create * @return A unique identifier to the view zone. */ - addZone(zone: IViewZone): number; + addZone(zone: IViewZone): string; /** * Remove a zone * @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. * 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 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. * @param source The source of the call. @@ -4276,7 +4332,7 @@ declare namespace monaco.languages { * - f = foreground ColorId (9 bits) * - b = background ColorId (9 bits) * - 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. */ tokens: Uint32Array; @@ -4415,6 +4471,16 @@ declare namespace monaco.languages { */ 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 * a [code action](#CodeActionProvider.provideCodeActions) is run. @@ -4438,7 +4504,7 @@ declare namespace monaco.languages { /** * 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; } /** @@ -4511,7 +4577,9 @@ declare namespace monaco.languages { * * @deprecated Will be replaced by a better API soon. */ - __electricCharacterSupport?: IBracketElectricCharacterContribution; + __electricCharacterSupport?: { + docComment?: IDocComment; + }; } /** @@ -4586,10 +4654,6 @@ declare namespace monaco.languages { action: EnterAction; } - export interface IBracketElectricCharacterContribution { - docComment?: IDocComment; - } - /** * Definition of documentation comments (e.g. Javadoc/JSdoc) */ @@ -4738,6 +4802,10 @@ declare namespace monaco.languages { Snippet = 25 } + export enum CompletionItemTag { + Deprecated = 1 + } + export enum CompletionItemInsertTextRule { /** * Adjust whitespace/indentation of multiline insert texts to @@ -4766,6 +4834,11 @@ declare namespace monaco.languages { * an icon is chosen by the editor. */ kind: CompletionItemKind; + /** + * A modifier to the `kind` which affect how the item + * is rendered, e.g. Deprecated is rendered with a strikeout + */ + tags?: ReadonlyArray; /** * A human-readable string with additional information * about this item, like type or symbol information. @@ -4899,6 +4972,10 @@ declare namespace monaco.languages { isPreferred?: boolean; } + export interface CodeActionList extends IDisposable { + readonly actions: ReadonlyArray; + } + /** * Represents a parameter of a callable-signature. A parameter can * have a label and a doc-comment. @@ -4958,6 +5035,10 @@ declare namespace monaco.languages { activeParameter: number; } + export interface SignatureHelpResult extends IDisposable { + value: SignatureHelp; + } + export enum SignatureHelpTriggerKind { Invoke = 1, TriggerCharacter = 2, @@ -4981,7 +5062,7 @@ declare namespace monaco.languages { /** * Provide help for the signature at the given position and document. */ - provideSignatureHelp(model: editor.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult; + provideSignatureHelp(model: editor.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult; } /** @@ -5167,10 +5248,15 @@ declare namespace monaco.languages { TypeParameter = 25 } + export enum SymbolTag { + Deprecated = 1 + } + export interface DocumentSymbol { name: string; detail: string; kind: SymbolKind; + tags: ReadonlyArray; containerName?: string; range: IRange; selectionRange: IRange; @@ -5259,6 +5345,7 @@ declare namespace monaco.languages { export interface ILink { range: IRange; url?: Uri | string; + tooltip?: string; } export interface ILinksList { @@ -5347,7 +5434,6 @@ declare namespace monaco.languages { } export interface SelectionRange { - kind: string; range: IRange; } @@ -5454,16 +5540,21 @@ declare namespace monaco.languages { arguments?: any[]; } - export interface ICodeLensSymbol { + export interface CodeLens { range: IRange; id?: string; command?: Command; } + export interface CodeLensList { + lenses: CodeLens[]; + dispose(): void; + } + export interface CodeLensProvider { onDidChange?: IEvent; - provideCodeLenses(model: editor.ITextModel, token: CancellationToken): ProviderResult; - resolveCodeLens?(model: editor.ITextModel, codeLens: ICodeLensSymbol, token: CancellationToken): ProviderResult; + provideCodeLenses(model: editor.ITextModel, token: CancellationToken): ProviderResult; + resolveCodeLens?(model: editor.ITextModel, codeLens: CodeLens, token: CancellationToken): ProviderResult; } export interface ILanguageExtensionPoint { @@ -5611,7 +5702,11 @@ declare namespace monaco.worker { getValue(): string; } - export interface IWorkerContext { + export interface IWorkerContext { + /** + * A proxy to the main thread host object. + */ + host: H; /** * Get all available mirror models in this worker. */