From fb0c77cf756a64a1c53a4c6d22698368b6ef17ad Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 7 Sep 2020 14:38:06 +0200 Subject: [PATCH] Adopt latest `monaco-json` --- gulpfile.js | 11 ++++++++++- monaco.d.ts | 16 ++-------------- package-lock.json | 6 +++--- package.json | 2 +- website/playground/monaco.d.ts.txt | 16 ++-------------- 5 files changed, 18 insertions(+), 33 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 41c06b6e..3035aaba 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -228,6 +228,11 @@ function addPluginContribs(type) { 'define("vs/basic-languages/_.contribution",["require","exports","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'],`, + ); + extraContent.push(contribContents); }); @@ -291,7 +296,7 @@ function ESM_pluginStream(plugin, destinationPath) { const info = ts.preProcessFile(contents); for (let i = info.importedFiles.length - 1; i >= 0; i--) { - const importText = info.importedFiles[i].fileName; + let importText = info.importedFiles[i].fileName; const pos = info.importedFiles[i].pos; const end = info.importedFiles[i].end; @@ -302,6 +307,10 @@ function ESM_pluginStream(plugin, destinationPath) { process.exit(0); } + if (importText === 'monaco-editor-core') { + importText = 'monaco-editor-core/esm/vs/editor/editor.api'; + } + const myFileDestPath = path.join(DESTINATION, plugin.modulePrefix, data.relative); const importFilePath = path.join(DESTINATION, importText.substr('monaco-editor-core/esm/'.length)); let relativePath = path.relative(path.dirname(myFileDestPath), importFilePath).replace(/\\/g, '/'); diff --git a/monaco.d.ts b/monaco.d.ts index 1047328e..968dbbf3 100644 --- a/monaco.d.ts +++ b/monaco.d.ts @@ -6710,69 +6710,57 @@ declare namespace monaco.languages.json { */ readonly enableSchemaRequest?: boolean; } - export interface ModeConfiguration { /** * Defines whether the built-in documentFormattingEdit provider is enabled. */ readonly documentFormattingEdits?: boolean; - /** * Defines whether the built-in documentRangeFormattingEdit provider is enabled. */ readonly documentRangeFormattingEdits?: boolean; - /** * 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 tokens provider is enabled. */ readonly tokens?: 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 jsonDefaults: LanguageServiceDefaults; + export const jsonDefaults: LanguageServiceDefaults; } /*--------------------------------------------------------------------------------------------- diff --git a/package-lock.json b/package-lock.json index 81cd2ce9..c0fbd147 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4019,9 +4019,9 @@ "dev": true }, "monaco-json": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/monaco-json/-/monaco-json-2.9.0.tgz", - "integrity": "sha512-cpFu3qn3lyEk4B5KjD2kfzEf75QZPrOgoTs2VOyydeXdQ+9IjsnR617lYbLldOI6PGkfZMMp771TBkAvWntiMg==", + "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==", "dev": true }, "monaco-languages": { diff --git a/package.json b/package.json index 3bbbb327..c2dc6355 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "monaco-css": "2.7.0", "monaco-editor-core": "0.20.0", "monaco-html": "2.7.0", - "monaco-json": "2.9.0", + "monaco-json": "3.0.1", "monaco-languages": "1.10.0", "monaco-typescript": "3.7.0", "playwright": "1.2.0-next.1596653191842", diff --git a/website/playground/monaco.d.ts.txt b/website/playground/monaco.d.ts.txt index 1047328e..968dbbf3 100644 --- a/website/playground/monaco.d.ts.txt +++ b/website/playground/monaco.d.ts.txt @@ -6710,69 +6710,57 @@ declare namespace monaco.languages.json { */ readonly enableSchemaRequest?: boolean; } - export interface ModeConfiguration { /** * Defines whether the built-in documentFormattingEdit provider is enabled. */ readonly documentFormattingEdits?: boolean; - /** * Defines whether the built-in documentRangeFormattingEdit provider is enabled. */ readonly documentRangeFormattingEdits?: boolean; - /** * 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 tokens provider is enabled. */ readonly tokens?: 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 jsonDefaults: LanguageServiceDefaults; + export const jsonDefaults: LanguageServiceDefaults; } /*---------------------------------------------------------------------------------------------