diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a049cb40d..2fca1696e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Monaco Editor Change log +## [0.13.0] (11.05.2018) +### New & Noteworthy +* New folding provider `registerFoldingRangeProvider`. +* You can now specifies the stack order of a decoration by setting `IModelDecorationOptions.zIndex`. A decoration with greater stack order is always in front of a decoration with a lower stack order. +* You can now tell Monaco if there is an `inlineClassName` which affects letter spacing. the stack order of a decoration by setting `IModelDecorationOptions.inlineClassNameAffectsLetterSpacing`. +* Get the text length for a certain line on text model (`ITextModel.getLineLength(lineNumber: number)`) +* New option `codeActionsOnSave`, controls whether code action kinds will be run on save. +* New option `codeActionsOnSaveTimeout`, controls timeout for running code actions on save. +* New option `multiCursorMergeOverlapping`, controls if overlapping selections should be merged. Default to `true`. + +### Breaking Change +* Removed `ICodeEditor.getCenteredRangeInViewport`. +* `RenameProvider.resolveRenameLocation` now returns `RenameLocation` instead of `IRange`. + +### Thank you +* [Sergey Romanov @Serhioromano](https://github.com/Serhioromano): Add new language Structured Text support [PR monaco-languages#32](https://github.com/Microsoft/monaco-languages/pull/32) +* [Yukai Huang @Yukaii](https://github.com/Yukaii): Fix backspace in IME composition on iOS Safari [PR vscode#40546](https://github.com/Microsoft/vscode/pull/40546) + ## [0.12.0] (11.04.2018) * Special thanks to [Tim Kendrick](https://github.com/timkendrick) for contributing a webpack plugin - `monaco-editor-webpack-plugin` - now available on [npm](https://www.npmjs.com/package/monaco-editor-webpack-plugin). diff --git a/monaco.d.ts b/monaco.d.ts index 3365d47d1a..96537b91e5 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.12.0 + * Type definitions for monaco-editor v0.13.0 * Released under the MIT license *-----------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------- @@ -1198,6 +1198,11 @@ declare namespace monaco.editor { * Should the decoration expand to encompass a whole line. */ 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. + */ + zIndex?: number; /** * If set, render this decoration in the overview ruler. */ @@ -1220,6 +1225,10 @@ declare namespace monaco.editor { * to have a background color decoration. */ inlineClassName?: string; + /** + * If there is an `inlineClassName` which affects letter spacing. + */ + inlineClassNameAffectsLetterSpacing?: boolean; /** * If set, the decoration will be rendered before the text with this CSS class name. */ @@ -1488,6 +1497,10 @@ declare namespace monaco.editor { * Get the text for a certain line. */ getLineContent(lineNumber: number): string; + /** + * Get the text length for a certain line. + */ + getLineLength(lineNumber: number): number; /** * Get the text for all lines. */ @@ -2196,6 +2209,10 @@ declare namespace monaco.editor { * The range that got replaced. */ readonly range: IRange; + /** + * The offset of the range that got replaced. + */ + readonly rangeOffset: number; /** * The length of the range that got replaced. */ @@ -2459,6 +2476,13 @@ declare namespace monaco.editor { enabled?: boolean; } + /** + * Configuration map for codeActionsOnSave + */ + export interface ICodeActionsOnSaveOptions { + [kind: string]: boolean; + } + /** * Configuration options for the editor. */ @@ -2693,6 +2717,11 @@ declare namespace monaco.editor { * Defaults to 'alt' */ multiCursorModifier?: 'ctrlCmd' | 'alt'; + /** + * Merge overlapping selections. + * Defaults to true + */ + multiCursorMergeOverlapping?: boolean; /** * Configure the editor's accessibility support. * Defaults to 'auto'. It is best to leave this to 'auto'. @@ -2806,6 +2835,14 @@ declare namespace monaco.editor { * Control the behavior and rendering of the code action lightbulb. */ lightbulb?: IEditorLightbulbOptions; + /** + * Code action kinds to be run on save. + */ + codeActionsOnSave?: ICodeActionsOnSaveOptions; + /** + * Timeout for running code actions on save. + */ + codeActionsOnSaveTimeout?: number; /** * Enable code folding * Defaults to true. @@ -3101,6 +3138,8 @@ declare namespace monaco.editor { readonly find: InternalEditorFindOptions; readonly colorDecorators: boolean; readonly lightbulbEnabled: boolean; + readonly codeActionsOnSave: ICodeActionsOnSaveOptions; + readonly codeActionsOnSaveTimeout: number; } /** @@ -3114,6 +3153,7 @@ declare namespace monaco.editor { readonly lineHeight: number; readonly readOnly: boolean; readonly multiCursorModifier: 'altKey' | 'ctrlKey' | 'metaKey'; + readonly multiCursorMergeOverlapping: boolean; readonly wordSeparators: string; readonly autoClosingBrackets: boolean; readonly autoIndent: boolean; @@ -3251,6 +3291,7 @@ declare namespace monaco.editor { readonly readOnly: boolean; readonly accessibilitySupport: boolean; readonly multiCursorModifier: boolean; + readonly multiCursorMergeOverlapping: boolean; readonly wordSeparators: boolean; readonly autoClosingBrackets: boolean; readonly autoIndent: boolean; @@ -3767,10 +3808,6 @@ declare namespace monaco.editor { * Get the layout info for the editor. */ getLayoutInfo(): EditorLayoutInfo; - /** - * Returns the range that is currently centered in the view port. - */ - getCenteredRangeInViewport(): Range; /** * Returns the ranges that are currently visible. * Does not account for horizontal scrolling. @@ -4090,8 +4127,10 @@ declare namespace monaco.languages { export function registerColorProvider(languageId: string, provider: DocumentColorProvider): IDisposable; /** - * Register a folding provider + * Register a folding range provider */ + export function registerFoldingRangeProvider(languageId: string, provider: FoldingRangeProvider): IDisposable; + /** * Contains additional diagnostic information about the context in which * a [code action](#CodeActionProvider.provideCodeActions) is run. @@ -4541,7 +4580,7 @@ declare namespace monaco.languages { * editor will use the range at the current position or the * current position itself. */ - range: IRange; + range?: IRange; } /** @@ -4985,6 +5024,60 @@ declare namespace monaco.languages { provideColorPresentations(model: editor.ITextModel, colorInfo: IColorInformation, token: CancellationToken): IColorPresentation[] | Thenable; } + export interface FoldingContext { + } + + /** + * A provider of colors for editor models. + */ + export interface FoldingRangeProvider { + /** + * Provides the color ranges for a specific model. + */ + provideFoldingRanges(model: editor.ITextModel, context: FoldingContext, token: CancellationToken): FoldingRange[] | Thenable; + } + + export interface FoldingRange { + /** + * The zero-based start line of the range to fold. The folded area starts after the line's last character. + */ + start: number; + /** + * The zero-based end line of the range to fold. The folded area ends with the line's last character. + */ + 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 + * like 'Fold all comments'. See + * [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds. + */ + kind?: FoldingRangeKind; + } + + export class FoldingRangeKind { + value: string; + /** + * Kind for folding range representing a comment. The value of the kind is 'comment'. + */ + static readonly Comment: FoldingRangeKind; + /** + * Kind for folding range representing a import. The value of the kind is 'imports'. + */ + static readonly Imports: FoldingRangeKind; + /** + * Kind for folding range representing regions (for example marked by `#region`, `#endregion`). + * The value of the kind is 'region'. + */ + static readonly Region: FoldingRangeKind; + /** + * Creates a new [FoldingRangeKind](#FoldingRangeKind). + * + * @param value of the kind. + */ + constructor(value: string); + } + export interface ResourceFileEdit { oldUri: Uri; newUri: Uri; @@ -5001,9 +5094,14 @@ declare namespace monaco.languages { rejectReason?: string; } + export interface RenameLocation { + range: IRange; + text: string; + } + export interface RenameProvider { provideRenameEdits(model: editor.ITextModel, position: Position, newName: string, token: CancellationToken): WorkspaceEdit | Thenable; - resolveRenameLocation?(model: editor.ITextModel, position: Position, token: CancellationToken): IRange | Thenable; + resolveRenameLocation?(model: editor.ITextModel, position: Position, token: CancellationToken): RenameLocation | Thenable; } export interface Command { diff --git a/package-lock.json b/package-lock.json index 6cecd00cd0..3b66e52661 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "monaco-editor", - "version": "0.12.0", + "version": "0.13.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2321,33 +2321,33 @@ } }, "monaco-css": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/monaco-css/-/monaco-css-2.1.0.tgz", - "integrity": "sha512-zJhj2ny5MZ81n1Pcuv6OhujIbZkbciuckjJ1aBFB8rgmIRSSJIMgih4jpX+N+L9Fhr+z7v6HxhbaGHOK7Ll1rA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/monaco-css/-/monaco-css-2.1.1.tgz", + "integrity": "sha512-hlgLz9dnOWmKRNU85Hl9IHrekfxA4EfSq8X5N6pcnmcmtyg4VSZpckazt8l9i+cPRGobFqpu5xCmm0XWDJz6Vw==", "dev": true }, "monaco-editor-core": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.12.0.tgz", - "integrity": "sha512-wOoEVAoZtrarDRcQC32Fp0ocacpQd6/Nb0FmUZOHeD3swZuPZhDLOxTyoNLjKq3d+h/6g+IARBLnDaLT5OQD4g==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.13.1.tgz", + "integrity": "sha512-K+cmar8dUF/YcaQXt/3PWKQxA/i7qQLLq5GBWxBKheuW9uOCi25zYInVRgZROeA+jjB6UAowqgYr7ydsbPjbFQ==", "dev": true }, "monaco-html": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/monaco-html/-/monaco-html-2.1.0.tgz", - "integrity": "sha512-bx28P9DTEEZ714OYGjZsRSbX0mHmsKXApnDB1LddHCLcH7q+svW/ikeJ15p3qeGhxHNAsArtj+Z5C5qlXKvKyA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/monaco-html/-/monaco-html-2.1.1.tgz", + "integrity": "sha512-zyEc7Gl3vdpP7ZWyMyq3YdujnDuKQedj27cHCxf6kYv8fh2CNeg+CcMEScbh6hwq3NezIUTLg4uD0Gt5vgWmDQ==", "dev": true }, "monaco-json": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-2.1.0.tgz", - "integrity": "sha512-ZEGoMLmMSo/3EstFpd1m8ggWdsNauurqnondiJj471Pmuke/sJISThKg+6i8yzFGgPSIgeA9xe229WkgXk6xyQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-2.1.1.tgz", + "integrity": "sha512-3HP9dZbXS86uKJixXAslDEfh4T5XrPd6QaQQRx43XrCUC8Y4y3QyOqsgdGMp69X2opKpBQnErmRWL0IoRx7PiA==", "dev": true }, "monaco-languages": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-1.2.0.tgz", - "integrity": "sha512-lbFxMOF2F02VGMfyD6dhoPjzYu3H4jTu2o2PDo08JjYgB3Z2lKpDiq1Ri06MjP9A59/YTnvZ3dNC7j7TqDXbQw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-1.3.1.tgz", + "integrity": "sha512-zOrUBPBUW7RenUoQocl/O5wPlPVR5Ekb4GstgeCxD8PXM5qfU2djdIgAbxIVIPgoGemrQrKKfPV093T0Ot7n4Q==", "dev": true }, "monaco-typescript": { diff --git a/package.json b/package.json index 6cf5f3d5b0..10cf7ea9bf 100644 --- a/package.json +++ b/package.json @@ -22,11 +22,11 @@ "gulp": "^3.9.1", "gulp-typedoc": "^2.0.0", "http-server": "^0.11.1", - "monaco-css": "2.1.0", - "monaco-editor-core": "0.12.0", - "monaco-html": "2.1.0", - "monaco-json": "2.1.0", - "monaco-languages": "1.2.0", + "monaco-css": "2.1.1", + "monaco-editor-core": "0.13.1", + "monaco-html": "2.1.1", + "monaco-json": "2.1.1", + "monaco-languages": "1.3.1", "monaco-typescript": "3.1.0", "rimraf": "^2.6.2", "typedoc": "^0.11.1", diff --git a/website/playground/monaco.d.ts.txt b/website/playground/monaco.d.ts.txt index 3365d47d1a..96537b91e5 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.12.0 + * Type definitions for monaco-editor v0.13.0 * Released under the MIT license *-----------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------- @@ -1198,6 +1198,11 @@ declare namespace monaco.editor { * Should the decoration expand to encompass a whole line. */ 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. + */ + zIndex?: number; /** * If set, render this decoration in the overview ruler. */ @@ -1220,6 +1225,10 @@ declare namespace monaco.editor { * to have a background color decoration. */ inlineClassName?: string; + /** + * If there is an `inlineClassName` which affects letter spacing. + */ + inlineClassNameAffectsLetterSpacing?: boolean; /** * If set, the decoration will be rendered before the text with this CSS class name. */ @@ -1488,6 +1497,10 @@ declare namespace monaco.editor { * Get the text for a certain line. */ getLineContent(lineNumber: number): string; + /** + * Get the text length for a certain line. + */ + getLineLength(lineNumber: number): number; /** * Get the text for all lines. */ @@ -2196,6 +2209,10 @@ declare namespace monaco.editor { * The range that got replaced. */ readonly range: IRange; + /** + * The offset of the range that got replaced. + */ + readonly rangeOffset: number; /** * The length of the range that got replaced. */ @@ -2459,6 +2476,13 @@ declare namespace monaco.editor { enabled?: boolean; } + /** + * Configuration map for codeActionsOnSave + */ + export interface ICodeActionsOnSaveOptions { + [kind: string]: boolean; + } + /** * Configuration options for the editor. */ @@ -2693,6 +2717,11 @@ declare namespace monaco.editor { * Defaults to 'alt' */ multiCursorModifier?: 'ctrlCmd' | 'alt'; + /** + * Merge overlapping selections. + * Defaults to true + */ + multiCursorMergeOverlapping?: boolean; /** * Configure the editor's accessibility support. * Defaults to 'auto'. It is best to leave this to 'auto'. @@ -2806,6 +2835,14 @@ declare namespace monaco.editor { * Control the behavior and rendering of the code action lightbulb. */ lightbulb?: IEditorLightbulbOptions; + /** + * Code action kinds to be run on save. + */ + codeActionsOnSave?: ICodeActionsOnSaveOptions; + /** + * Timeout for running code actions on save. + */ + codeActionsOnSaveTimeout?: number; /** * Enable code folding * Defaults to true. @@ -3101,6 +3138,8 @@ declare namespace monaco.editor { readonly find: InternalEditorFindOptions; readonly colorDecorators: boolean; readonly lightbulbEnabled: boolean; + readonly codeActionsOnSave: ICodeActionsOnSaveOptions; + readonly codeActionsOnSaveTimeout: number; } /** @@ -3114,6 +3153,7 @@ declare namespace monaco.editor { readonly lineHeight: number; readonly readOnly: boolean; readonly multiCursorModifier: 'altKey' | 'ctrlKey' | 'metaKey'; + readonly multiCursorMergeOverlapping: boolean; readonly wordSeparators: string; readonly autoClosingBrackets: boolean; readonly autoIndent: boolean; @@ -3251,6 +3291,7 @@ declare namespace monaco.editor { readonly readOnly: boolean; readonly accessibilitySupport: boolean; readonly multiCursorModifier: boolean; + readonly multiCursorMergeOverlapping: boolean; readonly wordSeparators: boolean; readonly autoClosingBrackets: boolean; readonly autoIndent: boolean; @@ -3767,10 +3808,6 @@ declare namespace monaco.editor { * Get the layout info for the editor. */ getLayoutInfo(): EditorLayoutInfo; - /** - * Returns the range that is currently centered in the view port. - */ - getCenteredRangeInViewport(): Range; /** * Returns the ranges that are currently visible. * Does not account for horizontal scrolling. @@ -4090,8 +4127,10 @@ declare namespace monaco.languages { export function registerColorProvider(languageId: string, provider: DocumentColorProvider): IDisposable; /** - * Register a folding provider + * Register a folding range provider */ + export function registerFoldingRangeProvider(languageId: string, provider: FoldingRangeProvider): IDisposable; + /** * Contains additional diagnostic information about the context in which * a [code action](#CodeActionProvider.provideCodeActions) is run. @@ -4541,7 +4580,7 @@ declare namespace monaco.languages { * editor will use the range at the current position or the * current position itself. */ - range: IRange; + range?: IRange; } /** @@ -4985,6 +5024,60 @@ declare namespace monaco.languages { provideColorPresentations(model: editor.ITextModel, colorInfo: IColorInformation, token: CancellationToken): IColorPresentation[] | Thenable; } + export interface FoldingContext { + } + + /** + * A provider of colors for editor models. + */ + export interface FoldingRangeProvider { + /** + * Provides the color ranges for a specific model. + */ + provideFoldingRanges(model: editor.ITextModel, context: FoldingContext, token: CancellationToken): FoldingRange[] | Thenable; + } + + export interface FoldingRange { + /** + * The zero-based start line of the range to fold. The folded area starts after the line's last character. + */ + start: number; + /** + * The zero-based end line of the range to fold. The folded area ends with the line's last character. + */ + 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 + * like 'Fold all comments'. See + * [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds. + */ + kind?: FoldingRangeKind; + } + + export class FoldingRangeKind { + value: string; + /** + * Kind for folding range representing a comment. The value of the kind is 'comment'. + */ + static readonly Comment: FoldingRangeKind; + /** + * Kind for folding range representing a import. The value of the kind is 'imports'. + */ + static readonly Imports: FoldingRangeKind; + /** + * Kind for folding range representing regions (for example marked by `#region`, `#endregion`). + * The value of the kind is 'region'. + */ + static readonly Region: FoldingRangeKind; + /** + * Creates a new [FoldingRangeKind](#FoldingRangeKind). + * + * @param value of the kind. + */ + constructor(value: string); + } + export interface ResourceFileEdit { oldUri: Uri; newUri: Uri; @@ -5001,9 +5094,14 @@ declare namespace monaco.languages { rejectReason?: string; } + export interface RenameLocation { + range: IRange; + text: string; + } + export interface RenameProvider { provideRenameEdits(model: editor.ITextModel, position: Position, newName: string, token: CancellationToken): WorkspaceEdit | Thenable; - resolveRenameLocation?(model: editor.ITextModel, position: Position, token: CancellationToken): IRange | Thenable; + resolveRenameLocation?(model: editor.ITextModel, position: Position, token: CancellationToken): RenameLocation | Thenable; } export interface Command {