From 2a996151d74d0e48102c47ea4c15836023d32f94 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 8 Sep 2020 14:51:11 +0200 Subject: [PATCH] adopt latest monaco plugins --- gulpfile.js | 58 ++---- monaco.d.ts | 274 +++++++++++++++-------------- package-lock.json | 30 ++-- package.json | 10 +- website/playground/monaco.d.ts.txt | 274 +++++++++++++++-------------- 5 files changed, 327 insertions(+), 319 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 3035aaba..9341c27e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -184,54 +184,26 @@ function addPluginContribs(type) { var contribPath = path.join(__dirname, pluginPath, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js'; var contribContents = fs.readFileSync(contribPath).toString(); - // Check for the anonymous define call case 1 - // transform define(function() {...}) to define("moduleId",["require"],function() {...}) - var anonymousContribDefineCase1 = contribContents.indexOf('define(function'); - if (anonymousContribDefineCase1 >= 0) { - contribContents = ( - contribContents.substring(0, anonymousContribDefineCase1) - + `define("${plugin.contrib}",["require"],function` - + contribContents.substring(anonymousContribDefineCase1 + 'define(function'.length) - ); - } - - // Check for the anonymous define call case 2 - // transform define([ to define("moduleId",[ - var anonymousContribDefineCase2 = contribContents.indexOf('define(['); - if (anonymousContribDefineCase2 >= 0) { - contribContents = ( - contribContents.substring(0, anonymousContribDefineCase2) - + `define("${plugin.contrib}",[` - + contribContents.substring(anonymousContribDefineCase2 + 'define(['.length) - ); - } - - var contribDefineIndex = contribContents.indexOf('define("' + plugin.contrib); - if (contribDefineIndex === -1) { - contribDefineIndex = contribContents.indexOf('define(\'' + plugin.contrib); - if (contribDefineIndex === -1) { - console.error('(1) CANNOT DETERMINE AMD define location for contribution', pluginPath); - process.exit(-1); - } - } - - var depsEndIndex = contribContents.indexOf(']', contribDefineIndex); - if (contribDefineIndex === -1) { - console.error('(2) CANNOT DETERMINE AMD define location for contribution', pluginPath); - process.exit(-1); - } - - contribContents = contribContents.substring(0, depsEndIndex) + ',"vs/editor/editor.api"' + contribContents.substring(depsEndIndex); - contribContents = contribContents.replace( - 'define("vs/basic-languages/_.contribution",["require","exports"],', - 'define("vs/basic-languages/_.contribution",["require","exports","vs/editor/editor.api"],', + `define('vs/language/css/fillers/monaco-editor-core',[],`, + `define('vs/language/css/fillers/monaco-editor-core',['vs/editor/editor.api'],`, + ); + contribContents = contribContents.replace( + `define('vs/language/html/fillers/monaco-editor-core',[],`, + `define('vs/language/html/fillers/monaco-editor-core',['vs/editor/editor.api'],`, ); - contribContents = contribContents.replace( `define('vs/language/json/fillers/monaco-editor-core',[],`, `define('vs/language/json/fillers/monaco-editor-core',['vs/editor/editor.api'],`, ); + contribContents = contribContents.replace( + `define('vs/language/typescript/fillers/monaco-editor-core',[],`, + `define('vs/language/typescript/fillers/monaco-editor-core',['vs/editor/editor.api'],`, + ); + contribContents = contribContents.replace( + `define('vs/basic-languages/fillers/monaco-editor-core',[],`, + `define('vs/basic-languages/fillers/monaco-editor-core',['vs/editor/editor.api'],`, + ); extraContent.push(contribContents); }); @@ -452,7 +424,7 @@ function addPluginDTS() { var dtsPath = path.join(pluginPath, '../monaco.d.ts'); try { let plugindts = fs.readFileSync(dtsPath).toString(); - plugindts = plugindts.replace('declare module', 'declare namespace'); + plugindts = plugindts.replace(/\/\/\/ { [index: string]: T; } - - type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | null | undefined; + declare type CompilerOptionsValue = + | string + | number + | boolean + | (string | number)[] + | string[] + | MapLike + | null + | undefined; interface CompilerOptions { allowJs?: boolean; allowSyntheticDefaultImports?: boolean; @@ -6317,23 +6324,23 @@ declare namespace monaco.languages.typescript { useDefineForClassFields?: boolean; [option: string]: CompilerOptionsValue | undefined; } - export interface DiagnosticsOptions { noSemanticValidation?: boolean; noSyntaxValidation?: boolean; noSuggestionDiagnostics?: boolean; diagnosticCodesToIgnore?: number[]; } - + export interface WorkerOptions { + /** A full HTTP path to a JavaScript file which adds a function `customTSWorkerFactory` to the self inside a web-worker */ + customWorkerPath?: string; + } interface IExtraLib { content: string; version: number; } - - interface IExtraLibs { + export interface IExtraLibs { [path: string]: IExtraLib; } - /** * A linked list of formatted diagnostic messages to be used as part of a multiline message. * It is built from the bottom up, leaving the head to be the "main" diagnostic. @@ -6345,7 +6352,7 @@ declare namespace monaco.languages.typescript { code: number; next?: DiagnosticMessageChain[]; } - interface Diagnostic extends DiagnosticRelatedInformation { + export interface Diagnostic extends DiagnosticRelatedInformation { /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ reportsUnnecessary?: {}; source?: string; @@ -6361,7 +6368,6 @@ declare namespace monaco.languages.typescript { length: number | undefined; messageText: string | DiagnosticMessageChain; } - interface EmitOutput { outputFiles: OutputFile[]; emitSkipped: boolean; @@ -6371,23 +6377,20 @@ declare namespace monaco.languages.typescript { writeByteOrderMark: boolean; text: string; } - export interface LanguageServiceDefaults { /** * Event fired when compiler options or diagnostics options are changed. */ readonly onDidChange: IEvent; - /** * Event fired when extra libraries registered with the language service change. */ readonly onDidExtraLibsChange: IEvent; - + readonly workerOptions: WorkerOptions; /** * Get the current extra libs registered with the language service. */ getExtraLibs(): IExtraLibs; - /** * Add an additional source file to the language service. Use this * for typescript (definition) files that won't be loaded as editor @@ -6399,285 +6402,310 @@ declare namespace monaco.languages.typescript { * language service upon disposal. */ addExtraLib(content: string, filePath?: string): IDisposable; - /** * Remove all existing extra libs and set the additional source * files to the language service. Use this for typescript definition * files that won't be loaded as editor documents, like `jquery.d.ts`. * @param libs An array of entries to register. */ - setExtraLibs(libs: { content: string; filePath?: string }[]): void; - + setExtraLibs( + libs: { + content: string; + filePath?: string; + }[] + ): void; /** * Get current TypeScript compiler options for the language service. */ getCompilerOptions(): CompilerOptions; - /** * Set TypeScript compiler options. */ setCompilerOptions(options: CompilerOptions): void; - /** * Get the current diagnostics options for the language service. */ getDiagnosticsOptions(): DiagnosticsOptions; - /** * Configure whether syntactic and/or semantic validation should * be performed */ setDiagnosticsOptions(options: DiagnosticsOptions): void; - /** * No-op. */ setMaximumWorkerIdleTime(value: number): void; - /** * Configure if all existing models should be eagerly sync'd * to the worker on start or restart. */ setEagerModelSync(value: boolean): void; - /** * Get the current setting for whether all existing models should be eagerly sync'd * to the worker on start or restart. */ getEagerModelSync(): boolean; } - export interface TypeScriptWorker { /** * Get diagnostic messages for any syntax issues in the given file. */ getSyntacticDiagnostics(fileName: string): Promise; - /** * Get diagnostic messages for any semantic issues in the given file. */ getSemanticDiagnostics(fileName: string): Promise; - /** * Get diagnostic messages for any suggestions related to the given file. */ getSuggestionDiagnostics(fileName: string): Promise; - + /** + * Get the content of a given file. + */ + getScriptText(fileName: string): Promise; /** * Get diagnostic messages related to the current compiler options. * @param fileName Not used */ getCompilerOptionsDiagnostics(fileName: string): Promise; - /** * Get code completions for the given file and position. * @returns `Promise` */ - getCompletionsAtPosition(fileName: string, position: number): Promise; - + getCompletionsAtPosition( + fileName: string, + position: number + ): Promise; /** * Get code completion details for the given file, position, and entry. * @returns `Promise` */ - getCompletionEntryDetails(fileName: string, position: number, entry: string): Promise; - + getCompletionEntryDetails( + fileName: string, + position: number, + entry: string + ): Promise; /** * Get signature help items for the item at the given file and position. * @returns `Promise` */ - getSignatureHelpItems(fileName: string, position: number): Promise; - + getSignatureHelpItems( + fileName: string, + position: number + ): Promise; /** * Get quick info for the item at the given position in the file. * @returns `Promise` */ - getQuickInfoAtPosition(fileName: string, position: number): Promise; - + getQuickInfoAtPosition( + fileName: string, + position: number + ): Promise; /** * Get other ranges which are related to the item at the given position in the file (often used for highlighting). * @returns `Promise | undefined>` */ - getOccurrencesAtPosition(fileName: string, position: number): Promise | undefined>; - + getOccurrencesAtPosition( + fileName: string, + position: number + ): Promise | undefined>; /** * Get the definition of the item at the given position in the file. * @returns `Promise | undefined>` */ - getDefinitionAtPosition(fileName: string, position: number): Promise | undefined>; - + getDefinitionAtPosition( + fileName: string, + position: number + ): Promise | undefined>; /** * Get references to the item at the given position in the file. * @returns `Promise` */ - getReferencesAtPosition(fileName: string, position: number): Promise; - + getReferencesAtPosition( + fileName: string, + position: number + ): Promise; /** * Get outline entries for the item at the given position in the file. * @returns `Promise` */ getNavigationBarItems(fileName: string): Promise; - /** * Get changes which should be applied to format the given file. * @param options `typescript.FormatCodeOptions` * @returns `Promise` */ - getFormattingEditsForDocument(fileName: string, options: any): Promise; - + getFormattingEditsForDocument( + fileName: string, + options: any + ): Promise; /** * Get changes which should be applied to format the given range in the file. * @param options `typescript.FormatCodeOptions` * @returns `Promise` */ - getFormattingEditsForRange(fileName: string, start: number, end: number, options: any): Promise; - + getFormattingEditsForRange( + fileName: string, + start: number, + end: number, + options: any + ): Promise; /** * Get formatting changes which should be applied after the given keystroke. * @param options `typescript.FormatCodeOptions` * @returns `Promise` */ - getFormattingEditsAfterKeystroke(fileName: string, postion: number, ch: string, options: any): Promise; - + getFormattingEditsAfterKeystroke( + fileName: string, + postion: number, + ch: string, + options: any + ): Promise; /** * Get other occurrences which should be updated when renaming the item at the given file and position. * @returns `Promise` */ - findRenameLocations(fileName: string, positon: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename: boolean): Promise; - + findRenameLocations( + fileName: string, + positon: number, + findInStrings: boolean, + findInComments: boolean, + providePrefixAndSuffixTextForRename: boolean + ): Promise; /** * Get edits which should be applied to rename the item at the given file and position (or a failure reason). * @param options `typescript.RenameInfoOptions` * @returns `Promise` */ - getRenameInfo(fileName: string, positon: number, options: any): Promise; - + getRenameInfo( + fileName: string, + positon: number, + options: any + ): Promise; /** * Get transpiled output for the given file. * @returns `typescript.EmitOutput` */ - getEmitOutput(fileName: string): Promise; - + getEmitOutput(fileName: string): Promise; /** * Get possible code fixes at the given position in the file. * @param formatOptions `typescript.FormatCodeOptions` * @returns `Promise>` */ - getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: any): Promise>; + getCodeFixesAtPosition( + fileName: string, + start: number, + end: number, + errorCodes: number[], + formatOptions: any + ): Promise>; } - export const typescriptVersion: string; - export const typescriptDefaults: LanguageServiceDefaults; export const javascriptDefaults: LanguageServiceDefaults; - - export const getTypeScriptWorker: () => Promise<(...uris: Uri[]) => Promise>; - export const getJavaScriptWorker: () => Promise<(...uris: Uri[]) => Promise>; + export const getTypeScriptWorker: () => Promise< + (...uris: Uri[]) => Promise + >; + export const getJavaScriptWorker: () => Promise< + (...uris: Uri[]) => Promise + >; } /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + + declare namespace monaco.languages.css { export interface DiagnosticsOptions { readonly validate?: boolean; readonly lint?: { - readonly compatibleVendorPrefixes?: 'ignore' | 'warning' | 'error', - readonly vendorPrefix?: 'ignore' | 'warning' | 'error', - readonly duplicateProperties?: 'ignore' | 'warning' | 'error', - readonly emptyRules?: 'ignore' | 'warning' | 'error', - readonly importStatement?: 'ignore' | 'warning' | 'error', - readonly boxModel?: 'ignore' | 'warning' | 'error', - readonly universalSelector?: 'ignore' | 'warning' | 'error', - readonly zeroUnits?: 'ignore' | 'warning' | 'error', - readonly fontFaceProperties?: 'ignore' | 'warning' | 'error', - readonly hexColorLength?: 'ignore' | 'warning' | 'error', - readonly argumentsInColorFunction?: 'ignore' | 'warning' | 'error', - readonly unknownProperties?: 'ignore' | 'warning' | 'error', - readonly ieHack?: 'ignore' | 'warning' | 'error', - readonly unknownVendorSpecificProperties?: 'ignore' | 'warning' | 'error', - readonly propertyIgnoredDueToDisplay?: 'ignore' | 'warning' | 'error', - readonly important?: 'ignore' | 'warning' | 'error', - readonly float?: 'ignore' | 'warning' | 'error', - readonly idSelector?: 'ignore' | 'warning' | 'error' - } + readonly compatibleVendorPrefixes?: 'ignore' | 'warning' | 'error'; + readonly vendorPrefix?: 'ignore' | 'warning' | 'error'; + readonly duplicateProperties?: 'ignore' | 'warning' | 'error'; + readonly emptyRules?: 'ignore' | 'warning' | 'error'; + readonly importStatement?: 'ignore' | 'warning' | 'error'; + readonly boxModel?: 'ignore' | 'warning' | 'error'; + readonly universalSelector?: 'ignore' | 'warning' | 'error'; + readonly zeroUnits?: 'ignore' | 'warning' | 'error'; + readonly fontFaceProperties?: 'ignore' | 'warning' | 'error'; + readonly hexColorLength?: 'ignore' | 'warning' | 'error'; + readonly argumentsInColorFunction?: 'ignore' | 'warning' | 'error'; + readonly unknownProperties?: 'ignore' | 'warning' | 'error'; + readonly ieHack?: 'ignore' | 'warning' | 'error'; + readonly unknownVendorSpecificProperties?: 'ignore' | 'warning' | 'error'; + readonly propertyIgnoredDueToDisplay?: 'ignore' | 'warning' | 'error'; + readonly important?: 'ignore' | 'warning' | 'error'; + readonly float?: 'ignore' | 'warning' | 'error'; + readonly idSelector?: 'ignore' | 'warning' | 'error'; + }; } - export interface ModeConfiguration { /** * Defines whether the built-in completionItemProvider is enabled. */ readonly completionItems?: boolean; - /** * Defines whether the built-in hoverProvider is enabled. */ readonly hovers?: boolean; - /** * Defines whether the built-in documentSymbolProvider is enabled. */ readonly documentSymbols?: boolean; - /** * Defines whether the built-in definitions provider is enabled. */ readonly definitions?: boolean; - /** * Defines whether the built-in references provider is enabled. */ readonly references?: boolean; - /** * Defines whether the built-in references provider is enabled. */ readonly documentHighlights?: boolean; - /** * Defines whether the built-in rename provider is enabled. */ readonly rename?: boolean; - /** * Defines whether the built-in color provider is enabled. */ readonly colors?: boolean; - /** * Defines whether the built-in foldingRange provider is enabled. */ readonly foldingRanges?: boolean; - /** * Defines whether the built-in diagnostic provider is enabled. */ readonly diagnostics?: boolean; - /** * Defines whether the built-in selection range provider is enabled. */ readonly selectionRanges?: boolean; - } - export interface LanguageServiceDefaults { + readonly languageId: string; readonly onDidChange: IEvent; readonly diagnosticsOptions: DiagnosticsOptions; readonly modeConfiguration: ModeConfiguration; setDiagnosticsOptions(options: DiagnosticsOptions): void; setModeConfiguration(modeConfiguration: ModeConfiguration): void; } - - export var cssDefaults: LanguageServiceDefaults; - export var lessDefaults: LanguageServiceDefaults; - export var scssDefaults: LanguageServiceDefaults; + export const cssDefaults: LanguageServiceDefaults; + export const scssDefaults: LanguageServiceDefaults; + export const lessDefaults: LanguageServiceDefaults; } + /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + declare namespace monaco.languages.json { export interface DiagnosticsOptions { /** @@ -6768,6 +6796,7 @@ declare namespace monaco.languages.json { * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + declare namespace monaco.languages.html { export interface HTMLFormatConfiguration { readonly tabSize: number; @@ -6781,13 +6810,15 @@ declare namespace monaco.languages.html { readonly indentHandlebars: boolean; readonly endWithNewline: boolean; readonly extraLiners: string; - readonly wrapAttributes: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline'; + readonly wrapAttributes: + | 'auto' + | 'force' + | 'force-aligned' + | 'force-expand-multiline'; } - export interface CompletionConfiguration { [provider: string]: boolean; } - export interface Options { /** * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. @@ -6798,77 +6829,64 @@ declare namespace monaco.languages.html { */ readonly suggest?: CompletionConfiguration; } - export interface ModeConfiguration { /** * Defines whether the built-in completionItemProvider is enabled. */ readonly completionItems?: boolean; - /** * Defines whether the built-in hoverProvider is enabled. */ readonly hovers?: boolean; - /** * Defines whether the built-in documentSymbolProvider is enabled. */ readonly documentSymbols?: boolean; - /** * Defines whether the built-in definitions provider is enabled. */ readonly links?: boolean; - /** * Defines whether the built-in references provider is enabled. */ readonly documentHighlights?: boolean; - /** * Defines whether the built-in rename provider is enabled. */ readonly rename?: boolean; - /** * Defines whether the built-in color provider is enabled. */ readonly colors?: boolean; - /** * Defines whether the built-in foldingRange provider is enabled. */ readonly foldingRanges?: boolean; - /** * Defines whether the built-in diagnostic provider is enabled. */ readonly diagnostics?: boolean; - /** * Defines whether the built-in selection range provider is enabled. */ readonly selectionRanges?: boolean; - /** * Defines whether the built-in documentFormattingEdit provider is enabled. */ readonly documentFormattingEdits?: boolean; - /** * Defines whether the built-in documentRangeFormattingEdit provider is enabled. */ readonly documentRangeFormattingEdits?: boolean; - } - export interface LanguageServiceDefaults { + readonly languageId: string; + readonly modeConfiguration: ModeConfiguration; readonly onDidChange: IEvent; readonly options: Options; setOptions(options: Options): void; } - - export var htmlDefaults: LanguageServiceDefaults; - export var handlebarDefaults: LanguageServiceDefaults; - export var razorDefaults: LanguageServiceDefaults; -} \ No newline at end of file + export const htmlDefaults: LanguageServiceDefaults; + export const handlebarDefaults: LanguageServiceDefaults; + export const razorDefaults: LanguageServiceDefaults; +} diff --git a/package-lock.json b/package-lock.json index 854e9e43..a94e660c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4298,9 +4298,9 @@ } }, "monaco-css": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/monaco-css/-/monaco-css-2.7.0.tgz", - "integrity": "sha512-gxijecAzpTvA81R/pQWRcb2pTgAjeXYU8px9WWnihwJG5QMgSiRXLEocIXRKdVzGoBRTE463BNcRZ1Jsl05azQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/monaco-css/-/monaco-css-3.0.0.tgz", + "integrity": "sha512-BTHbQh2a6HOHpcwK6Zg4i7+CR6C53LSyaC3XUdzcr4W8rsOom6kyIcbOgehFYSnB0Nf+kg0etZu7CEpIx3Kcqw==", "dev": true }, "monaco-editor-core": { @@ -4310,27 +4310,27 @@ "dev": true }, "monaco-html": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/monaco-html/-/monaco-html-2.7.0.tgz", - "integrity": "sha512-gn/1zgQwl0BVmoMimw4FdU4B4w+gpw2H87EFIDdPmluYGa/PiLetqCxICkMerfR/BjLsAvWWb7Ih/J7nlPqwAQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/monaco-html/-/monaco-html-3.0.0.tgz", + "integrity": "sha512-WFXVnebb14LIfRGUfcowRUvuMLIrZPWZ2DkbmcALeyWzB8HsGjKWMIkF0JoJj6BqCd6gYkE/Zi9M4mSoNqCDBA==", "dev": true }, "monaco-json": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-3.0.1.tgz", - "integrity": "sha512-vus+jwDci/X/9VEgDoTmSx0yTRRFQX5rf4gIGqILLLJZS++Dt6VRz3jHtvo0+Pk7uanRouDI6Nanf7w3ABUDLg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-3.0.2.tgz", + "integrity": "sha512-A6y8kDUE0S09jSU3uax8hw1m7uL/Orpd7fSMLeVWR8pouhhmUArkcV47ecI9nft4CKLPFegPEED7UHoCDj1yuw==", "dev": true }, "monaco-languages": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-1.10.0.tgz", - "integrity": "sha512-ARAws17Xh0K4WsZYkJY6CqHn9EYdYN8CjzK6w/jgXIwU0owzCdUWxzu+FNJ/LeDLcKxL/YK3phcwGFj9IqX2yw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-2.0.0.tgz", + "integrity": "sha512-HAnsEriYHtOYfxokGtguc5NfJN+PNmrtelZg8CwM859M2W5iFBqOnNGhOQPF35YHAUrj/JUKs45+/m9prlyiDw==", "dev": true }, "monaco-typescript": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/monaco-typescript/-/monaco-typescript-3.7.0.tgz", - "integrity": "sha512-xo+nHP7AOdFvHtMqg7hZquQziBuHsaG7hXGXiUuOHj9unJmIyi1uhGuvuQqIJWv+jHd19xGNWTF+KOdaXhksIw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/monaco-typescript/-/monaco-typescript-4.0.1.tgz", + "integrity": "sha512-FyVku1FEerPnHj1GYX3nzIhde3o2irRHg0mx5y0rGTjHZJlhpAlXcV4Bc+ufKqOGYZYtRQYtlR0sYwGs547KtA==", "dev": true }, "move-concurrently": { diff --git a/package.json b/package.json index 7f1669ab..6224dfe8 100644 --- a/package.json +++ b/package.json @@ -32,12 +32,12 @@ "gulp": "^4.0.2", "gulp-typedoc": "^2.2.5", "mocha": "^8.1.3", - "monaco-css": "2.7.0", + "monaco-css": "3.0.0", "monaco-editor-core": "0.20.0", - "monaco-html": "2.7.0", - "monaco-json": "3.0.1", - "monaco-languages": "1.10.0", - "monaco-typescript": "3.7.0", + "monaco-html": "3.0.0", + "monaco-json": "3.0.2", + "monaco-languages": "2.0.0", + "monaco-typescript": "4.0.1", "playwright": "1.3.0", "rimraf": "^3.0.2", "style-loader": "^1.2.1", diff --git a/website/playground/monaco.d.ts.txt b/website/playground/monaco.d.ts.txt index 968dbbf3..bb62b12c 100644 --- a/website/playground/monaco.d.ts.txt +++ b/website/playground/monaco.d.ts.txt @@ -6186,10 +6186,14 @@ declare namespace monaco.worker { //dtsv=3 +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + declare namespace monaco.languages.typescript { - - enum ModuleKind { + export enum ModuleKind { None = 0, CommonJS = 1, AMD = 2, @@ -6198,19 +6202,17 @@ declare namespace monaco.languages.typescript { ES2015 = 5, ESNext = 99 } - - enum JsxEmit { + export enum JsxEmit { None = 0, Preserve = 1, React = 2, ReactNative = 3 } - enum NewLineKind { + export enum NewLineKind { CarriageReturnLineFeed = 0, LineFeed = 1 } - - enum ScriptTarget { + export enum ScriptTarget { ES3 = 0, ES5 = 1, ES2015 = 2, @@ -6221,19 +6223,24 @@ declare namespace monaco.languages.typescript { ES2020 = 7, ESNext = 99, JSON = 100, - Latest = ESNext, + Latest = 99 } - export enum ModuleResolutionKind { Classic = 1, NodeJs = 2 } - interface MapLike { [index: string]: T; } - - type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | null | undefined; + declare type CompilerOptionsValue = + | string + | number + | boolean + | (string | number)[] + | string[] + | MapLike + | null + | undefined; interface CompilerOptions { allowJs?: boolean; allowSyntheticDefaultImports?: boolean; @@ -6317,23 +6324,23 @@ declare namespace monaco.languages.typescript { useDefineForClassFields?: boolean; [option: string]: CompilerOptionsValue | undefined; } - export interface DiagnosticsOptions { noSemanticValidation?: boolean; noSyntaxValidation?: boolean; noSuggestionDiagnostics?: boolean; diagnosticCodesToIgnore?: number[]; } - + export interface WorkerOptions { + /** A full HTTP path to a JavaScript file which adds a function `customTSWorkerFactory` to the self inside a web-worker */ + customWorkerPath?: string; + } interface IExtraLib { content: string; version: number; } - - interface IExtraLibs { + export interface IExtraLibs { [path: string]: IExtraLib; } - /** * A linked list of formatted diagnostic messages to be used as part of a multiline message. * It is built from the bottom up, leaving the head to be the "main" diagnostic. @@ -6345,7 +6352,7 @@ declare namespace monaco.languages.typescript { code: number; next?: DiagnosticMessageChain[]; } - interface Diagnostic extends DiagnosticRelatedInformation { + export interface Diagnostic extends DiagnosticRelatedInformation { /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ reportsUnnecessary?: {}; source?: string; @@ -6361,7 +6368,6 @@ declare namespace monaco.languages.typescript { length: number | undefined; messageText: string | DiagnosticMessageChain; } - interface EmitOutput { outputFiles: OutputFile[]; emitSkipped: boolean; @@ -6371,23 +6377,20 @@ declare namespace monaco.languages.typescript { writeByteOrderMark: boolean; text: string; } - export interface LanguageServiceDefaults { /** * Event fired when compiler options or diagnostics options are changed. */ readonly onDidChange: IEvent; - /** * Event fired when extra libraries registered with the language service change. */ readonly onDidExtraLibsChange: IEvent; - + readonly workerOptions: WorkerOptions; /** * Get the current extra libs registered with the language service. */ getExtraLibs(): IExtraLibs; - /** * Add an additional source file to the language service. Use this * for typescript (definition) files that won't be loaded as editor @@ -6399,285 +6402,310 @@ declare namespace monaco.languages.typescript { * language service upon disposal. */ addExtraLib(content: string, filePath?: string): IDisposable; - /** * Remove all existing extra libs and set the additional source * files to the language service. Use this for typescript definition * files that won't be loaded as editor documents, like `jquery.d.ts`. * @param libs An array of entries to register. */ - setExtraLibs(libs: { content: string; filePath?: string }[]): void; - + setExtraLibs( + libs: { + content: string; + filePath?: string; + }[] + ): void; /** * Get current TypeScript compiler options for the language service. */ getCompilerOptions(): CompilerOptions; - /** * Set TypeScript compiler options. */ setCompilerOptions(options: CompilerOptions): void; - /** * Get the current diagnostics options for the language service. */ getDiagnosticsOptions(): DiagnosticsOptions; - /** * Configure whether syntactic and/or semantic validation should * be performed */ setDiagnosticsOptions(options: DiagnosticsOptions): void; - /** * No-op. */ setMaximumWorkerIdleTime(value: number): void; - /** * Configure if all existing models should be eagerly sync'd * to the worker on start or restart. */ setEagerModelSync(value: boolean): void; - /** * Get the current setting for whether all existing models should be eagerly sync'd * to the worker on start or restart. */ getEagerModelSync(): boolean; } - export interface TypeScriptWorker { /** * Get diagnostic messages for any syntax issues in the given file. */ getSyntacticDiagnostics(fileName: string): Promise; - /** * Get diagnostic messages for any semantic issues in the given file. */ getSemanticDiagnostics(fileName: string): Promise; - /** * Get diagnostic messages for any suggestions related to the given file. */ getSuggestionDiagnostics(fileName: string): Promise; - + /** + * Get the content of a given file. + */ + getScriptText(fileName: string): Promise; /** * Get diagnostic messages related to the current compiler options. * @param fileName Not used */ getCompilerOptionsDiagnostics(fileName: string): Promise; - /** * Get code completions for the given file and position. * @returns `Promise` */ - getCompletionsAtPosition(fileName: string, position: number): Promise; - + getCompletionsAtPosition( + fileName: string, + position: number + ): Promise; /** * Get code completion details for the given file, position, and entry. * @returns `Promise` */ - getCompletionEntryDetails(fileName: string, position: number, entry: string): Promise; - + getCompletionEntryDetails( + fileName: string, + position: number, + entry: string + ): Promise; /** * Get signature help items for the item at the given file and position. * @returns `Promise` */ - getSignatureHelpItems(fileName: string, position: number): Promise; - + getSignatureHelpItems( + fileName: string, + position: number + ): Promise; /** * Get quick info for the item at the given position in the file. * @returns `Promise` */ - getQuickInfoAtPosition(fileName: string, position: number): Promise; - + getQuickInfoAtPosition( + fileName: string, + position: number + ): Promise; /** * Get other ranges which are related to the item at the given position in the file (often used for highlighting). * @returns `Promise | undefined>` */ - getOccurrencesAtPosition(fileName: string, position: number): Promise | undefined>; - + getOccurrencesAtPosition( + fileName: string, + position: number + ): Promise | undefined>; /** * Get the definition of the item at the given position in the file. * @returns `Promise | undefined>` */ - getDefinitionAtPosition(fileName: string, position: number): Promise | undefined>; - + getDefinitionAtPosition( + fileName: string, + position: number + ): Promise | undefined>; /** * Get references to the item at the given position in the file. * @returns `Promise` */ - getReferencesAtPosition(fileName: string, position: number): Promise; - + getReferencesAtPosition( + fileName: string, + position: number + ): Promise; /** * Get outline entries for the item at the given position in the file. * @returns `Promise` */ getNavigationBarItems(fileName: string): Promise; - /** * Get changes which should be applied to format the given file. * @param options `typescript.FormatCodeOptions` * @returns `Promise` */ - getFormattingEditsForDocument(fileName: string, options: any): Promise; - + getFormattingEditsForDocument( + fileName: string, + options: any + ): Promise; /** * Get changes which should be applied to format the given range in the file. * @param options `typescript.FormatCodeOptions` * @returns `Promise` */ - getFormattingEditsForRange(fileName: string, start: number, end: number, options: any): Promise; - + getFormattingEditsForRange( + fileName: string, + start: number, + end: number, + options: any + ): Promise; /** * Get formatting changes which should be applied after the given keystroke. * @param options `typescript.FormatCodeOptions` * @returns `Promise` */ - getFormattingEditsAfterKeystroke(fileName: string, postion: number, ch: string, options: any): Promise; - + getFormattingEditsAfterKeystroke( + fileName: string, + postion: number, + ch: string, + options: any + ): Promise; /** * Get other occurrences which should be updated when renaming the item at the given file and position. * @returns `Promise` */ - findRenameLocations(fileName: string, positon: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename: boolean): Promise; - + findRenameLocations( + fileName: string, + positon: number, + findInStrings: boolean, + findInComments: boolean, + providePrefixAndSuffixTextForRename: boolean + ): Promise; /** * Get edits which should be applied to rename the item at the given file and position (or a failure reason). * @param options `typescript.RenameInfoOptions` * @returns `Promise` */ - getRenameInfo(fileName: string, positon: number, options: any): Promise; - + getRenameInfo( + fileName: string, + positon: number, + options: any + ): Promise; /** * Get transpiled output for the given file. * @returns `typescript.EmitOutput` */ - getEmitOutput(fileName: string): Promise; - + getEmitOutput(fileName: string): Promise; /** * Get possible code fixes at the given position in the file. * @param formatOptions `typescript.FormatCodeOptions` * @returns `Promise>` */ - getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: any): Promise>; + getCodeFixesAtPosition( + fileName: string, + start: number, + end: number, + errorCodes: number[], + formatOptions: any + ): Promise>; } - export const typescriptVersion: string; - export const typescriptDefaults: LanguageServiceDefaults; export const javascriptDefaults: LanguageServiceDefaults; - - export const getTypeScriptWorker: () => Promise<(...uris: Uri[]) => Promise>; - export const getJavaScriptWorker: () => Promise<(...uris: Uri[]) => Promise>; + export const getTypeScriptWorker: () => Promise< + (...uris: Uri[]) => Promise + >; + export const getJavaScriptWorker: () => Promise< + (...uris: Uri[]) => Promise + >; } /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + + declare namespace monaco.languages.css { export interface DiagnosticsOptions { readonly validate?: boolean; readonly lint?: { - readonly compatibleVendorPrefixes?: 'ignore' | 'warning' | 'error', - readonly vendorPrefix?: 'ignore' | 'warning' | 'error', - readonly duplicateProperties?: 'ignore' | 'warning' | 'error', - readonly emptyRules?: 'ignore' | 'warning' | 'error', - readonly importStatement?: 'ignore' | 'warning' | 'error', - readonly boxModel?: 'ignore' | 'warning' | 'error', - readonly universalSelector?: 'ignore' | 'warning' | 'error', - readonly zeroUnits?: 'ignore' | 'warning' | 'error', - readonly fontFaceProperties?: 'ignore' | 'warning' | 'error', - readonly hexColorLength?: 'ignore' | 'warning' | 'error', - readonly argumentsInColorFunction?: 'ignore' | 'warning' | 'error', - readonly unknownProperties?: 'ignore' | 'warning' | 'error', - readonly ieHack?: 'ignore' | 'warning' | 'error', - readonly unknownVendorSpecificProperties?: 'ignore' | 'warning' | 'error', - readonly propertyIgnoredDueToDisplay?: 'ignore' | 'warning' | 'error', - readonly important?: 'ignore' | 'warning' | 'error', - readonly float?: 'ignore' | 'warning' | 'error', - readonly idSelector?: 'ignore' | 'warning' | 'error' - } + readonly compatibleVendorPrefixes?: 'ignore' | 'warning' | 'error'; + readonly vendorPrefix?: 'ignore' | 'warning' | 'error'; + readonly duplicateProperties?: 'ignore' | 'warning' | 'error'; + readonly emptyRules?: 'ignore' | 'warning' | 'error'; + readonly importStatement?: 'ignore' | 'warning' | 'error'; + readonly boxModel?: 'ignore' | 'warning' | 'error'; + readonly universalSelector?: 'ignore' | 'warning' | 'error'; + readonly zeroUnits?: 'ignore' | 'warning' | 'error'; + readonly fontFaceProperties?: 'ignore' | 'warning' | 'error'; + readonly hexColorLength?: 'ignore' | 'warning' | 'error'; + readonly argumentsInColorFunction?: 'ignore' | 'warning' | 'error'; + readonly unknownProperties?: 'ignore' | 'warning' | 'error'; + readonly ieHack?: 'ignore' | 'warning' | 'error'; + readonly unknownVendorSpecificProperties?: 'ignore' | 'warning' | 'error'; + readonly propertyIgnoredDueToDisplay?: 'ignore' | 'warning' | 'error'; + readonly important?: 'ignore' | 'warning' | 'error'; + readonly float?: 'ignore' | 'warning' | 'error'; + readonly idSelector?: 'ignore' | 'warning' | 'error'; + }; } - export interface ModeConfiguration { /** * Defines whether the built-in completionItemProvider is enabled. */ readonly completionItems?: boolean; - /** * Defines whether the built-in hoverProvider is enabled. */ readonly hovers?: boolean; - /** * Defines whether the built-in documentSymbolProvider is enabled. */ readonly documentSymbols?: boolean; - /** * Defines whether the built-in definitions provider is enabled. */ readonly definitions?: boolean; - /** * Defines whether the built-in references provider is enabled. */ readonly references?: boolean; - /** * Defines whether the built-in references provider is enabled. */ readonly documentHighlights?: boolean; - /** * Defines whether the built-in rename provider is enabled. */ readonly rename?: boolean; - /** * Defines whether the built-in color provider is enabled. */ readonly colors?: boolean; - /** * Defines whether the built-in foldingRange provider is enabled. */ readonly foldingRanges?: boolean; - /** * Defines whether the built-in diagnostic provider is enabled. */ readonly diagnostics?: boolean; - /** * Defines whether the built-in selection range provider is enabled. */ readonly selectionRanges?: boolean; - } - export interface LanguageServiceDefaults { + readonly languageId: string; readonly onDidChange: IEvent; readonly diagnosticsOptions: DiagnosticsOptions; readonly modeConfiguration: ModeConfiguration; setDiagnosticsOptions(options: DiagnosticsOptions): void; setModeConfiguration(modeConfiguration: ModeConfiguration): void; } - - export var cssDefaults: LanguageServiceDefaults; - export var lessDefaults: LanguageServiceDefaults; - export var scssDefaults: LanguageServiceDefaults; + export const cssDefaults: LanguageServiceDefaults; + export const scssDefaults: LanguageServiceDefaults; + export const lessDefaults: LanguageServiceDefaults; } + /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + declare namespace monaco.languages.json { export interface DiagnosticsOptions { /** @@ -6768,6 +6796,7 @@ declare namespace monaco.languages.json { * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + declare namespace monaco.languages.html { export interface HTMLFormatConfiguration { readonly tabSize: number; @@ -6781,13 +6810,15 @@ declare namespace monaco.languages.html { readonly indentHandlebars: boolean; readonly endWithNewline: boolean; readonly extraLiners: string; - readonly wrapAttributes: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline'; + readonly wrapAttributes: + | 'auto' + | 'force' + | 'force-aligned' + | 'force-expand-multiline'; } - export interface CompletionConfiguration { [provider: string]: boolean; } - export interface Options { /** * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. @@ -6798,77 +6829,64 @@ declare namespace monaco.languages.html { */ readonly suggest?: CompletionConfiguration; } - export interface ModeConfiguration { /** * Defines whether the built-in completionItemProvider is enabled. */ readonly completionItems?: boolean; - /** * Defines whether the built-in hoverProvider is enabled. */ readonly hovers?: boolean; - /** * Defines whether the built-in documentSymbolProvider is enabled. */ readonly documentSymbols?: boolean; - /** * Defines whether the built-in definitions provider is enabled. */ readonly links?: boolean; - /** * Defines whether the built-in references provider is enabled. */ readonly documentHighlights?: boolean; - /** * Defines whether the built-in rename provider is enabled. */ readonly rename?: boolean; - /** * Defines whether the built-in color provider is enabled. */ readonly colors?: boolean; - /** * Defines whether the built-in foldingRange provider is enabled. */ readonly foldingRanges?: boolean; - /** * Defines whether the built-in diagnostic provider is enabled. */ readonly diagnostics?: boolean; - /** * Defines whether the built-in selection range provider is enabled. */ readonly selectionRanges?: boolean; - /** * Defines whether the built-in documentFormattingEdit provider is enabled. */ readonly documentFormattingEdits?: boolean; - /** * Defines whether the built-in documentRangeFormattingEdit provider is enabled. */ readonly documentRangeFormattingEdits?: boolean; - } - export interface LanguageServiceDefaults { + readonly languageId: string; + readonly modeConfiguration: ModeConfiguration; readonly onDidChange: IEvent; readonly options: Options; setOptions(options: Options): void; } - - export var htmlDefaults: LanguageServiceDefaults; - export var handlebarDefaults: LanguageServiceDefaults; - export var razorDefaults: LanguageServiceDefaults; -} \ No newline at end of file + export const htmlDefaults: LanguageServiceDefaults; + export const handlebarDefaults: LanguageServiceDefaults; + export const razorDefaults: LanguageServiceDefaults; +}