diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d99452e..3ac10a8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,36 @@ # Monaco Editor Changelog +## [0.26.0] (15.07.2021) + +* added support for injected text. Use `IModelDecorationOptions.before`/`after`. +* adds support for inlay hints provider. + +### Breaking Changes + +* CompletionItemLabel now has the property `label`, `detail` and `description` (instead of `name`, `parameters`, `qualifier` and `type`). + +### Thank you + +Contributions to `monaco-editor`: + +* [@anthony-c-martin (Anthony Martin)](https://github.com/anthony-c-martin): Add Bicep sample [PR #2541](https://github.com/microsoft/monaco-editor/pull/2541) + +Contributions to `monaco-languages`: + +* [@anjbur (Angela Burton)](https://github.com/anjbur): Add support for Q# [PR #142](https://github.com/microsoft/monaco-languages/pull/142) +* [@maxwrlr](https://github.com/maxwrlr): Implement Syntax-Highlighting for SPARQL [PR #145](https://github.com/microsoft/monaco-languages/pull/145) +* [@nathanrreed (Nathan Reed)](https://github.com/nathanrreed) + * fix c++ comment continuation highlighting #2497 [PR #143](https://github.com/microsoft/monaco-languages/pull/143) + * fix rust raw string highlighting #2552 [PR #146](https://github.com/microsoft/monaco-languages/pull/146) + * fix char literal highlighting #2481 [PR #147](https://github.com/microsoft/monaco-languages/pull/147) + * fix rust raw string highlighting #2086 [PR #148](https://github.com/microsoft/monaco-languages/pull/148) +* [@qwefgh90 (Changwon Choe)](https://github.com/qwefgh90): improve a rule which freeze a page in restructuredText [PR #141](https://github.com/microsoft/monaco-languages/pull/141) +* [@RubenRBS (Rubén Rincón Blanco)](https://github.com/RubenRBS): Add Swift fileprivate access modifier [PR #144](https://github.com/microsoft/monaco-languages/pull/144) + +Contributions to `monaco-typescript`: + +* [@spahnke (Sebastian Pahnke)](https://github.com/spahnke): Build tag text correctly for all tags [PR #81](https://github.com/microsoft/monaco-typescript/pull/81) + ## [0.25.2] (17.06.2021) * fixes a problem that [certain characters could not be typed on non-US keyboards](https://github.com/microsoft/monaco-editor/issues/2533). diff --git a/package-lock.json b/package-lock.json index 5198f6d3..1d08c88f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2362,39 +2362,39 @@ } }, "monaco-css": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/monaco-css/-/monaco-css-3.5.0.tgz", - "integrity": "sha512-y42LYPEAOFn9yKWDc4WWbjWUvUK9T6rISBfmDgnMujc1xholKd9OK6GVSlK3vv6nflLXH+X9MI+W36nrC1PvSQ==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/monaco-css/-/monaco-css-3.6.0.tgz", + "integrity": "sha512-tTniMGK4qif04wgrbIskGs2R+0efcmYA2aaAuFRrYEEI3VoQB9JdTpEBdlTsgIJJxCgTqD71WeFHJsTm/HIXWg==", "dev": true }, "monaco-editor-core": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.25.1.tgz", - "integrity": "sha512-QHYiTAJ8tehH/ZjmsXP/QXQaxFJBfZNgKTuUOEl2/EezSZDozBdQlgKgJZiC6cjVuuo0VaUEb06EWYaDYi2xLA==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.26.0.tgz", + "integrity": "sha512-qtZQdVUk2HeE2IMBTfBV+UNT1vNWEJ2nenfsi9pQSN/HWrUNAcpsVtaPjklUwjxw/QfuziG+h/QkL1L91S8tfg==", "dev": true }, "monaco-html": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/monaco-html/-/monaco-html-3.5.1.tgz", - "integrity": "sha512-xQo4OBS6LED7wqCbusMcrzpziicBICBZoRKNEkGFf3Fkm+f/KBC7U9eL2RI83gjZriRZrVLbea5UgEGHjNy4bg==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/monaco-html/-/monaco-html-3.6.0.tgz", + "integrity": "sha512-mXdmheB2NgtDY6KVyVTFebFED8Ddv4560+eevsAR5HwGB6FRxkCfvfaH4D8MHhAnaMdCkflhq9Je1Jhc9YMGfQ==", "dev": true }, "monaco-json": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-3.5.1.tgz", - "integrity": "sha512-kGuzmro6lAOLw++1A0iUifrbaEGATCBFMGFIE6ihPQxAdsSI6NNd5IjjrHLc/jfTm+xa82X/6NszMQ0P+uHT7Q==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-3.6.0.tgz", + "integrity": "sha512-kiw4iGozD0O99cjbA/xnbTrh/F+nnmOncdWO0kK6xXRncjDrQs9yrlRXi4evwUWdFtXpeU7P+0xvYZAFaFwwiA==", "dev": true }, "monaco-languages": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-2.5.0.tgz", - "integrity": "sha512-nwVv15bM/RJFoW/17CQ9XN8N3pzx+JEX8zNGBIpPrHpuPM47XkPzzh//MiLdEM9eoYf0xUQpbv3ZFbHqtiCu8A==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-2.6.0.tgz", + "integrity": "sha512-ZLkcX7zrY4dXs+UQ5G9nXXfNIrOSA36MySywdEeM5oh2zvXTCWmWUeWTpKSK9Gr8p+aXWdBRJkW+zrne3w+Osw==", "dev": true }, "monaco-typescript": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/monaco-typescript/-/monaco-typescript-4.5.0.tgz", - "integrity": "sha512-iZtjrWbkn4S/QHZf2niKQdbBJSpHCXkNeMNZ94mwdxn1cYazD0fQHNIfkVVzEJ3wgZ8H59YIOym5aQjVjmfccQ==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/monaco-typescript/-/monaco-typescript-4.6.0.tgz", + "integrity": "sha512-pjs1YrR1BhCjvqvdw+mZPnxbTrOBvqz1dmo1eUWxsZDGnDZTo0TBjzdVjp6wZhk2ULL9odrQvXayGTGrwqo8hA==", "dev": true }, "ms": { diff --git a/package.json b/package.json index fdf4aa58..54653697 100644 --- a/package.json +++ b/package.json @@ -22,12 +22,12 @@ "clean-css": "^5.1.1", "event-stream": "4.0.1", "gulp": "^4.0.2", - "monaco-css": "3.5.0", - "monaco-editor-core": "0.25.1", - "monaco-html": "3.5.1", - "monaco-json": "3.5.1", - "monaco-languages": "2.5.0", - "monaco-typescript": "4.5.0", + "monaco-css": "3.6.0", + "monaco-editor-core": "0.26.0", + "monaco-html": "3.6.0", + "monaco-json": "3.6.0", + "monaco-languages": "2.6.0", + "monaco-typescript": "4.6.0", "rimraf": "^3.0.2", "typedoc": "^0.20.29", "typescript": "4.2.3", diff --git a/test/playground.generated/extending-language-services-semantic-tokens-provider-example.html b/test/playground.generated/extending-language-services-semantic-tokens-provider-example.html index c7511de5..a56fd7fa 100644 --- a/test/playground.generated/extending-language-services-semantic-tokens-provider-example.html +++ b/test/playground.generated/extending-language-services-semantic-tokens-provider-example.html @@ -61,7 +61,7 @@ function getModifier(modifiers) { if (Array.isArray(modifiers)) { let nModifiers = 0; for (let modifier of modifiers) { - nModifier = legend.tokenModifiers.indexOf(modifier); + const nModifier = legend.tokenModifiers.indexOf(modifier); if (nModifier > -1) { nModifiers |= (1 << nModifier) >>> 0; } diff --git a/typedoc/monaco.d.ts b/typedoc/monaco.d.ts index 527655d0..7490189c 100644 --- a/typedoc/monaco.d.ts +++ b/typedoc/monaco.d.ts @@ -1448,6 +1448,24 @@ 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; } /** @@ -1913,6 +1931,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). */ @@ -3161,7 +3184,7 @@ declare namespace monaco.editor { matchBrackets?: 'never' | 'near' | 'always'; /** * Enable rendering of whitespace. - * Defaults to none. + * Defaults to 'selection'. */ renderWhitespace?: 'none' | 'boundary' | 'selection' | 'trailing' | 'all'; /** @@ -3738,6 +3761,7 @@ declare namespace monaco.editor { /** * The size of arrows (if displayed). * Defaults to 11. + * **NOTE**: This option cannot be updated using `updateOptions()` */ arrowSize?: number; /** @@ -3753,16 +3777,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; /** @@ -3773,6 +3800,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; /** @@ -3788,11 +3816,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; /** @@ -3823,6 +3853,13 @@ declare namespace monaco.editor { * 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 `subwordDiff` to only show ghost text if the replace text is a subword of the suggestion text and diffing should be used to compute the ghost text. + * Defaults to `prefix`. + */ + mode?: 'prefix' | 'subwordDiff'; } export type InternalInlineSuggestOptions = Readonly>; @@ -3863,6 +3900,10 @@ declare namespace monaco.editor { * Enable or disable the rendering of the suggestion preview. */ preview?: boolean; + /** + * Configures the mode of the preview. Defaults to `subwordDiff`. + */ + previewMode?: 'prefix' | 'subwordDiff'; /** * Show details inline with the label. Defaults to true. */ @@ -5343,6 +5384,11 @@ declare namespace monaco.languages { */ export function registerInlineCompletionsProvider(languageId: string, provider: InlineCompletionsProvider): IDisposable; + /** + * Register an inlay hints provider. + */ + export function registerInlayHintsProvider(languageId: string, provider: InlayHintsProvider): IDisposable; + /** * Contains additional diagnostic information about the context in which * a [code action](#CodeActionProvider.provideCodeActions) is run. @@ -5667,22 +5713,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 { diff --git a/website/playground/monaco.d.ts.txt b/website/playground/monaco.d.ts.txt index 527655d0..7490189c 100644 --- a/website/playground/monaco.d.ts.txt +++ b/website/playground/monaco.d.ts.txt @@ -1448,6 +1448,24 @@ 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; } /** @@ -1913,6 +1931,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). */ @@ -3161,7 +3184,7 @@ declare namespace monaco.editor { matchBrackets?: 'never' | 'near' | 'always'; /** * Enable rendering of whitespace. - * Defaults to none. + * Defaults to 'selection'. */ renderWhitespace?: 'none' | 'boundary' | 'selection' | 'trailing' | 'all'; /** @@ -3738,6 +3761,7 @@ declare namespace monaco.editor { /** * The size of arrows (if displayed). * Defaults to 11. + * **NOTE**: This option cannot be updated using `updateOptions()` */ arrowSize?: number; /** @@ -3753,16 +3777,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; /** @@ -3773,6 +3800,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; /** @@ -3788,11 +3816,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; /** @@ -3823,6 +3853,13 @@ declare namespace monaco.editor { * 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 `subwordDiff` to only show ghost text if the replace text is a subword of the suggestion text and diffing should be used to compute the ghost text. + * Defaults to `prefix`. + */ + mode?: 'prefix' | 'subwordDiff'; } export type InternalInlineSuggestOptions = Readonly>; @@ -3863,6 +3900,10 @@ declare namespace monaco.editor { * Enable or disable the rendering of the suggestion preview. */ preview?: boolean; + /** + * Configures the mode of the preview. Defaults to `subwordDiff`. + */ + previewMode?: 'prefix' | 'subwordDiff'; /** * Show details inline with the label. Defaults to true. */ @@ -5343,6 +5384,11 @@ declare namespace monaco.languages { */ export function registerInlineCompletionsProvider(languageId: string, provider: InlineCompletionsProvider): IDisposable; + /** + * Register an inlay hints provider. + */ + export function registerInlayHintsProvider(languageId: string, provider: InlayHintsProvider): IDisposable; + /** * Contains additional diagnostic information about the context in which * a [code action](#CodeActionProvider.provideCodeActions) is run. @@ -5667,22 +5713,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 {