diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b0504cd..ebb30bda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,46 @@ # Monaco Editor Changelog +## [0.16.0] (05.03.2018) + +### New & Noteworthy + +* Added built-in support for AMD cross-domain web worker loading. +* Added API to remeasure fonts (`monaco.editor.remeasureFonts`) in case custom fonts are used and the editor is painted at a time when the fonts are not finished loading. +* Various editor improvements, such as an option to `renderFinalNewline`, or to have a `cursorSmoothCaretAnimation` +* Colorization support for Tcl, Pascal, Kotlin and GraphQL. + +### Breaking changes + +* We are no longer shipping WinJS.Promise, but we are shipping with a Promise shim (for IE11). +* `CompletionItem.range` is now mandatory. Most times, you can use `model.getWordUntilPosition()` to get a good range. +* `DefinitionLink` has been renamed to `LocationLink` and a couple of its fields have also been renamed. + +### Thank you + +Contributions to `monaco-editor`: + +* [Sebastián Gurin (@cancerberoSgx)](https://github.com/cancerberoSgx): fix worker paths in parcel [PR #1339](https://github.com/Microsoft/monaco-editor/pull/1339) +* [@datou0412](https://github.com/datou0412): Fix lineDecoration example css error [PR #1337](https://github.com/Microsoft/monaco-editor/pull/1337) +* [Joshua Sullivan (@jbsulli)](https://github.com/jbsulli): Fix JavaScript RegExp range closing bracket [PR #1329](https://github.com/Microsoft/monaco-editor/pull/1329) +* [Krish De Souza (@Kedstar99)](https://github.com/Kedstar99): Fixed various HTML errors with the various webpages [PR #1309](https://github.com/Microsoft/monaco-editor/pull/1309) +* [Swarnava Sengupta (@swarnava)](https://github.com/swarnava): Make copyright year dynamic [PR #1303](https://github.com/Microsoft/monaco-editor/pull/1303) + +Contributions to `monaco-languages`: + +* [alan.invents (@ALANVF)](https://github.com/ALANVF): Add Tcl support [PR #59](https://github.com/Microsoft/monaco-languages/pull/59) +* [Alessandro Fragnani (@alefragnani)](https://github.com/alefragnani): Pascal language support [PR #60](https://github.com/Microsoft/monaco-languages/pull/60) +* [Brijesh Bittu (@brijeshb42)](https://github.com/brijeshb42): Update ruby auto indentation rules [PR #58](https://github.com/Microsoft/monaco-languages/pull/58) +* [Andrew (@creativedrewy)](https://github.com/creativedrewy): Add Kotlin Language Support [PR #57](https://github.com/Microsoft/monaco-languages/pull/57) +* [Salam Elbilig (@finalfantasia)](https://github.com/finalfantasia): [clojure] Improve the regular expressions for various symbols [PR #56](https://github.com/Microsoft/monaco-languages/pull/56) +* [Neil Jones (@futurejones)](https://github.com/futurejones): Solidity - add "constructor" to main keywords [PR #55](https://github.com/Microsoft/monaco-languages/pull/55) +* [Pavel Lang (@langpavel)](https://github.com/langpavel): GraphQL language support [PR #54](https://github.com/Microsoft/monaco-languages/pull/54) +* [Samuel Helms (@samghelms)](https://github.com/samghelms): allows annotation in markdown language block headers [PR #61](https://github.com/Microsoft/monaco-languages/pull/61) + +Contributions to `monaco-typescript`: + +* [Olga Lesnikova (@Geloosa)](https://github.com/Geloosa): more safe extra lib filePath generation [PR #29](https://github.com/Microsoft/monaco-typescript/pull/29) +* [Stefan Lacatus (@stefan-lacatus)](https://github.com/stefan-lacatus): Optimize how external libs are handled and allow for custom languages [PR #30](https://github.com/Microsoft/monaco-typescript/pull/30) + ## [0.15.6] (23.11.2018) * Fixes issue with context menu (https://github.com/Microsoft/monaco-editor/issues/1199) diff --git a/monaco.d.ts b/monaco.d.ts index c6f0f9a7..3166860b 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.15.6 + * Type definitions for monaco-editor v0.16.0 * Released under the MIT license *-----------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------- @@ -26,7 +26,7 @@ declare namespace monaco { export class Emitter { constructor(); readonly event: IEvent; - fire(event?: T): void; + fire(event: T): void; dispose(): void; } @@ -42,29 +42,6 @@ declare namespace monaco { Error = 8 } - - export class Promise { - constructor(executor: (resolve: (value: T | PromiseLike) => void, reject: (reason: any) => void) => void); - - public then( - onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; - - - public static as(value: null): Promise; - public static as(value: undefined): Promise; - public static as(value: PromiseLike): PromiseLike; - public static as>(value: SomePromise): SomePromise; - public static as(value: T): Promise; - - public static join(promises: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - public static join(promises: (T | PromiseLike)[]): Promise; - - public static wrap(value: T | PromiseLike): Promise; - - public static wrapError(error: Error): Promise; - } - export class CancellationTokenSource { readonly token: CancellationToken; cancel(): void; @@ -156,7 +133,7 @@ declare namespace monaco { * * @param value A string which represents an Uri (see `Uri#toString`). */ - static parse(value: string): Uri; + static parse(value: string, _strict?: boolean): Uri; /** * Creates a new Uri from a file system path, e.g. `c:\my\files`, * `/usr/home`, or `\\server\share\some\path`. @@ -187,7 +164,7 @@ declare namespace monaco { fragment?: string; }): Uri; /** - * Creates a string presentation for this Uri. It's guaranteed that calling + * Creates a string representation for this Uri. It's guaranteed that calling * `Uri.parse` with the result of this function creates an Uri which is equal * to this Uri. * @@ -390,6 +367,7 @@ declare namespace monaco { */ MAX_VALUE = 112 } + export class KeyMod { static readonly CtrlCmd: number; static readonly Shift: number; @@ -397,12 +375,17 @@ declare namespace monaco { static readonly WinCtrl: number; static chord(firstPart: number, secondPart: number): number; } + export interface IMarkdownString { value: string; isTrusted?: boolean; + uris?: { + [href: string]: UriComponents; + }; } export interface IKeyboardEvent { + readonly _standardKeyboardEventBrand: true; readonly browserEvent: KeyboardEvent; readonly target: HTMLElement; readonly ctrlKey: boolean; @@ -491,7 +474,7 @@ declare namespace monaco { /** * Test if position `a` equals position `b` */ - static equals(a: IPosition, b: IPosition): boolean; + static equals(a: IPosition | null, b: IPosition | null): boolean; /** * Test if this position is before other position. * If the two positions are equal, the result will be false. @@ -869,8 +852,8 @@ declare namespace monaco.editor { /** * Get markers for owner and/or resource - * @returns {IMarker[]} list of markers - * @param filter + * + * @returns list of markers */ export function getModelMarkers(filter: { owner?: string; @@ -945,6 +928,11 @@ declare namespace monaco.editor { */ export function setTheme(themeName: string): void; + /** + * Clears all cached font measurements and triggers re-measurement. + */ + export function remeasureFonts(): void; + export type BuiltinTheme = 'vs' | 'vs-dark' | 'hc-black'; export interface IStandaloneThemeData { @@ -1094,13 +1082,13 @@ declare namespace monaco.editor { } export interface IStandaloneCodeEditor extends ICodeEditor { - addCommand(keybinding: number, handler: ICommandHandler, context: string): string | null; + addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null; createContextKey(key: string, defaultValue: T): IContextKey; addAction(descriptor: IActionDescriptor): IDisposable; } export interface IStandaloneDiffEditor extends IDiffEditor { - addCommand(keybinding: number, handler: ICommandHandler, context: string): string | null; + addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null; createContextKey(key: string, defaultValue: T): IContextKey; addAction(descriptor: IActionDescriptor): IDisposable; getOriginalEditor(): IStandaloneCodeEditor; @@ -1444,6 +1432,7 @@ declare namespace monaco.editor { export class TextModelResolvedOptions { _textModelResolvedOptionsBrand: void; readonly tabSize: number; + readonly indentSize: number; readonly insertSpaces: boolean; readonly defaultEOL: DefaultEndOfLine; readonly trimAutoWhitespace: boolean; @@ -1451,6 +1440,7 @@ declare namespace monaco.editor { export interface ITextModelUpdateOptions { tabSize?: number; + indentSize?: number; insertSpaces?: boolean; trimAutoWhitespace?: boolean; } @@ -1737,10 +1727,6 @@ declare namespace monaco.editor { * Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs). */ normalizeIndentation(str: string): string; - /** - * Get what is considered to be one indent (e.g. a tab character or 4 spaces, etc.). - */ - getOneIndent(): string; /** * Change the options of this model. */ @@ -1994,8 +1980,8 @@ declare namespace monaco.editor { * (Serializable) View state for the diff editor. */ export interface IDiffEditorViewState { - original: ICodeEditorViewState; - modified: ICodeEditorViewState; + original: ICodeEditorViewState | null; + modified: ICodeEditorViewState | null; } /** @@ -2286,6 +2272,7 @@ declare namespace monaco.editor { * An event describing that some ranges of lines have been tokenized (their tokens have changed). */ export interface IModelTokensChangedEvent { + readonly tokenizationSupportChanged: boolean; readonly ranges: { /** * The start of the range (inclusive) @@ -2300,6 +2287,7 @@ declare namespace monaco.editor { export interface IModelOptionsChangedEvent { readonly tabSize: boolean; + readonly indentSize: boolean; readonly insertSpaces: boolean; readonly trimAutoWhitespace: boolean; } @@ -2455,6 +2443,7 @@ declare namespace monaco.editor { * Controls if Find in Selection flag is turned on when multiple lines of text are selected in the editor. */ autoFindInSelection: boolean; + addExtraSpaceOnTop?: boolean; } /** @@ -2559,6 +2548,10 @@ declare namespace monaco.editor { * Favours words that appear close to the cursor. */ localityBonus?: boolean; + /** + * Enable using global storage for remembering suggestions. + */ + shareSuggestSelections?: boolean; } /** @@ -2599,6 +2592,11 @@ declare namespace monaco.editor { * Defaults to true. */ lineNumbers?: 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string); + /** + * Render last line number when the file ends with a newline. + * Defaults to true on Windows/Mac and to false on Linux. + */ + renderFinalNewline?: boolean; /** * Should the corresponding line be selected when clicking on the line number? * Defaults to true. @@ -2678,6 +2676,11 @@ declare namespace monaco.editor { * Defaults to false. */ mouseWheelZoom?: boolean; + /** + * Enable smooth caret animation. + * Defaults to false. + */ + cursorSmoothCaretAnimation?: boolean; /** * Control the cursor style, either 'block' or 'line'. * Defaults to 'line'. @@ -2801,6 +2804,11 @@ declare namespace monaco.editor { * Defaults to 1. */ mouseWheelScrollSensitivity?: number; + /** + * FastScrolling mulitplier speed when pressing `Alt` + * Defaults to 5. + */ + fastScrollSensitivity?: number; /** * The modifier to be used to add multiple cursors with the mouse. * Defaults to 'alt' @@ -3163,6 +3171,7 @@ declare namespace monaco.editor { readonly verticalScrollbarSize: number; readonly verticalSliderSize: number; readonly mouseWheelScrollSensitivity: number; + readonly fastScrollSensitivity: number; } export interface InternalEditorMinimapOptions { @@ -3176,6 +3185,7 @@ declare namespace monaco.editor { export interface InternalEditorFindOptions { readonly seedSearchStringFromSelection: boolean; readonly autoFindInSelection: boolean; + readonly addExtraSpaceOnTop: boolean; } export interface InternalEditorHoverOptions { @@ -3189,6 +3199,7 @@ declare namespace monaco.editor { readonly snippets: 'top' | 'bottom' | 'inline' | 'none'; readonly snippetsPreventQuickSuggestions: boolean; readonly localityBonus: boolean; + readonly shareSuggestSelections: boolean; } export interface InternalParameterHintOptions { @@ -3223,6 +3234,7 @@ declare namespace monaco.editor { readonly ariaLabel: string; readonly renderLineNumbers: RenderLineNumbersType; readonly renderCustomLineNumbers: ((lineNumber: number) => string) | null; + readonly renderFinalNewline: boolean; readonly selectOnLineNumbers: boolean; readonly glyphMargin: boolean; readonly revealHorizontalRightPadding: number; @@ -3231,6 +3243,7 @@ declare namespace monaco.editor { readonly overviewRulerBorder: boolean; readonly cursorBlinking: TextEditorCursorBlinkingStyle; readonly mouseWheelZoom: boolean; + readonly cursorSmoothCaretAnimation: boolean; readonly cursorStyle: TextEditorCursorStyle; readonly cursorWidth: number; readonly hideCursorInOverviewRuler: boolean; @@ -4048,7 +4061,7 @@ declare namespace monaco.editor { /** * Force an editor render now. */ - render(): void; + render(forceRedraw?: boolean): void; /** * Get the hit test target at coordinates `clientX` and `clientY`. * The coordinates are relative to the top-left of the viewport. @@ -4276,12 +4289,12 @@ declare namespace monaco.languages { /** * Set the tokens provider for a language (manual implementation). */ - export function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider): IDisposable; + export function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider | Thenable): IDisposable; /** * Set the tokens provider for a language (monarch implementation). */ - export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage): IDisposable; + export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage | Thenable): IDisposable; /** * Register a reference provider (used by e.g. reference search). @@ -4380,8 +4393,6 @@ declare namespace monaco.languages { export interface CodeActionContext { /** * An array of diagnostics. - * - * @readonly */ readonly markers: editor.IMarkerData[]; /** @@ -4398,7 +4409,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)[] | Thenable<(Command | CodeAction)[]>; + provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): (Command | CodeAction)[] | Promise<(Command | CodeAction)[]>; } /** @@ -4489,11 +4500,11 @@ declare namespace monaco.languages { /** * If a line matches this pattern, then **only the next line** after it should be indented once. */ - indentNextLinePattern?: RegExp; + indentNextLinePattern?: RegExp | null; /** * If a line matches this pattern, then its indentation should not be changed and it should not be evaluated against the other rules. */ - unIndentedLinePattern?: RegExp; + unIndentedLinePattern?: RegExp | null; } /** @@ -4611,10 +4622,6 @@ declare namespace monaco.languages { * Describe what to do with the indentation. */ indentAction: IndentAction; - /** - * Describe whether to outdent current line. - */ - outdentCurrentLine?: boolean; /** * Describes text to be appended after the new line and after the indentation. */ @@ -4777,7 +4784,7 @@ declare namespace monaco.languages { * *Note:* The range must be a [single line](#Range.isSingleLine) and it must * [contain](#Range.contains) the position at which completion has been [requested](#CompletionItemProvider.provideCompletionItems). */ - range?: IRange; + range: IRange; /** * An optional set of characters that when pressed while this completion is active will accept it first and * then type that character. *Note* that all commit characters should have `length=1` and that superfluous @@ -4860,6 +4867,7 @@ declare namespace monaco.languages { edit?: WorkspaceEdit; diagnostics?: editor.IMarkerData[]; kind?: string; + isPreferred?: boolean; } /** @@ -4921,16 +4929,17 @@ declare namespace monaco.languages { activeParameter: number; } - export enum SignatureHelpTriggerReason { + export enum SignatureHelpTriggerKind { Invoke = 1, TriggerCharacter = 2, ContentChange = 3 } export interface SignatureHelpContext { - readonly triggerReason: SignatureHelpTriggerReason; + readonly triggerKind: SignatureHelpTriggerKind; readonly triggerCharacter?: string; readonly isRetrigger: boolean; + readonly activeSignatureHelp?: SignatureHelp; } /** @@ -4977,7 +4986,7 @@ declare namespace monaco.languages { /** * The highlight kind, default is [text](#DocumentHighlightKind.Text). */ - kind: DocumentHighlightKind; + kind?: DocumentHighlightKind; } /** @@ -5029,20 +5038,28 @@ declare namespace monaco.languages { range: IRange; } - /** - * The definition of a symbol represented as one or many [locations](#Location). - * For most programming languages there is only one location at which a symbol is - * defined. - */ - export type Definition = Location | Location[]; - - export interface DefinitionLink { - origin?: IRange; + export interface LocationLink { + /** + * A range to select where this link originates from. + */ + originSelectionRange?: IRange; + /** + * The target uri this link points to. + */ uri: Uri; + /** + * The full range this link points to. + */ range: IRange; - selectionRange?: IRange; + /** + * A range to select this link points to. Must be contained + * in `LocationLink.range`. + */ + targetSelectionRange?: IRange; } + export type Definition = Location | Location[] | LocationLink[]; + /** * The definition provider interface defines the contract between extensions and * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition) @@ -5052,7 +5069,19 @@ declare namespace monaco.languages { /** * Provide the definition of the symbol at the given position and document. */ - provideDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; + provideDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; + } + + /** + * The definition provider interface defines the contract between extensions and + * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition) + * and peek definition features. + */ + export interface DeclarationProvider { + /** + * Provide the declaration of the symbol at the given position and document. + */ + provideDeclaration(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; } /** @@ -5063,7 +5092,7 @@ declare namespace monaco.languages { /** * Provide the implementation of the symbol at the given position and document. */ - provideImplementation(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; + provideImplementation(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; } /** @@ -5074,7 +5103,7 @@ declare namespace monaco.languages { /** * Provide the type definition of the symbol at the given position and document. */ - provideTypeDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; + provideTypeDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; } /** @@ -5135,10 +5164,6 @@ declare namespace monaco.languages { range: IRange; text: string; eol?: editor.EndOfLineSequence; - } | { - range: undefined; - text: undefined; - eol: editor.EndOfLineSequence; }; /** @@ -5202,7 +5227,7 @@ declare namespace monaco.languages { */ export interface ILink { range: IRange; - url?: string; + url?: Uri | string; } /** @@ -5285,6 +5310,18 @@ declare namespace monaco.languages { provideColorPresentations(model: editor.ITextModel, colorInfo: IColorInformation, token: CancellationToken): ProviderResult; } + export interface SelectionRange { + kind: string; + range: IRange; + } + + export interface SelectionRangeProvider { + /** + * Provide ranges that should be selected from the given position. + */ + provideSelectionRanges(model: editor.ITextModel, positions: Position[], token: CancellationToken): ProviderResult; + } + export interface FoldingContext { } @@ -5357,7 +5394,7 @@ declare namespace monaco.languages { } export interface WorkspaceEdit { - edits?: Array; + edits: Array; } export interface Rejection { @@ -5549,6 +5586,7 @@ declare namespace monaco.worker { //dtsv=2 + declare namespace monaco.languages.typescript { enum ModuleKind { diff --git a/package-lock.json b/package-lock.json index b988f234..ca10e2d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -126,7 +126,7 @@ }, "ansi-colors": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", "dev": true, "requires": { @@ -1007,7 +1007,7 @@ }, "duplexer": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", "dev": true }, @@ -1167,7 +1167,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": { @@ -2963,7 +2963,7 @@ }, "map-stream": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", "dev": true }, @@ -3090,39 +3090,39 @@ } }, "monaco-css": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/monaco-css/-/monaco-css-2.3.0.tgz", - "integrity": "sha512-LIA9osCeheJgU+b4a6RRWR7dEkSvAR4swPP3Q4jCqWOwo2L/qQCdhq9HjsU6cGH/X8rXWTRmeNNbP0wm3MoeWQ==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/monaco-css/-/monaco-css-2.5.0.tgz", + "integrity": "sha512-V5YuMysU5MbNMPlZxMfB4os/mx+nIH3emrl2zgQe7Iu77dQhODoUysd5OoZB9hzpFoRDZ/KFuEaFaib8/ziYRQ==", "dev": true }, "monaco-editor-core": { - "version": "0.15.5", - "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.15.5.tgz", - "integrity": "sha512-kM3KHRjj16cFdK5Z0EppKUu793JVMpsEesBSWlqdgrxcmjyDMXV6xK0oatPcAYp3eOfbbyjPhruxDXj85FKyIg==", + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.16.0.tgz", + "integrity": "sha512-8tm8vq0SVuQ+VXZFtPIEIronK3102SYCWe8wviWu/5TV4zlDQcf4YdzI6A4CrNqbUc46dD0ngijaKWoRSViI8g==", "dev": true }, "monaco-html": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/monaco-html/-/monaco-html-2.3.0.tgz", - "integrity": "sha512-sMRDVYqA1XC5LbGIRIr36TnPJ8ue0LOOPQAqnnk62ZG9aLFnoLJ25K8OFBcqi83qtD8vik+T1cnFWVOdtTln+w==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/monaco-html/-/monaco-html-2.5.0.tgz", + "integrity": "sha512-XPfxgoUooqJ14Zf/Xxr4lfskzzwZRhfwEGmNNeRYYfN6zC9VwBhGjAIx1OQbhtZuK/W3vmL5CLRlKQ+0NpjXJw==", "dev": true }, "monaco-json": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-2.3.0.tgz", - "integrity": "sha512-UqND3J8D1K8fI2YLWqvvIurOt+QCw7Bdv6hXL0xO/fz0poI02XhGpKRty/O27nHuYAoiMZRj7Zgn5YUypkt2qw==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-2.5.0.tgz", + "integrity": "sha512-IBt9x29L6cZ4oBFq+9iIC1uPXe1LIeJ0GigosbeCfPx+jhoucQm+3yMMFprAUIer9b1+lB8q+a6ibEUm8VYktQ==", "dev": true }, "monaco-languages": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-1.6.0.tgz", - "integrity": "sha512-LBEWj8tngYwsq4kasQr+dIhnO4xUIEN36ns+cRepWAQiXZnzcrZ84gFHXm8f4mR4tssxvHVU5Vw7xMUYro6h3g==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-1.7.0.tgz", + "integrity": "sha512-2YrYlkCF/g2H0PDt/ERax2IStaihZ17v1JkYnj2xEALYNah0pbQvGH9gXJvdVx0EpBoSRmxVnrwwM2oBWWOjSQ==", "dev": true }, "monaco-typescript": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/monaco-typescript/-/monaco-typescript-3.3.1.tgz", - "integrity": "sha512-sOnMeEgDQmwuwkcj/ElVZ7mF3d0HAiCINGWE9LyOH9wJCQNJaBqa+cSP+wnPiSWQnOshHZ+A2vsA8A7PyXls6Q==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/monaco-typescript/-/monaco-typescript-3.4.1.tgz", + "integrity": "sha512-pkuKPTvlkE6gmMEF+ZCxgI0ojl8mTsRdMZFDfKfihNiCuOsJCKIYOZ8mnDIhSToUR8rEVq7BUTGO35IwG0PIXw==", "dev": true }, "ms": { @@ -3499,7 +3499,7 @@ }, "pause-stream": { "version": "0.0.11", - "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", "dev": true, "requires": { @@ -3579,7 +3579,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true } @@ -3669,7 +3669,7 @@ }, "pretty-hrtime": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", + "resolved": "http://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", "dev": true }, @@ -4245,7 +4245,7 @@ }, "split": { "version": "0.3.3", - "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", + "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", "dev": true, "requires": { @@ -4313,7 +4313,7 @@ }, "stream-combiner": { "version": "0.0.4", - "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", "dev": true, "requires": { @@ -4354,7 +4354,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -4388,7 +4388,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, diff --git a/package.json b/package.json index 9e59ecf7..5f03d54b 100644 --- a/package.json +++ b/package.json @@ -23,12 +23,12 @@ "gulp": "^4.0.0", "gulp-typedoc": "^2.2.2", "http-server": "^0.11.1", - "monaco-css": "2.3.0", - "monaco-editor-core": "0.15.5", - "monaco-html": "2.3.0", - "monaco-json": "2.3.0", - "monaco-languages": "1.6.0", - "monaco-typescript": "3.3.1", + "monaco-css": "2.5.0", + "monaco-editor-core": "0.16.0", + "monaco-html": "2.5.0", + "monaco-json": "2.5.0", + "monaco-languages": "1.7.0", + "monaco-typescript": "3.4.1", "rimraf": "^2.6.3", "typedoc": "^0.14.2", "typescript": "^3.3.3", diff --git a/website/playground/monaco.d.ts.txt b/website/playground/monaco.d.ts.txt index c6f0f9a7..3166860b 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.15.6 + * Type definitions for monaco-editor v0.16.0 * Released under the MIT license *-----------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------- @@ -26,7 +26,7 @@ declare namespace monaco { export class Emitter { constructor(); readonly event: IEvent; - fire(event?: T): void; + fire(event: T): void; dispose(): void; } @@ -42,29 +42,6 @@ declare namespace monaco { Error = 8 } - - export class Promise { - constructor(executor: (resolve: (value: T | PromiseLike) => void, reject: (reason: any) => void) => void); - - public then( - onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; - - - public static as(value: null): Promise; - public static as(value: undefined): Promise; - public static as(value: PromiseLike): PromiseLike; - public static as>(value: SomePromise): SomePromise; - public static as(value: T): Promise; - - public static join(promises: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - public static join(promises: (T | PromiseLike)[]): Promise; - - public static wrap(value: T | PromiseLike): Promise; - - public static wrapError(error: Error): Promise; - } - export class CancellationTokenSource { readonly token: CancellationToken; cancel(): void; @@ -156,7 +133,7 @@ declare namespace monaco { * * @param value A string which represents an Uri (see `Uri#toString`). */ - static parse(value: string): Uri; + static parse(value: string, _strict?: boolean): Uri; /** * Creates a new Uri from a file system path, e.g. `c:\my\files`, * `/usr/home`, or `\\server\share\some\path`. @@ -187,7 +164,7 @@ declare namespace monaco { fragment?: string; }): Uri; /** - * Creates a string presentation for this Uri. It's guaranteed that calling + * Creates a string representation for this Uri. It's guaranteed that calling * `Uri.parse` with the result of this function creates an Uri which is equal * to this Uri. * @@ -390,6 +367,7 @@ declare namespace monaco { */ MAX_VALUE = 112 } + export class KeyMod { static readonly CtrlCmd: number; static readonly Shift: number; @@ -397,12 +375,17 @@ declare namespace monaco { static readonly WinCtrl: number; static chord(firstPart: number, secondPart: number): number; } + export interface IMarkdownString { value: string; isTrusted?: boolean; + uris?: { + [href: string]: UriComponents; + }; } export interface IKeyboardEvent { + readonly _standardKeyboardEventBrand: true; readonly browserEvent: KeyboardEvent; readonly target: HTMLElement; readonly ctrlKey: boolean; @@ -491,7 +474,7 @@ declare namespace monaco { /** * Test if position `a` equals position `b` */ - static equals(a: IPosition, b: IPosition): boolean; + static equals(a: IPosition | null, b: IPosition | null): boolean; /** * Test if this position is before other position. * If the two positions are equal, the result will be false. @@ -869,8 +852,8 @@ declare namespace monaco.editor { /** * Get markers for owner and/or resource - * @returns {IMarker[]} list of markers - * @param filter + * + * @returns list of markers */ export function getModelMarkers(filter: { owner?: string; @@ -945,6 +928,11 @@ declare namespace monaco.editor { */ export function setTheme(themeName: string): void; + /** + * Clears all cached font measurements and triggers re-measurement. + */ + export function remeasureFonts(): void; + export type BuiltinTheme = 'vs' | 'vs-dark' | 'hc-black'; export interface IStandaloneThemeData { @@ -1094,13 +1082,13 @@ declare namespace monaco.editor { } export interface IStandaloneCodeEditor extends ICodeEditor { - addCommand(keybinding: number, handler: ICommandHandler, context: string): string | null; + addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null; createContextKey(key: string, defaultValue: T): IContextKey; addAction(descriptor: IActionDescriptor): IDisposable; } export interface IStandaloneDiffEditor extends IDiffEditor { - addCommand(keybinding: number, handler: ICommandHandler, context: string): string | null; + addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null; createContextKey(key: string, defaultValue: T): IContextKey; addAction(descriptor: IActionDescriptor): IDisposable; getOriginalEditor(): IStandaloneCodeEditor; @@ -1444,6 +1432,7 @@ declare namespace monaco.editor { export class TextModelResolvedOptions { _textModelResolvedOptionsBrand: void; readonly tabSize: number; + readonly indentSize: number; readonly insertSpaces: boolean; readonly defaultEOL: DefaultEndOfLine; readonly trimAutoWhitespace: boolean; @@ -1451,6 +1440,7 @@ declare namespace monaco.editor { export interface ITextModelUpdateOptions { tabSize?: number; + indentSize?: number; insertSpaces?: boolean; trimAutoWhitespace?: boolean; } @@ -1737,10 +1727,6 @@ declare namespace monaco.editor { * Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs). */ normalizeIndentation(str: string): string; - /** - * Get what is considered to be one indent (e.g. a tab character or 4 spaces, etc.). - */ - getOneIndent(): string; /** * Change the options of this model. */ @@ -1994,8 +1980,8 @@ declare namespace monaco.editor { * (Serializable) View state for the diff editor. */ export interface IDiffEditorViewState { - original: ICodeEditorViewState; - modified: ICodeEditorViewState; + original: ICodeEditorViewState | null; + modified: ICodeEditorViewState | null; } /** @@ -2286,6 +2272,7 @@ declare namespace monaco.editor { * An event describing that some ranges of lines have been tokenized (their tokens have changed). */ export interface IModelTokensChangedEvent { + readonly tokenizationSupportChanged: boolean; readonly ranges: { /** * The start of the range (inclusive) @@ -2300,6 +2287,7 @@ declare namespace monaco.editor { export interface IModelOptionsChangedEvent { readonly tabSize: boolean; + readonly indentSize: boolean; readonly insertSpaces: boolean; readonly trimAutoWhitespace: boolean; } @@ -2455,6 +2443,7 @@ declare namespace monaco.editor { * Controls if Find in Selection flag is turned on when multiple lines of text are selected in the editor. */ autoFindInSelection: boolean; + addExtraSpaceOnTop?: boolean; } /** @@ -2559,6 +2548,10 @@ declare namespace monaco.editor { * Favours words that appear close to the cursor. */ localityBonus?: boolean; + /** + * Enable using global storage for remembering suggestions. + */ + shareSuggestSelections?: boolean; } /** @@ -2599,6 +2592,11 @@ declare namespace monaco.editor { * Defaults to true. */ lineNumbers?: 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string); + /** + * Render last line number when the file ends with a newline. + * Defaults to true on Windows/Mac and to false on Linux. + */ + renderFinalNewline?: boolean; /** * Should the corresponding line be selected when clicking on the line number? * Defaults to true. @@ -2678,6 +2676,11 @@ declare namespace monaco.editor { * Defaults to false. */ mouseWheelZoom?: boolean; + /** + * Enable smooth caret animation. + * Defaults to false. + */ + cursorSmoothCaretAnimation?: boolean; /** * Control the cursor style, either 'block' or 'line'. * Defaults to 'line'. @@ -2801,6 +2804,11 @@ declare namespace monaco.editor { * Defaults to 1. */ mouseWheelScrollSensitivity?: number; + /** + * FastScrolling mulitplier speed when pressing `Alt` + * Defaults to 5. + */ + fastScrollSensitivity?: number; /** * The modifier to be used to add multiple cursors with the mouse. * Defaults to 'alt' @@ -3163,6 +3171,7 @@ declare namespace monaco.editor { readonly verticalScrollbarSize: number; readonly verticalSliderSize: number; readonly mouseWheelScrollSensitivity: number; + readonly fastScrollSensitivity: number; } export interface InternalEditorMinimapOptions { @@ -3176,6 +3185,7 @@ declare namespace monaco.editor { export interface InternalEditorFindOptions { readonly seedSearchStringFromSelection: boolean; readonly autoFindInSelection: boolean; + readonly addExtraSpaceOnTop: boolean; } export interface InternalEditorHoverOptions { @@ -3189,6 +3199,7 @@ declare namespace monaco.editor { readonly snippets: 'top' | 'bottom' | 'inline' | 'none'; readonly snippetsPreventQuickSuggestions: boolean; readonly localityBonus: boolean; + readonly shareSuggestSelections: boolean; } export interface InternalParameterHintOptions { @@ -3223,6 +3234,7 @@ declare namespace monaco.editor { readonly ariaLabel: string; readonly renderLineNumbers: RenderLineNumbersType; readonly renderCustomLineNumbers: ((lineNumber: number) => string) | null; + readonly renderFinalNewline: boolean; readonly selectOnLineNumbers: boolean; readonly glyphMargin: boolean; readonly revealHorizontalRightPadding: number; @@ -3231,6 +3243,7 @@ declare namespace monaco.editor { readonly overviewRulerBorder: boolean; readonly cursorBlinking: TextEditorCursorBlinkingStyle; readonly mouseWheelZoom: boolean; + readonly cursorSmoothCaretAnimation: boolean; readonly cursorStyle: TextEditorCursorStyle; readonly cursorWidth: number; readonly hideCursorInOverviewRuler: boolean; @@ -4048,7 +4061,7 @@ declare namespace monaco.editor { /** * Force an editor render now. */ - render(): void; + render(forceRedraw?: boolean): void; /** * Get the hit test target at coordinates `clientX` and `clientY`. * The coordinates are relative to the top-left of the viewport. @@ -4276,12 +4289,12 @@ declare namespace monaco.languages { /** * Set the tokens provider for a language (manual implementation). */ - export function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider): IDisposable; + export function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider | Thenable): IDisposable; /** * Set the tokens provider for a language (monarch implementation). */ - export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage): IDisposable; + export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage | Thenable): IDisposable; /** * Register a reference provider (used by e.g. reference search). @@ -4380,8 +4393,6 @@ declare namespace monaco.languages { export interface CodeActionContext { /** * An array of diagnostics. - * - * @readonly */ readonly markers: editor.IMarkerData[]; /** @@ -4398,7 +4409,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)[] | Thenable<(Command | CodeAction)[]>; + provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): (Command | CodeAction)[] | Promise<(Command | CodeAction)[]>; } /** @@ -4489,11 +4500,11 @@ declare namespace monaco.languages { /** * If a line matches this pattern, then **only the next line** after it should be indented once. */ - indentNextLinePattern?: RegExp; + indentNextLinePattern?: RegExp | null; /** * If a line matches this pattern, then its indentation should not be changed and it should not be evaluated against the other rules. */ - unIndentedLinePattern?: RegExp; + unIndentedLinePattern?: RegExp | null; } /** @@ -4611,10 +4622,6 @@ declare namespace monaco.languages { * Describe what to do with the indentation. */ indentAction: IndentAction; - /** - * Describe whether to outdent current line. - */ - outdentCurrentLine?: boolean; /** * Describes text to be appended after the new line and after the indentation. */ @@ -4777,7 +4784,7 @@ declare namespace monaco.languages { * *Note:* The range must be a [single line](#Range.isSingleLine) and it must * [contain](#Range.contains) the position at which completion has been [requested](#CompletionItemProvider.provideCompletionItems). */ - range?: IRange; + range: IRange; /** * An optional set of characters that when pressed while this completion is active will accept it first and * then type that character. *Note* that all commit characters should have `length=1` and that superfluous @@ -4860,6 +4867,7 @@ declare namespace monaco.languages { edit?: WorkspaceEdit; diagnostics?: editor.IMarkerData[]; kind?: string; + isPreferred?: boolean; } /** @@ -4921,16 +4929,17 @@ declare namespace monaco.languages { activeParameter: number; } - export enum SignatureHelpTriggerReason { + export enum SignatureHelpTriggerKind { Invoke = 1, TriggerCharacter = 2, ContentChange = 3 } export interface SignatureHelpContext { - readonly triggerReason: SignatureHelpTriggerReason; + readonly triggerKind: SignatureHelpTriggerKind; readonly triggerCharacter?: string; readonly isRetrigger: boolean; + readonly activeSignatureHelp?: SignatureHelp; } /** @@ -4977,7 +4986,7 @@ declare namespace monaco.languages { /** * The highlight kind, default is [text](#DocumentHighlightKind.Text). */ - kind: DocumentHighlightKind; + kind?: DocumentHighlightKind; } /** @@ -5029,20 +5038,28 @@ declare namespace monaco.languages { range: IRange; } - /** - * The definition of a symbol represented as one or many [locations](#Location). - * For most programming languages there is only one location at which a symbol is - * defined. - */ - export type Definition = Location | Location[]; - - export interface DefinitionLink { - origin?: IRange; + export interface LocationLink { + /** + * A range to select where this link originates from. + */ + originSelectionRange?: IRange; + /** + * The target uri this link points to. + */ uri: Uri; + /** + * The full range this link points to. + */ range: IRange; - selectionRange?: IRange; + /** + * A range to select this link points to. Must be contained + * in `LocationLink.range`. + */ + targetSelectionRange?: IRange; } + export type Definition = Location | Location[] | LocationLink[]; + /** * The definition provider interface defines the contract between extensions and * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition) @@ -5052,7 +5069,19 @@ declare namespace monaco.languages { /** * Provide the definition of the symbol at the given position and document. */ - provideDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; + provideDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; + } + + /** + * The definition provider interface defines the contract between extensions and + * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition) + * and peek definition features. + */ + export interface DeclarationProvider { + /** + * Provide the declaration of the symbol at the given position and document. + */ + provideDeclaration(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; } /** @@ -5063,7 +5092,7 @@ declare namespace monaco.languages { /** * Provide the implementation of the symbol at the given position and document. */ - provideImplementation(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; + provideImplementation(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; } /** @@ -5074,7 +5103,7 @@ declare namespace monaco.languages { /** * Provide the type definition of the symbol at the given position and document. */ - provideTypeDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; + provideTypeDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; } /** @@ -5135,10 +5164,6 @@ declare namespace monaco.languages { range: IRange; text: string; eol?: editor.EndOfLineSequence; - } | { - range: undefined; - text: undefined; - eol: editor.EndOfLineSequence; }; /** @@ -5202,7 +5227,7 @@ declare namespace monaco.languages { */ export interface ILink { range: IRange; - url?: string; + url?: Uri | string; } /** @@ -5285,6 +5310,18 @@ declare namespace monaco.languages { provideColorPresentations(model: editor.ITextModel, colorInfo: IColorInformation, token: CancellationToken): ProviderResult; } + export interface SelectionRange { + kind: string; + range: IRange; + } + + export interface SelectionRangeProvider { + /** + * Provide ranges that should be selected from the given position. + */ + provideSelectionRanges(model: editor.ITextModel, positions: Position[], token: CancellationToken): ProviderResult; + } + export interface FoldingContext { } @@ -5357,7 +5394,7 @@ declare namespace monaco.languages { } export interface WorkspaceEdit { - edits?: Array; + edits: Array; } export interface Rejection { @@ -5549,6 +5586,7 @@ declare namespace monaco.worker { //dtsv=2 + declare namespace monaco.languages.typescript { enum ModuleKind {