diff --git a/CHANGELOG.md b/CHANGELOG.md index dbf9fae4..0d294706 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Monaco Editor Changelog +## [0.30.0] (04.11.2021) + +* adds support for rendering horizontal guides between bracket pairs and improves the vertical rendering to account for content in between brackets. +* adds new `hover.above` option to control the hover position. +* adds `ICodeEditor.onDidChangeHiddenAreas` which is fired when folding/unfolding. +* to address [CVE-2021-42574](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-42574), the editor now renders Unicode directional formatting characters by default. The special rendering can be turned off using `renderControlCharacters`. See https://code.visualstudio.com/updates/v1_62#_unicode-directional-formatting-characters for an explanation. + +### Breaking Changes + +* renamed enum members of `monaco.KeyCode` to align with the names given for browser codes. +* renamed `ITextModel.getModeId()` to `ITextModel.getLanguageId()` +* renamed `IPasteEvent.mode` to `IPasteEvent.languageId` + +### Thank you + +Contributions to `monaco-editor-webpack-plugin`: + +* [@silverwind](https://github.com/silverwind): Fix letter case in repo URL [PR #165](https://github.com/microsoft/monaco-editor-webpack-plugin/pull/165) + +Contributions to `monaco-languages`: + +* [@arlosi (Arlo Siemsen)](https://github.com/arlosi): Rust: highlighting raw strings and fix chars with escapes [PR #167](https://github.com/microsoft/monaco-languages/pull/167) +* [@MasterOdin (Matthew Peveler)](https://github.com/MasterOdin) + * Add new functions in postgresql 14 [PR #168](https://github.com/microsoft/monaco-languages/pull/168) + * Update json functions for postgresql [PR #169](https://github.com/microsoft/monaco-languages/pull/169) + * Add missing postgresql functions [PR #170](https://github.com/microsoft/monaco-languages/pull/170) + + ## [0.29.1] (11.10.2021) * fixes [an issue with the ESM version in DOMPurify](https://github.com/microsoft/monaco-editor/issues/2691). diff --git a/package-lock.json b/package-lock.json index d0009c1f..5f87898c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2362,39 +2362,39 @@ } }, "monaco-css": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/monaco-css/-/monaco-css-3.8.1.tgz", - "integrity": "sha512-biXG+Y7RVWY8QAXnteMafIIrqFxAvcmCsa87tWAHcNRZauY+3VjNbllBxklPAkK0T+YrZDMuq1YAAE8wKreYiA==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/monaco-css/-/monaco-css-3.9.0.tgz", + "integrity": "sha512-QTzWIIyH3hgnEtq3gZ3Aohhs02E3BU9HLHafsUg/d9cQ2b9Bx79aSd7eRgVbvy5x6NnM7ihtT9P70zbu+8Bd8g==", "dev": true }, "monaco-editor-core": { - "version": "0.29.2", - "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.29.2.tgz", - "integrity": "sha512-glydafVIfO2h7Wujb0iqbDjOK8p+Ab03xydLABcCzPzK5vy4/c3VPC1ff9+/KlZCn+0RbZHO+NZJsV2O4Y3m2A==", + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.30.0.tgz", + "integrity": "sha512-vFJ7BEOCqLv4xWgFW+UheI/PtccHHNht29lNmo79Re1kNhWCBLLb2nThjRMLPO1rd41vX9hhd9C07/iKOk9/jQ==", "dev": true }, "monaco-html": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/monaco-html/-/monaco-html-3.8.1.tgz", - "integrity": "sha512-qg5TH6HVJiQctEccsPG3r+tE0BjxcNZv6fFjT4Sr7p1c0fN92SvoDbxrjyqfzIfGsVlr76OfzPShjy1SOCHreA==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/monaco-html/-/monaco-html-3.9.0.tgz", + "integrity": "sha512-PirAgMiP8NpUAQLgh8GZOhPxzFI+EDaTJnJct+D/BHU71axvKmYyEN2P9coMcQ/26ZOml6maLQ37e+xesk4vHg==", "dev": true }, "monaco-json": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-3.8.1.tgz", - "integrity": "sha512-Uc8pSW9lljQwOznHIqVOeHaGEEjXK7ltbIjxXhkpi3XW7e/J+Sbt0JWpYjphD2EMb0MKCe2XhM8gBzRPF7lvYA==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-3.9.0.tgz", + "integrity": "sha512-Vj8wTxBH29JeqDzO8T8kgv4sk8Hbq8gxiyzmvn+92FAYh3Iba3fnTq9WjKCSR3ALRw65NjDgkFlSwkGyVjT2uA==", "dev": true }, "monaco-languages": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-2.10.0.tgz", - "integrity": "sha512-3nXXNz+hgzE1AfEuuyr54qQlmYJcdmv0mg7feWll1v1ezQYk/7Qi6vSkiEf0f5kXDYD0olpTI9zzBJujU9BQYA==", + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-2.11.1.tgz", + "integrity": "sha512-XLd6RtqCTYQ1AD7Tz/JzT/Eag/OfvjUtsetqVe6Hm+Tj01osGgnlKsjmPPfTddOIfnSsT6S3TR5aMRL57bSrJg==", "dev": true }, "monaco-typescript": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/monaco-typescript/-/monaco-typescript-4.9.1.tgz", - "integrity": "sha512-ZxvQFK40fnNg6hhkIofwyH6XzaHSmxVsI41cwSLi4eNFaP/Z58tigUJ/g9evS6Evbm67SdhxvxB4jct/tq3oXw==", + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/monaco-typescript/-/monaco-typescript-4.10.0.tgz", + "integrity": "sha512-vzd7IGCshZO05YW/Kv2V/aKU/Pn8N3RjioHPmSJzG+4E9odnTrCOP8c/iOgkl2IyRS72WReDJ7xDYtMtg8WrOQ==", "dev": true }, "ms": { diff --git a/package.json b/package.json index 9d3e088a..76402dff 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.8.1", - "monaco-editor-core": "0.29.2", - "monaco-html": "3.8.1", - "monaco-json": "3.8.1", - "monaco-languages": "2.10.0", - "monaco-typescript": "4.9.1", + "monaco-css": "3.9.0", + "monaco-editor-core": "0.30.0", + "monaco-html": "3.9.0", + "monaco-json": "3.9.0", + "monaco-languages": "2.11.1", + "monaco-typescript": "4.10.0", "rimraf": "^3.0.2", "typedoc": "^0.20.29", "typescript": "4.2.3", diff --git a/test/playground.generated/interacting-with-the-editor-adding-an-action-to-an-editor-instance.html b/test/playground.generated/interacting-with-the-editor-adding-an-action-to-an-editor-instance.html index ee799042..e8e63989 100644 --- a/test/playground.generated/interacting-with-the-editor-adding-an-action-to-an-editor-instance.html +++ b/test/playground.generated/interacting-with-the-editor-adding-an-action-to-an-editor-instance.html @@ -65,7 +65,7 @@ editor.addAction({ keybindings: [ monaco.KeyMod.CtrlCmd | monaco.KeyCode.F10, // chord - monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_K, monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_M) + monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyK, monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyM) ], // A precondition for this action. diff --git a/typedoc/monaco.d.ts b/typedoc/monaco.d.ts index b934b342..13ae66a6 100644 --- a/typedoc/monaco.d.ts +++ b/typedoc/monaco.d.ts @@ -220,7 +220,6 @@ declare namespace monaco { query: string; fragment: string; } - /** * Virtual Key Codes, the value does not hold any inherent meaning. * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx @@ -252,42 +251,42 @@ declare namespace monaco { DownArrow = 18, Insert = 19, Delete = 20, - KEY_0 = 21, - KEY_1 = 22, - KEY_2 = 23, - KEY_3 = 24, - KEY_4 = 25, - KEY_5 = 26, - KEY_6 = 27, - KEY_7 = 28, - KEY_8 = 29, - KEY_9 = 30, - KEY_A = 31, - KEY_B = 32, - KEY_C = 33, - KEY_D = 34, - KEY_E = 35, - KEY_F = 36, - KEY_G = 37, - KEY_H = 38, - KEY_I = 39, - KEY_J = 40, - KEY_K = 41, - KEY_L = 42, - KEY_M = 43, - KEY_N = 44, - KEY_O = 45, - KEY_P = 46, - KEY_Q = 47, - KEY_R = 48, - KEY_S = 49, - KEY_T = 50, - KEY_U = 51, - KEY_V = 52, - KEY_W = 53, - KEY_X = 54, - KEY_Y = 55, - KEY_Z = 56, + Digit0 = 21, + Digit1 = 22, + Digit2 = 23, + Digit3 = 24, + Digit4 = 25, + Digit5 = 26, + Digit6 = 27, + Digit7 = 28, + Digit8 = 29, + Digit9 = 30, + KeyA = 31, + KeyB = 32, + KeyC = 33, + KeyD = 34, + KeyE = 35, + KeyF = 36, + KeyG = 37, + KeyH = 38, + KeyI = 39, + KeyJ = 40, + KeyK = 41, + KeyL = 42, + KeyM = 43, + KeyN = 44, + KeyO = 45, + KeyP = 46, + KeyQ = 47, + KeyR = 48, + KeyS = 49, + KeyT = 50, + KeyU = 51, + KeyV = 52, + KeyW = 53, + KeyX = 54, + KeyY = 55, + KeyZ = 56, Meta = 57, ContextMenu = 58, F1 = 59, @@ -315,57 +314,57 @@ declare namespace monaco { * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the ';:' key */ - US_SEMICOLON = 80, + Semicolon = 80, /** * For any country/region, the '+' key * For the US standard keyboard, the '=+' key */ - US_EQUAL = 81, + Equal = 81, /** * For any country/region, the ',' key * For the US standard keyboard, the ',<' key */ - US_COMMA = 82, + Comma = 82, /** * For any country/region, the '-' key * For the US standard keyboard, the '-_' key */ - US_MINUS = 83, + Minus = 83, /** * For any country/region, the '.' key * For the US standard keyboard, the '.>' key */ - US_DOT = 84, + Period = 84, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the '/?' key */ - US_SLASH = 85, + Slash = 85, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the '`~' key */ - US_BACKTICK = 86, + Backquote = 86, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the '[{' key */ - US_OPEN_SQUARE_BRACKET = 87, + BracketLeft = 87, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the '\|' key */ - US_BACKSLASH = 88, + Backslash = 88, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the ']}' key */ - US_CLOSE_SQUARE_BRACKET = 89, + BracketRight = 89, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the ''"' key */ - US_QUOTE = 90, + Quote = 90, /** * Used for miscellaneous characters; it can vary by keyboard. */ @@ -373,34 +372,48 @@ declare namespace monaco { /** * Either the angle bracket key or the backslash key on the RT 102-key keyboard. */ - OEM_102 = 92, - NUMPAD_0 = 93, - NUMPAD_1 = 94, - NUMPAD_2 = 95, - NUMPAD_3 = 96, - NUMPAD_4 = 97, - NUMPAD_5 = 98, - NUMPAD_6 = 99, - NUMPAD_7 = 100, - NUMPAD_8 = 101, - NUMPAD_9 = 102, - NUMPAD_MULTIPLY = 103, - NUMPAD_ADD = 104, + IntlBackslash = 92, + Numpad0 = 93, + Numpad1 = 94, + Numpad2 = 95, + Numpad3 = 96, + Numpad4 = 97, + Numpad5 = 98, + Numpad6 = 99, + Numpad7 = 100, + Numpad8 = 101, + Numpad9 = 102, + NumpadMultiply = 103, + NumpadAdd = 104, NUMPAD_SEPARATOR = 105, - NUMPAD_SUBTRACT = 106, - NUMPAD_DECIMAL = 107, - NUMPAD_DIVIDE = 108, + NumpadSubtract = 106, + NumpadDecimal = 107, + NumpadDivide = 108, /** * Cover all key codes when IME is processing input. */ KEY_IN_COMPOSITION = 109, ABNT_C1 = 110, ABNT_C2 = 111, + AudioVolumeMute = 112, + AudioVolumeUp = 113, + AudioVolumeDown = 114, + BrowserSearch = 115, + BrowserHome = 116, + BrowserBack = 117, + BrowserForward = 118, + MediaTrackNext = 119, + MediaTrackPrevious = 120, + MediaStop = 121, + MediaPlayPause = 122, + LaunchMediaPlayer = 123, + LaunchMail = 124, + LaunchApp2 = 125, /** * Placed last to cover the length of the enum. * Please do not depend on this value! */ - MAX_VALUE = 112 + MAX_VALUE = 126 } export class KeyMod { static readonly CtrlCmd: number; @@ -1882,7 +1895,7 @@ declare namespace monaco.editor { /** * Get the language associated with this model. */ - getModeId(): string; + getLanguageId(): string; /** * Get the word under or besides `position`. * @param position The position to look for a word. @@ -2047,8 +2060,7 @@ declare namespace monaco.editor { */ onWillDispose(listener: () => void): IDisposable; /** - * Destroy this model. This will unbind the model from the mode - * and make all necessary clean-up to release this object to the GC. + * Destroy this model. */ dispose(): void; /** @@ -2479,7 +2491,7 @@ declare namespace monaco.editor { }; /** - * An event describing that the current mode associated with a model has changed. + * An event describing that the current language associated with a model has changed. */ export interface IModelLanguageChangedEvent { /** @@ -3219,7 +3231,7 @@ declare namespace monaco.editor { renderWhitespace?: 'none' | 'boundary' | 'selection' | 'trailing' | 'all'; /** * Enable rendering of control characters. - * Defaults to false. + * Defaults to true. */ renderControlCharacters?: boolean; /** @@ -3382,8 +3394,6 @@ declare namespace monaco.editor { ignoreEmptyLines?: boolean; } - export type EditorCommentsOptions = Readonly>; - /** * The kind of animation in which the editor's cursor should be rendered. */ @@ -3467,8 +3477,6 @@ declare namespace monaco.editor { loop?: boolean; } - export type EditorFindOptions = Readonly>; - export type GoToLocationValues = 'peek' | 'gotoAndPeek' | 'goto'; /** @@ -3488,8 +3496,6 @@ declare namespace monaco.editor { alternativeReferenceCommand?: string; } - export type GoToLocationOptions = Readonly>; - /** * Configuration options for editor hover */ @@ -3509,10 +3515,13 @@ declare namespace monaco.editor { * Defaults to true. */ sticky?: boolean; + /** + * Should the hover be shown above the line if possible? + * Defaults to false. + */ + above?: boolean; } - export type EditorHoverOptions = Readonly>; - /** * A description for the overview ruler position. */ @@ -3638,8 +3647,6 @@ declare namespace monaco.editor { enabled?: boolean; } - export type EditorLightbulbOptions = Readonly>; - /** * Configuration options for editor inlayHints */ @@ -3661,8 +3668,6 @@ declare namespace monaco.editor { fontFamily?: string; } - export type EditorInlayHintsOptions = Readonly>; - /** * Configuration options for editor minimap */ @@ -3703,8 +3708,6 @@ declare namespace monaco.editor { scale?: number; } - export type EditorMinimapOptions = Readonly>; - /** * Configuration options for editor padding */ @@ -3719,11 +3722,6 @@ declare namespace monaco.editor { bottom?: number; } - export interface InternalEditorPaddingOptions { - readonly top: number; - readonly bottom: number; - } - /** * Configuration options for parameter hints */ @@ -3740,8 +3738,6 @@ declare namespace monaco.editor { cycle?: boolean; } - export type InternalParameterHintOptions = Readonly>; - /** * Configuration options for quick suggestions */ @@ -3751,8 +3747,6 @@ declare namespace monaco.editor { strings?: boolean; } - export type ValidQuickSuggestionsOptions = boolean | Readonly>; - export type LineNumbersType = 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string); export enum RenderLineNumbersType { @@ -3882,8 +3876,6 @@ declare namespace monaco.editor { mode?: 'prefix' | 'subword' | 'subwordSmart'; } - export type InternalInlineSuggestOptions = Readonly>; - export interface IBracketPairColorizationOptions { /** * Enable or disable bracket pair colorization. @@ -3891,13 +3883,22 @@ declare namespace monaco.editor { enabled?: boolean; } - export type InternalBracketPairColorizationOptions = Readonly>; - export interface IGuidesOptions { /** * Enable rendering of bracket pair guides. + * Defaults to false. */ - bracketPairs?: boolean; + bracketPairs?: boolean | 'active'; + /** + * Enable rendering of vertical bracket pair guides. + * Defaults to 'active'. + */ + bracketPairsHorizontal?: boolean | 'active'; + /** + * Enable highlighting of the active bracket pair. + * Defaults to true. + */ + highlightActiveBracketPair?: boolean; /** * Enable rendering of indent guides. * Defaults to true. @@ -3910,8 +3911,6 @@ declare namespace monaco.editor { highlightActiveIndentation?: boolean; } - export type InternalGuidesOptions = Readonly>; - /** * Configuration options for editor suggest widget */ @@ -4070,14 +4069,10 @@ declare namespace monaco.editor { showSnippets?: boolean; } - export type InternalSuggestOptions = Readonly>; - export interface ISmartSelectOptions { selectLeadingAndTrailingWhitespace?: boolean; } - export type SmartSelectOptions = Readonly>; - /** * Describes how to indent wrapped lines. */ @@ -4240,6 +4235,7 @@ declare namespace monaco.editor { layoutInfo = 129, wrappingInfo = 130 } + export const EditorOptions: { acceptSuggestionOnCommitCharacter: IEditorOption; acceptSuggestionOnEnter: IEditorOption; @@ -4315,11 +4311,11 @@ declare namespace monaco.editor { occurrencesHighlight: IEditorOption; overviewRulerBorder: IEditorOption; overviewRulerLanes: IEditorOption; - padding: IEditorOption; + padding: IEditorOption>>; parameterHints: IEditorOption>>; peekWidgetDefaultFocus: IEditorOption; definitionLinkOpensInPeek: IEditorOption; - quickSuggestions: IEditorOption; + quickSuggestions: IEditorOption; quickSuggestionsDelay: IEditorOption; readOnly: IEditorOption; renameOnType: IEditorOption; @@ -4693,7 +4689,7 @@ declare namespace monaco.editor { */ export interface IPasteEvent { readonly range: Range; - readonly mode: string | null; + readonly languageId: string | null; } export interface IEditorConstructionOptions extends IEditorOptions { @@ -4741,47 +4737,47 @@ declare namespace monaco.editor { * An event emitted when the content of the current model has changed. * @event */ - onDidChangeModelContent(listener: (e: IModelContentChangedEvent) => void): IDisposable; + onDidChangeModelContent: IEvent; /** * An event emitted when the language of the current model has changed. * @event */ - onDidChangeModelLanguage(listener: (e: IModelLanguageChangedEvent) => void): IDisposable; + onDidChangeModelLanguage: IEvent; /** * An event emitted when the language configuration of the current model has changed. * @event */ - onDidChangeModelLanguageConfiguration(listener: (e: IModelLanguageConfigurationChangedEvent) => void): IDisposable; + onDidChangeModelLanguageConfiguration: IEvent; /** * An event emitted when the options of the current model has changed. * @event */ - onDidChangeModelOptions(listener: (e: IModelOptionsChangedEvent) => void): IDisposable; + onDidChangeModelOptions: IEvent; /** * An event emitted when the configuration of the editor has changed. (e.g. `editor.updateOptions()`) * @event */ - onDidChangeConfiguration(listener: (e: ConfigurationChangedEvent) => void): IDisposable; + onDidChangeConfiguration: IEvent; /** * An event emitted when the cursor position has changed. * @event */ - onDidChangeCursorPosition(listener: (e: ICursorPositionChangedEvent) => void): IDisposable; + onDidChangeCursorPosition: IEvent; /** * An event emitted when the cursor selection has changed. * @event */ - onDidChangeCursorSelection(listener: (e: ICursorSelectionChangedEvent) => void): IDisposable; + onDidChangeCursorSelection: IEvent; /** * An event emitted when the model of this editor has changed (e.g. `editor.setModel()`). * @event */ - onDidChangeModel(listener: (e: IModelChangedEvent) => void): IDisposable; + onDidChangeModel: IEvent; /** * An event emitted when the decorations of the current model have changed. * @event */ - onDidChangeModelDecorations(listener: (e: IModelDecorationsChangedEvent) => void): IDisposable; + onDidChangeModelDecorations: IEvent; /** * An event emitted when the text inside this editor gained focus (i.e. cursor starts blinking). * @event @@ -4819,57 +4815,62 @@ declare namespace monaco.editor { * An event emitted when users paste text in the editor. * @event */ - onDidPaste(listener: (e: IPasteEvent) => void): IDisposable; + onDidPaste: IEvent; /** * An event emitted on a "mouseup". * @event */ - onMouseUp(listener: (e: IEditorMouseEvent) => void): IDisposable; + onMouseUp: IEvent; /** * An event emitted on a "mousedown". * @event */ - onMouseDown(listener: (e: IEditorMouseEvent) => void): IDisposable; + onMouseDown: IEvent; /** * An event emitted on a "contextmenu". * @event */ - onContextMenu(listener: (e: IEditorMouseEvent) => void): IDisposable; + onContextMenu: IEvent; /** * An event emitted on a "mousemove". * @event */ - onMouseMove(listener: (e: IEditorMouseEvent) => void): IDisposable; + onMouseMove: IEvent; /** * An event emitted on a "mouseleave". * @event */ - onMouseLeave(listener: (e: IPartialEditorMouseEvent) => void): IDisposable; + onMouseLeave: IEvent; /** * An event emitted on a "keyup". * @event */ - onKeyUp(listener: (e: IKeyboardEvent) => void): IDisposable; + onKeyUp: IEvent; /** * An event emitted on a "keydown". * @event */ - onKeyDown(listener: (e: IKeyboardEvent) => void): IDisposable; + onKeyDown: IEvent; /** * An event emitted when the layout of the editor has changed. * @event */ - onDidLayoutChange(listener: (e: EditorLayoutInfo) => void): IDisposable; + onDidLayoutChange: IEvent; /** * An event emitted when the content width or content height in the editor has changed. * @event */ - onDidContentSizeChange(listener: (e: IContentSizeChangedEvent) => void): IDisposable; + onDidContentSizeChange: IEvent; /** * An event emitted when the scroll in the editor has changed. * @event */ - onDidScrollChange(listener: (e: IScrollEvent) => void): IDisposable; + onDidScrollChange: IEvent; + /** + * An event emitted when hidden areas change in the editor (e.g. due to folding). + * @event + */ + onDidChangeHiddenAreas: IEvent; /** * Saves current view state of the editor in a serializable object. */ @@ -6690,7 +6691,7 @@ declare namespace monaco.languages { } export interface InlayHintsProvider { - onDidChangeInlayHints?: IEvent | undefined; + onDidChangeInlayHints?: IEvent; provideInlayHints(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult; } diff --git a/website/playground/monaco.d.ts.txt b/website/playground/monaco.d.ts.txt index b934b342..13ae66a6 100644 --- a/website/playground/monaco.d.ts.txt +++ b/website/playground/monaco.d.ts.txt @@ -220,7 +220,6 @@ declare namespace monaco { query: string; fragment: string; } - /** * Virtual Key Codes, the value does not hold any inherent meaning. * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx @@ -252,42 +251,42 @@ declare namespace monaco { DownArrow = 18, Insert = 19, Delete = 20, - KEY_0 = 21, - KEY_1 = 22, - KEY_2 = 23, - KEY_3 = 24, - KEY_4 = 25, - KEY_5 = 26, - KEY_6 = 27, - KEY_7 = 28, - KEY_8 = 29, - KEY_9 = 30, - KEY_A = 31, - KEY_B = 32, - KEY_C = 33, - KEY_D = 34, - KEY_E = 35, - KEY_F = 36, - KEY_G = 37, - KEY_H = 38, - KEY_I = 39, - KEY_J = 40, - KEY_K = 41, - KEY_L = 42, - KEY_M = 43, - KEY_N = 44, - KEY_O = 45, - KEY_P = 46, - KEY_Q = 47, - KEY_R = 48, - KEY_S = 49, - KEY_T = 50, - KEY_U = 51, - KEY_V = 52, - KEY_W = 53, - KEY_X = 54, - KEY_Y = 55, - KEY_Z = 56, + Digit0 = 21, + Digit1 = 22, + Digit2 = 23, + Digit3 = 24, + Digit4 = 25, + Digit5 = 26, + Digit6 = 27, + Digit7 = 28, + Digit8 = 29, + Digit9 = 30, + KeyA = 31, + KeyB = 32, + KeyC = 33, + KeyD = 34, + KeyE = 35, + KeyF = 36, + KeyG = 37, + KeyH = 38, + KeyI = 39, + KeyJ = 40, + KeyK = 41, + KeyL = 42, + KeyM = 43, + KeyN = 44, + KeyO = 45, + KeyP = 46, + KeyQ = 47, + KeyR = 48, + KeyS = 49, + KeyT = 50, + KeyU = 51, + KeyV = 52, + KeyW = 53, + KeyX = 54, + KeyY = 55, + KeyZ = 56, Meta = 57, ContextMenu = 58, F1 = 59, @@ -315,57 +314,57 @@ declare namespace monaco { * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the ';:' key */ - US_SEMICOLON = 80, + Semicolon = 80, /** * For any country/region, the '+' key * For the US standard keyboard, the '=+' key */ - US_EQUAL = 81, + Equal = 81, /** * For any country/region, the ',' key * For the US standard keyboard, the ',<' key */ - US_COMMA = 82, + Comma = 82, /** * For any country/region, the '-' key * For the US standard keyboard, the '-_' key */ - US_MINUS = 83, + Minus = 83, /** * For any country/region, the '.' key * For the US standard keyboard, the '.>' key */ - US_DOT = 84, + Period = 84, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the '/?' key */ - US_SLASH = 85, + Slash = 85, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the '`~' key */ - US_BACKTICK = 86, + Backquote = 86, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the '[{' key */ - US_OPEN_SQUARE_BRACKET = 87, + BracketLeft = 87, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the '\|' key */ - US_BACKSLASH = 88, + Backslash = 88, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the ']}' key */ - US_CLOSE_SQUARE_BRACKET = 89, + BracketRight = 89, /** * Used for miscellaneous characters; it can vary by keyboard. * For the US standard keyboard, the ''"' key */ - US_QUOTE = 90, + Quote = 90, /** * Used for miscellaneous characters; it can vary by keyboard. */ @@ -373,34 +372,48 @@ declare namespace monaco { /** * Either the angle bracket key or the backslash key on the RT 102-key keyboard. */ - OEM_102 = 92, - NUMPAD_0 = 93, - NUMPAD_1 = 94, - NUMPAD_2 = 95, - NUMPAD_3 = 96, - NUMPAD_4 = 97, - NUMPAD_5 = 98, - NUMPAD_6 = 99, - NUMPAD_7 = 100, - NUMPAD_8 = 101, - NUMPAD_9 = 102, - NUMPAD_MULTIPLY = 103, - NUMPAD_ADD = 104, + IntlBackslash = 92, + Numpad0 = 93, + Numpad1 = 94, + Numpad2 = 95, + Numpad3 = 96, + Numpad4 = 97, + Numpad5 = 98, + Numpad6 = 99, + Numpad7 = 100, + Numpad8 = 101, + Numpad9 = 102, + NumpadMultiply = 103, + NumpadAdd = 104, NUMPAD_SEPARATOR = 105, - NUMPAD_SUBTRACT = 106, - NUMPAD_DECIMAL = 107, - NUMPAD_DIVIDE = 108, + NumpadSubtract = 106, + NumpadDecimal = 107, + NumpadDivide = 108, /** * Cover all key codes when IME is processing input. */ KEY_IN_COMPOSITION = 109, ABNT_C1 = 110, ABNT_C2 = 111, + AudioVolumeMute = 112, + AudioVolumeUp = 113, + AudioVolumeDown = 114, + BrowserSearch = 115, + BrowserHome = 116, + BrowserBack = 117, + BrowserForward = 118, + MediaTrackNext = 119, + MediaTrackPrevious = 120, + MediaStop = 121, + MediaPlayPause = 122, + LaunchMediaPlayer = 123, + LaunchMail = 124, + LaunchApp2 = 125, /** * Placed last to cover the length of the enum. * Please do not depend on this value! */ - MAX_VALUE = 112 + MAX_VALUE = 126 } export class KeyMod { static readonly CtrlCmd: number; @@ -1882,7 +1895,7 @@ declare namespace monaco.editor { /** * Get the language associated with this model. */ - getModeId(): string; + getLanguageId(): string; /** * Get the word under or besides `position`. * @param position The position to look for a word. @@ -2047,8 +2060,7 @@ declare namespace monaco.editor { */ onWillDispose(listener: () => void): IDisposable; /** - * Destroy this model. This will unbind the model from the mode - * and make all necessary clean-up to release this object to the GC. + * Destroy this model. */ dispose(): void; /** @@ -2479,7 +2491,7 @@ declare namespace monaco.editor { }; /** - * An event describing that the current mode associated with a model has changed. + * An event describing that the current language associated with a model has changed. */ export interface IModelLanguageChangedEvent { /** @@ -3219,7 +3231,7 @@ declare namespace monaco.editor { renderWhitespace?: 'none' | 'boundary' | 'selection' | 'trailing' | 'all'; /** * Enable rendering of control characters. - * Defaults to false. + * Defaults to true. */ renderControlCharacters?: boolean; /** @@ -3382,8 +3394,6 @@ declare namespace monaco.editor { ignoreEmptyLines?: boolean; } - export type EditorCommentsOptions = Readonly>; - /** * The kind of animation in which the editor's cursor should be rendered. */ @@ -3467,8 +3477,6 @@ declare namespace monaco.editor { loop?: boolean; } - export type EditorFindOptions = Readonly>; - export type GoToLocationValues = 'peek' | 'gotoAndPeek' | 'goto'; /** @@ -3488,8 +3496,6 @@ declare namespace monaco.editor { alternativeReferenceCommand?: string; } - export type GoToLocationOptions = Readonly>; - /** * Configuration options for editor hover */ @@ -3509,10 +3515,13 @@ declare namespace monaco.editor { * Defaults to true. */ sticky?: boolean; + /** + * Should the hover be shown above the line if possible? + * Defaults to false. + */ + above?: boolean; } - export type EditorHoverOptions = Readonly>; - /** * A description for the overview ruler position. */ @@ -3638,8 +3647,6 @@ declare namespace monaco.editor { enabled?: boolean; } - export type EditorLightbulbOptions = Readonly>; - /** * Configuration options for editor inlayHints */ @@ -3661,8 +3668,6 @@ declare namespace monaco.editor { fontFamily?: string; } - export type EditorInlayHintsOptions = Readonly>; - /** * Configuration options for editor minimap */ @@ -3703,8 +3708,6 @@ declare namespace monaco.editor { scale?: number; } - export type EditorMinimapOptions = Readonly>; - /** * Configuration options for editor padding */ @@ -3719,11 +3722,6 @@ declare namespace monaco.editor { bottom?: number; } - export interface InternalEditorPaddingOptions { - readonly top: number; - readonly bottom: number; - } - /** * Configuration options for parameter hints */ @@ -3740,8 +3738,6 @@ declare namespace monaco.editor { cycle?: boolean; } - export type InternalParameterHintOptions = Readonly>; - /** * Configuration options for quick suggestions */ @@ -3751,8 +3747,6 @@ declare namespace monaco.editor { strings?: boolean; } - export type ValidQuickSuggestionsOptions = boolean | Readonly>; - export type LineNumbersType = 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string); export enum RenderLineNumbersType { @@ -3882,8 +3876,6 @@ declare namespace monaco.editor { mode?: 'prefix' | 'subword' | 'subwordSmart'; } - export type InternalInlineSuggestOptions = Readonly>; - export interface IBracketPairColorizationOptions { /** * Enable or disable bracket pair colorization. @@ -3891,13 +3883,22 @@ declare namespace monaco.editor { enabled?: boolean; } - export type InternalBracketPairColorizationOptions = Readonly>; - export interface IGuidesOptions { /** * Enable rendering of bracket pair guides. + * Defaults to false. */ - bracketPairs?: boolean; + bracketPairs?: boolean | 'active'; + /** + * Enable rendering of vertical bracket pair guides. + * Defaults to 'active'. + */ + bracketPairsHorizontal?: boolean | 'active'; + /** + * Enable highlighting of the active bracket pair. + * Defaults to true. + */ + highlightActiveBracketPair?: boolean; /** * Enable rendering of indent guides. * Defaults to true. @@ -3910,8 +3911,6 @@ declare namespace monaco.editor { highlightActiveIndentation?: boolean; } - export type InternalGuidesOptions = Readonly>; - /** * Configuration options for editor suggest widget */ @@ -4070,14 +4069,10 @@ declare namespace monaco.editor { showSnippets?: boolean; } - export type InternalSuggestOptions = Readonly>; - export interface ISmartSelectOptions { selectLeadingAndTrailingWhitespace?: boolean; } - export type SmartSelectOptions = Readonly>; - /** * Describes how to indent wrapped lines. */ @@ -4240,6 +4235,7 @@ declare namespace monaco.editor { layoutInfo = 129, wrappingInfo = 130 } + export const EditorOptions: { acceptSuggestionOnCommitCharacter: IEditorOption; acceptSuggestionOnEnter: IEditorOption; @@ -4315,11 +4311,11 @@ declare namespace monaco.editor { occurrencesHighlight: IEditorOption; overviewRulerBorder: IEditorOption; overviewRulerLanes: IEditorOption; - padding: IEditorOption; + padding: IEditorOption>>; parameterHints: IEditorOption>>; peekWidgetDefaultFocus: IEditorOption; definitionLinkOpensInPeek: IEditorOption; - quickSuggestions: IEditorOption; + quickSuggestions: IEditorOption; quickSuggestionsDelay: IEditorOption; readOnly: IEditorOption; renameOnType: IEditorOption; @@ -4693,7 +4689,7 @@ declare namespace monaco.editor { */ export interface IPasteEvent { readonly range: Range; - readonly mode: string | null; + readonly languageId: string | null; } export interface IEditorConstructionOptions extends IEditorOptions { @@ -4741,47 +4737,47 @@ declare namespace monaco.editor { * An event emitted when the content of the current model has changed. * @event */ - onDidChangeModelContent(listener: (e: IModelContentChangedEvent) => void): IDisposable; + onDidChangeModelContent: IEvent; /** * An event emitted when the language of the current model has changed. * @event */ - onDidChangeModelLanguage(listener: (e: IModelLanguageChangedEvent) => void): IDisposable; + onDidChangeModelLanguage: IEvent; /** * An event emitted when the language configuration of the current model has changed. * @event */ - onDidChangeModelLanguageConfiguration(listener: (e: IModelLanguageConfigurationChangedEvent) => void): IDisposable; + onDidChangeModelLanguageConfiguration: IEvent; /** * An event emitted when the options of the current model has changed. * @event */ - onDidChangeModelOptions(listener: (e: IModelOptionsChangedEvent) => void): IDisposable; + onDidChangeModelOptions: IEvent; /** * An event emitted when the configuration of the editor has changed. (e.g. `editor.updateOptions()`) * @event */ - onDidChangeConfiguration(listener: (e: ConfigurationChangedEvent) => void): IDisposable; + onDidChangeConfiguration: IEvent; /** * An event emitted when the cursor position has changed. * @event */ - onDidChangeCursorPosition(listener: (e: ICursorPositionChangedEvent) => void): IDisposable; + onDidChangeCursorPosition: IEvent; /** * An event emitted when the cursor selection has changed. * @event */ - onDidChangeCursorSelection(listener: (e: ICursorSelectionChangedEvent) => void): IDisposable; + onDidChangeCursorSelection: IEvent; /** * An event emitted when the model of this editor has changed (e.g. `editor.setModel()`). * @event */ - onDidChangeModel(listener: (e: IModelChangedEvent) => void): IDisposable; + onDidChangeModel: IEvent; /** * An event emitted when the decorations of the current model have changed. * @event */ - onDidChangeModelDecorations(listener: (e: IModelDecorationsChangedEvent) => void): IDisposable; + onDidChangeModelDecorations: IEvent; /** * An event emitted when the text inside this editor gained focus (i.e. cursor starts blinking). * @event @@ -4819,57 +4815,62 @@ declare namespace monaco.editor { * An event emitted when users paste text in the editor. * @event */ - onDidPaste(listener: (e: IPasteEvent) => void): IDisposable; + onDidPaste: IEvent; /** * An event emitted on a "mouseup". * @event */ - onMouseUp(listener: (e: IEditorMouseEvent) => void): IDisposable; + onMouseUp: IEvent; /** * An event emitted on a "mousedown". * @event */ - onMouseDown(listener: (e: IEditorMouseEvent) => void): IDisposable; + onMouseDown: IEvent; /** * An event emitted on a "contextmenu". * @event */ - onContextMenu(listener: (e: IEditorMouseEvent) => void): IDisposable; + onContextMenu: IEvent; /** * An event emitted on a "mousemove". * @event */ - onMouseMove(listener: (e: IEditorMouseEvent) => void): IDisposable; + onMouseMove: IEvent; /** * An event emitted on a "mouseleave". * @event */ - onMouseLeave(listener: (e: IPartialEditorMouseEvent) => void): IDisposable; + onMouseLeave: IEvent; /** * An event emitted on a "keyup". * @event */ - onKeyUp(listener: (e: IKeyboardEvent) => void): IDisposable; + onKeyUp: IEvent; /** * An event emitted on a "keydown". * @event */ - onKeyDown(listener: (e: IKeyboardEvent) => void): IDisposable; + onKeyDown: IEvent; /** * An event emitted when the layout of the editor has changed. * @event */ - onDidLayoutChange(listener: (e: EditorLayoutInfo) => void): IDisposable; + onDidLayoutChange: IEvent; /** * An event emitted when the content width or content height in the editor has changed. * @event */ - onDidContentSizeChange(listener: (e: IContentSizeChangedEvent) => void): IDisposable; + onDidContentSizeChange: IEvent; /** * An event emitted when the scroll in the editor has changed. * @event */ - onDidScrollChange(listener: (e: IScrollEvent) => void): IDisposable; + onDidScrollChange: IEvent; + /** + * An event emitted when hidden areas change in the editor (e.g. due to folding). + * @event + */ + onDidChangeHiddenAreas: IEvent; /** * Saves current view state of the editor in a serializable object. */ @@ -6690,7 +6691,7 @@ declare namespace monaco.languages { } export interface InlayHintsProvider { - onDidChangeInlayHints?: IEvent | undefined; + onDidChangeInlayHints?: IEvent; provideInlayHints(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult; } diff --git a/website/playground/new-samples/interacting-with-the-editor/adding-an-action-to-an-editor-instance/sample.js b/website/playground/new-samples/interacting-with-the-editor/adding-an-action-to-an-editor-instance/sample.js index 8fd6e828..6d3a1106 100644 --- a/website/playground/new-samples/interacting-with-the-editor/adding-an-action-to-an-editor-instance/sample.js +++ b/website/playground/new-samples/interacting-with-the-editor/adding-an-action-to-an-editor-instance/sample.js @@ -28,7 +28,7 @@ editor.addAction({ keybindings: [ monaco.KeyMod.CtrlCmd | monaco.KeyCode.F10, // chord - monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_K, monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_M) + monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyK, monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyM) ], // A precondition for this action.