From 3a6cbe0787bfc2a06543e5ae786dc2ec551e1dd3 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 2 Feb 2022 23:14:43 +0100 Subject: [PATCH] Avoid using `metadata.js` in `build.js` --- build/build.js | 8 +- build/release.js | 118 +-- build/utils.js | 4 +- metadata.js | 50 +- website/playground/monaco.d.ts.txt | 1316 ++++++++++++++-------------- website/typedoc/monaco.d.ts | 1316 ++++++++++++++-------------- 6 files changed, 1386 insertions(+), 1426 deletions(-) diff --git a/build/build.js b/build/build.js index efed0141..f4b71e06 100644 --- a/build/build.js +++ b/build/build.js @@ -17,22 +17,22 @@ tsc(`src/tsconfig.json`); dts( `out/amd/language/css/monaco.contribution.d.ts`, - `out/release/language/css/monaco.d.ts`, + `out/release/css.d.ts`, 'monaco.languages.css' ); dts( `out/amd/language/html/monaco.contribution.d.ts`, - `out/release/language/html/monaco.d.ts`, + `out/release/html.d.ts`, 'monaco.languages.html' ); dts( `out/amd/language/json/monaco.contribution.d.ts`, - `out/release/language/json/monaco.d.ts`, + `out/release/json.d.ts`, 'monaco.languages.json' ); dts( `out/amd/language/typescript/monaco.contribution.d.ts`, - `out/release/language/typescript/monaco.d.ts`, + `out/release/typescript.d.ts`, 'monaco.languages.typescript' ); diff --git a/build/release.js b/build/release.js index 98941989..2c3b0fdf 100644 --- a/build/release.js +++ b/build/release.js @@ -5,12 +5,6 @@ //@ts-check -/** - * @typedef { { src:string; built:string; releaseDev:string; releaseMin:string; } } ICorePaths - * @typedef { { dev:string; min:string; esm: string; } } IPluginPaths - * @typedef { { name:string; contrib:string; modulePrefix:string; rootPath:string; paths:IPluginPaths } } IPlugin - * @typedef { { METADATA: {CORE:{paths:ICorePaths}; PLUGINS:IPlugin[];} } } IMetadata - */ /** @typedef {import('../build/utils').IFile} IFile */ const path = require('path'); @@ -18,8 +12,6 @@ const fs = require('fs'); const { REPO_ROOT, readFiles, writeFiles } = require('../build/utils'); const { removeDir } = require('../build/fs'); const ts = require('typescript'); -/**@type { IMetadata } */ -const metadata = require('../metadata.js'); const { generateMetadata } = require('./releaseMetadata'); removeDir(`release`); @@ -85,24 +77,11 @@ function AMD_releaseOne(type) { AMD_addPluginContribs(type, coreFiles); writeFiles(coreFiles, `release/${type}`); - for (const plugin of metadata.METADATA.PLUGINS) { - AMD_releasePlugin(plugin, type, `release/${type}`); - } -} - -/** - * Release a plugin to `dev` or `min`. - * @param {IPlugin} plugin - * @param {'dev'|'min'} type - * @param {string} destinationPath - */ -function AMD_releasePlugin(plugin, type, destinationPath) { - const pluginPath = path.join(plugin.rootPath, plugin.paths[type]); // dev or min - const contribPath = - path.join(pluginPath, plugin.contrib.substring(plugin.modulePrefix.length)) + '.js'; - - const files = readFiles(`${pluginPath}/**/*`, { base: pluginPath, ignore: [contribPath] }); - writeFiles(files, path.join(destinationPath, plugin.modulePrefix)); + const pluginFiles = readFiles(`out/release/${type}/**/*`, { + base: `out/release/${type}`, + ignore: ['**/monaco.contribution.js'] + }); + writeFiles(pluginFiles, `release/${type}`); } /** @@ -125,25 +104,21 @@ function AMD_addPluginContribs(type, files) { // Rename the AMD module 'vs/editor/editor.main' to 'vs/editor/edcore.main' contents = contents.replace(/"vs\/editor\/editor\.main\"/, '"vs/editor/edcore.main"'); - /** @type {string[]} */ - let extraContent = []; - /** @type {string[]} */ - let allPluginsModuleIds = []; - - metadata.METADATA.PLUGINS.forEach(function (plugin) { - allPluginsModuleIds.push(plugin.contrib); - const pluginPath = path.join(plugin.rootPath, plugin.paths[type]); // dev or min - const contribPath = - path.join(REPO_ROOT, pluginPath, plugin.contrib.substring(plugin.modulePrefix.length)) + - '.js'; - let contribContents = fs.readFileSync(contribPath).toString(); - - contribContents = contribContents.replace( - /define\((['"][a-z\/\-]+\/fillers\/monaco-editor-core['"]),\[\],/, - "define($1,['vs/editor/editor.api']," - ); - - extraContent.push(contribContents); + const pluginFiles = readFiles(`out/release/${type}/**/monaco.contribution.js`, { + base: `out/release/${type}` + }); + + const extraContent = pluginFiles.map((file) => { + return file.contents + .toString() + .replace( + /define\((['"][a-z\/\-]+\/fillers\/monaco-editor-core['"]),\[\],/, + "define($1,['vs/editor/editor.api']," + ); + }); + + const allPluginsModuleIds = pluginFiles.map((file) => { + return file.path.replace(/\.js$/, ''); }); extraContent.push( @@ -176,22 +151,16 @@ function ESM_release() { ESM_addPluginContribs(coreFiles); writeFiles(coreFiles, `release/esm`); - for (const plugin of metadata.METADATA.PLUGINS) { - ESM_releasePlugin(plugin, `release/esm`); - } + ESM_releasePlugins(); } /** * Release a plugin to `esm`. * Adds a dependency to 'vs/editor/editor.api' in contrib files in order for `monaco` to be defined. * Rewrites imports for 'monaco-editor-core/**' - * @param {IPlugin} plugin - * @param {string} destinationPath */ -function ESM_releasePlugin(plugin, destinationPath) { - const pluginPath = path.join(plugin.rootPath, plugin.paths['esm']); - - const files = readFiles(`${pluginPath}/**/*`, { base: pluginPath }); +function ESM_releasePlugins() { + const files = readFiles(`out/release/esm/**/*`, { base: 'out/release/esm/' }); for (const file of files) { if (!/(\.js$)|(\.ts$)/.test(file.path)) { @@ -217,10 +186,9 @@ function ESM_releasePlugin(plugin, destinationPath) { importText = 'monaco-editor-core/esm/vs/editor/editor.api'; } - const myFileDestPath = path.join(plugin.modulePrefix, file.path); const importFilePath = importText.substring('monaco-editor-core/esm/'.length); let relativePath = path - .relative(path.dirname(myFileDestPath), importFilePath) + .relative(path.dirname(file.path), importFilePath) .replace(/\\/g, '/'); if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) { relativePath = './' + relativePath; @@ -238,9 +206,8 @@ function ESM_releasePlugin(plugin, destinationPath) { continue; } - const myFileDestPath = path.join(plugin.modulePrefix, file.path); const apiFilePath = 'vs/editor/editor.api'; - let relativePath = path.relative(path.dirname(myFileDestPath), apiFilePath).replace(/\\/g, '/'); + let relativePath = path.relative(path.dirname(file.path), apiFilePath).replace(/\\/g, '/'); if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) { relativePath = './' + relativePath; } @@ -251,7 +218,7 @@ function ESM_releasePlugin(plugin, destinationPath) { } ESM_addImportSuffix(files); - writeFiles(files, path.join(destinationPath, plugin.modulePrefix)); + writeFiles(files, `release/esm`); } /** @@ -299,20 +266,20 @@ function ESM_addPluginContribs(files) { const mainFileDestPath = 'vs/editor/editor.main.js'; - /** @type {string[]} */ - let mainFileImports = []; - for (const plugin of metadata.METADATA.PLUGINS) { - const contribDestPath = plugin.contrib; - + const mainFileImports = readFiles(`out/release/esm/**/monaco.contribution.js`, { + base: `out/release/esm` + }).map((file) => { let relativePath = path - .relative(path.dirname(mainFileDestPath), contribDestPath) - .replace(/\\/g, '/'); + .relative(path.dirname(mainFileDestPath), file.path) + .replace(/\\/g, '/') + .replace(/\.js$/, ''); + if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) { relativePath = './' + relativePath; } - mainFileImports.push(relativePath); - } + return relativePath; + }); const mainFileContents = mainFileImports.map((name) => `import '${name}';`).join('\n') + @@ -335,17 +302,10 @@ function releaseDTS() { let contents = monacodts.contents.toString(); - /** @type {string[]} */ - const extraContent = []; - metadata.METADATA.PLUGINS.forEach(function (plugin) { - const dtsPath = path.join(plugin.rootPath, './monaco.d.ts'); - try { - let plugindts = fs.readFileSync(dtsPath).toString(); - plugindts = plugindts.replace(/\/\/\/ { + return file.contents.toString().replace(/\/\/\/ { - [index: string]: T; - } - type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | null | undefined; - interface CompilerOptions { - allowJs?: boolean; - allowSyntheticDefaultImports?: boolean; - allowUmdGlobalAccess?: boolean; - allowUnreachableCode?: boolean; - allowUnusedLabels?: boolean; - alwaysStrict?: boolean; - baseUrl?: string; - charset?: string; - checkJs?: boolean; - declaration?: boolean; - declarationMap?: boolean; - emitDeclarationOnly?: boolean; - declarationDir?: string; - disableSizeLimit?: boolean; - disableSourceOfProjectReferenceRedirect?: boolean; - downlevelIteration?: boolean; - emitBOM?: boolean; - emitDecoratorMetadata?: boolean; - experimentalDecorators?: boolean; - forceConsistentCasingInFileNames?: boolean; - importHelpers?: boolean; - inlineSourceMap?: boolean; - inlineSources?: boolean; - isolatedModules?: boolean; - jsx?: JsxEmit; - keyofStringsOnly?: boolean; - lib?: string[]; - locale?: string; - mapRoot?: string; - maxNodeModuleJsDepth?: number; - module?: ModuleKind; - moduleResolution?: ModuleResolutionKind; - newLine?: NewLineKind; - noEmit?: boolean; - noEmitHelpers?: boolean; - noEmitOnError?: boolean; - noErrorTruncation?: boolean; - noFallthroughCasesInSwitch?: boolean; - noImplicitAny?: boolean; - noImplicitReturns?: boolean; - noImplicitThis?: boolean; - noStrictGenericChecks?: boolean; - noUnusedLocals?: boolean; - noUnusedParameters?: boolean; - noImplicitUseStrict?: boolean; - noLib?: boolean; - noResolve?: boolean; - out?: string; - outDir?: string; - outFile?: string; - paths?: MapLike; - preserveConstEnums?: boolean; - preserveSymlinks?: boolean; - project?: string; - reactNamespace?: string; - jsxFactory?: string; - composite?: boolean; - removeComments?: boolean; - rootDir?: string; - rootDirs?: string[]; - skipLibCheck?: boolean; - skipDefaultLibCheck?: boolean; - sourceMap?: boolean; - sourceRoot?: string; - strict?: boolean; - strictFunctionTypes?: boolean; - strictBindCallApply?: boolean; - strictNullChecks?: boolean; - strictPropertyInitialization?: boolean; - stripInternal?: boolean; - suppressExcessPropertyErrors?: boolean; - suppressImplicitAnyIndexErrors?: boolean; - target?: ScriptTarget; - traceResolution?: boolean; - resolveJsonModule?: boolean; - types?: string[]; - /** Paths used to compute primary types search locations */ - typeRoots?: string[]; - esModuleInterop?: boolean; - useDefineForClassFields?: boolean; - [option: string]: CompilerOptionsValue | undefined; - } - export interface DiagnosticsOptions { - noSemanticValidation?: boolean; - noSyntaxValidation?: boolean; - noSuggestionDiagnostics?: boolean; +declare namespace monaco.languages.css { + export interface Options { + 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'; + }; /** - * Limit diagnostic computation to only visible files. - * Defaults to false. + * Configures the CSS data types known by the langauge service. */ - onlyVisible?: 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; + readonly data?: CSSDataConfiguration; } - interface InlayHintsOptions { - readonly includeInlayParameterNameHints?: 'none' | 'literals' | 'all'; - readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; - readonly includeInlayFunctionParameterTypeHints?: boolean; - readonly includeInlayVariableTypeHints?: boolean; - readonly includeInlayPropertyDeclarationTypeHints?: boolean; - readonly includeInlayFunctionLikeReturnTypeHints?: boolean; - readonly includeInlayEnumMemberValueHints?: boolean; + 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; } - interface IExtraLib { - content: string; - version: number; + export interface LanguageServiceDefaults { + readonly languageId: string; + readonly onDidChange: IEvent; + readonly modeConfiguration: ModeConfiguration; + readonly options: Options; + setOptions(options: Options): void; + setModeConfiguration(modeConfiguration: ModeConfiguration): void; + /** @deprecated Use options instead */ + readonly diagnosticsOptions: DiagnosticsOptions; + /** @deprecated Use setOptions instead */ + setDiagnosticsOptions(options: DiagnosticsOptions): void; } - export interface IExtraLibs { - [path: string]: IExtraLib; + /** @deprecated Use Options instead */ + export type DiagnosticsOptions = Options; + export const cssDefaults: LanguageServiceDefaults; + export const scssDefaults: LanguageServiceDefaults; + export const lessDefaults: LanguageServiceDefaults; + export interface CSSDataConfiguration { + /** + * Defines whether the standard CSS properties, at-directives, pseudoClasses and pseudoElements are shown. + */ + useDefaultDataProvider?: boolean; + /** + * Provides a set of custom data providers. + */ + dataProviders?: { + [providerId: string]: CSSDataV1; + }; } /** - * 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. + * Custom CSS properties, at-directives, pseudoClasses and pseudoElements + * https://github.com/microsoft/vscode-css-languageservice/blob/main/docs/customData.md */ - interface DiagnosticMessageChain { - messageText: string; - /** Diagnostic category: warning = 0, error = 1, suggestion = 2, message = 3 */ - category: 0 | 1 | 2 | 3; - code: number; - next?: DiagnosticMessageChain[]; + export interface CSSDataV1 { + version: 1 | 1.1; + properties?: IPropertyData[]; + atDirectives?: IAtDirectiveData[]; + pseudoClasses?: IPseudoClassData[]; + pseudoElements?: IPseudoElementData[]; } - 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?: {}; - reportsDeprecated?: {}; - source?: string; - relatedInformation?: DiagnosticRelatedInformation[]; + export type EntryStatus = 'standard' | 'experimental' | 'nonstandard' | 'obsolete'; + export interface IReference { + name: string; + url: string; + } + export interface IPropertyData { + name: string; + description?: string | MarkupContent; + browsers?: string[]; + restrictions?: string[]; + status?: EntryStatus; + syntax?: string; + values?: IValueData[]; + references?: IReference[]; + relevance?: number; + } + export interface IAtDirectiveData { + name: string; + description?: string | MarkupContent; + browsers?: string[]; + status?: EntryStatus; + references?: IReference[]; } - export interface DiagnosticRelatedInformation { - /** Diagnostic category: warning = 0, error = 1, suggestion = 2, message = 3 */ - category: 0 | 1 | 2 | 3; - code: number; - /** TypeScriptWorker removes all but the `fileName` property to avoid serializing circular JSON structures. */ - file: { - fileName: string; - } | undefined; - start: number | undefined; - length: number | undefined; - messageText: string | DiagnosticMessageChain; + export interface IPseudoClassData { + name: string; + description?: string | MarkupContent; + browsers?: string[]; + status?: EntryStatus; + references?: IReference[]; } - interface EmitOutput { - outputFiles: OutputFile[]; - emitSkipped: boolean; + export interface IPseudoElementData { + name: string; + description?: string | MarkupContent; + browsers?: string[]; + status?: EntryStatus; + references?: IReference[]; } - interface OutputFile { + export interface IValueData { name: string; - writeByteOrderMark: boolean; - text: string; + description?: string | MarkupContent; + browsers?: string[]; + status?: EntryStatus; + references?: IReference[]; } - export interface LanguageServiceDefaults { + export interface MarkupContent { + kind: MarkupKind; + value: string; + } + export type MarkupKind = 'plaintext' | 'markdown'; +} + +/*--------------------------------------------------------------------------------------------- + * 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.html { + export interface HTMLFormatConfiguration { + readonly tabSize: number; + readonly insertSpaces: boolean; + readonly wrapLineLength: number; + readonly unformatted: string; + readonly contentUnformatted: string; + readonly indentInnerHtml: boolean; + readonly preserveNewLines: boolean; + readonly maxPreserveNewLines: number | undefined; + readonly indentHandlebars: boolean; + readonly endWithNewline: boolean; + readonly extraLiners: string; + readonly wrapAttributes: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline'; + } + export interface CompletionConfiguration { + readonly [providerId: string]: boolean; + } + export interface Options { /** - * Event fired when compiler options or diagnostics options are changed. + * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. */ - readonly onDidChange: IEvent; + readonly format?: HTMLFormatConfiguration; /** - * Event fired when extra libraries registered with the language service change. + * A list of known schemas and/or associations of schemas to file names. */ - readonly onDidExtraLibsChange: IEvent; - readonly workerOptions: WorkerOptions; - readonly inlayHintsOptions: InlayHintsOptions; + readonly suggest?: CompletionConfiguration; /** - * Get the current extra libs registered with the language service. + * Configures the HTML data types known by the HTML langauge service. */ - getExtraLibs(): IExtraLibs; + readonly data?: HTMLDataConfiguration; + } + export interface ModeConfiguration { /** - * Add an additional source file to the language service. Use this - * for typescript (definition) files that won't be loaded as editor - * documents, like `jquery.d.ts`. - * - * @param content The file content - * @param filePath An optional file path - * @returns A disposable which will remove the file from the - * language service upon disposal. + * Defines whether the built-in completionItemProvider is enabled. */ - addExtraLib(content: string, filePath?: string): IDisposable; + readonly completionItems?: boolean; /** - * 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. + * Defines whether the built-in hoverProvider is enabled. */ - setExtraLibs(libs: { - content: string; - filePath?: string; - }[]): void; + readonly hovers?: boolean; /** - * Get current TypeScript compiler options for the language service. + * Defines whether the built-in documentSymbolProvider is enabled. */ - getCompilerOptions(): CompilerOptions; + readonly documentSymbols?: boolean; /** - * Set TypeScript compiler options. + * Defines whether the built-in definitions provider is enabled. */ - setCompilerOptions(options: CompilerOptions): void; + readonly links?: boolean; /** - * Get the current diagnostics options for the language service. + * Defines whether the built-in references provider is enabled. */ - getDiagnosticsOptions(): DiagnosticsOptions; + readonly documentHighlights?: boolean; /** - * Configure whether syntactic and/or semantic validation should - * be performed + * Defines whether the built-in rename provider is enabled. */ - setDiagnosticsOptions(options: DiagnosticsOptions): void; + readonly rename?: boolean; /** - * Configure webworker options + * Defines whether the built-in color provider is enabled. */ - setWorkerOptions(options: WorkerOptions): void; + readonly colors?: boolean; /** - * No-op. + * Defines whether the built-in foldingRange provider is enabled. */ - setMaximumWorkerIdleTime(value: number): void; + readonly foldingRanges?: boolean; /** - * Configure if all existing models should be eagerly sync'd - * to the worker on start or restart. + * Defines whether the built-in diagnostic provider is enabled. */ - setEagerModelSync(value: boolean): void; + readonly diagnostics?: boolean; /** - * Get the current setting for whether all existing models should be eagerly sync'd - * to the worker on start or restart. + * Defines whether the built-in selection range provider is enabled. */ - getEagerModelSync(): boolean; + readonly selectionRanges?: boolean; /** - * Configure inlay hints options. + * Defines whether the built-in documentFormattingEdit provider is enabled. */ - setInlayHintsOptions(options: InlayHintsOptions): void; - } - export interface TypeScriptWorker { + readonly documentFormattingEdits?: boolean; /** - * Get diagnostic messages for any syntax issues in the given file. + * Defines whether the built-in documentRangeFormattingEdit provider is enabled. */ - getSyntacticDiagnostics(fileName: string): Promise; + readonly documentRangeFormattingEdits?: boolean; + } + export interface LanguageServiceDefaults { + readonly languageId: string; + readonly modeConfiguration: ModeConfiguration; + readonly onDidChange: IEvent; + readonly options: Options; + setOptions(options: Options): void; + setModeConfiguration(modeConfiguration: ModeConfiguration): void; + } + export const htmlLanguageService: LanguageServiceRegistration; + export const htmlDefaults: LanguageServiceDefaults; + export const handlebarLanguageService: LanguageServiceRegistration; + export const handlebarDefaults: LanguageServiceDefaults; + export const razorLanguageService: LanguageServiceRegistration; + export const razorDefaults: LanguageServiceDefaults; + export interface LanguageServiceRegistration extends IDisposable { + readonly defaults: LanguageServiceDefaults; + } + /** + * Registers a new HTML language service for the languageId. + * Note: 'html', 'handlebar' and 'razor' are registered by default. + * + * Use this method to register additional language ids with a HTML service. + * The language server has to be registered before an editor model is opened. + */ + export function registerHTMLLanguageService(languageId: string, options?: Options, modeConfiguration?: ModeConfiguration): LanguageServiceRegistration; + export interface HTMLDataConfiguration { /** - * Get diagnostic messages for any semantic issues in the given file. + * Defines whether the standard HTML tags and attributes are shown */ - getSemanticDiagnostics(fileName: string): Promise; + readonly useDefaultDataProvider?: boolean; /** - * Get diagnostic messages for any suggestions related to the given file. + * Provides a set of custom data providers. */ - getSuggestionDiagnostics(fileName: string): Promise; + readonly dataProviders?: { + [providerId: string]: HTMLDataV1; + }; + } + /** + * Custom HTML tags attributes and attribute values + * https://github.com/microsoft/vscode-html-languageservice/blob/main/docs/customData.md + */ + export interface HTMLDataV1 { + readonly version: 1 | 1.1; + readonly tags?: ITagData[]; + readonly globalAttributes?: IAttributeData[]; + readonly valueSets?: IValueSet[]; + } + export interface IReference { + readonly name: string; + readonly url: string; + } + export interface ITagData { + readonly name: string; + readonly description?: string | MarkupContent; + readonly attributes: IAttributeData[]; + readonly references?: IReference[]; + } + export interface IAttributeData { + readonly name: string; + readonly description?: string | MarkupContent; + readonly valueSet?: string; + readonly values?: IValueData[]; + readonly references?: IReference[]; + } + export interface IValueData { + readonly name: string; + readonly description?: string | MarkupContent; + readonly references?: IReference[]; + } + export interface IValueSet { + readonly name: string; + readonly values: IValueData[]; + } + export interface MarkupContent { + readonly kind: MarkupKind; + readonly value: string; + } + export type MarkupKind = 'plaintext' | 'markdown'; +} + +/*--------------------------------------------------------------------------------------------- + * 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 { /** - * Get the content of a given file. + * If set, the validator will be enabled and perform syntax and schema based validation, + * unless `DiagnosticsOptions.schemaValidation` is set to `ignore`. */ - getScriptText(fileName: string): Promise; + readonly validate?: boolean; /** - * Get diagnostic messages related to the current compiler options. - * @param fileName Not used + * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. + * `DiagnosticsOptions.allowComments` will override this setting. */ - getCompilerOptionsDiagnostics(fileName: string): Promise; + readonly allowComments?: boolean; /** - * Get code completions for the given file and position. - * @returns `Promise` + * A list of known schemas and/or associations of schemas to file names. */ - getCompletionsAtPosition(fileName: string, position: number): Promise; + readonly schemas?: { + /** + * The URI of the schema, which is also the identifier of the schema. + */ + readonly uri: string; + /** + * A list of glob patterns that describe for which file URIs the JSON schema will be used. + * '*' and '**' wildcards are supported. Exclusion patterns start with '!'. + * For example '*.schema.json', 'package.json', '!foo*.schema.json', 'foo/**\/BADRESP.json'. + * A match succeeds when there is at least one pattern matching and last matching pattern does not start with '!'. + */ + readonly fileMatch?: string[]; + /** + * The schema for the given URI. + */ + readonly schema?: any; + }[]; /** - * Get code completion details for the given file, position, and entry. - * @returns `Promise` + * If set, the schema service would load schema content on-demand with 'fetch' if available */ - getCompletionEntryDetails(fileName: string, position: number, entry: string): Promise; + readonly enableSchemaRequest?: boolean; /** - * Get signature help items for the item at the given file and position. - * @returns `Promise` + * The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used. */ - getSignatureHelpItems(fileName: string, position: number, options: any): Promise; + readonly schemaValidation?: SeverityLevel; /** - * Get quick info for the item at the given position in the file. - * @returns `Promise` + * The severity of problems that occurred when resolving and loading schemas. If set to 'ignore', schema resolving problems are not reported. If not set, 'warning' is used. */ - getQuickInfoAtPosition(fileName: string, position: number): Promise; + readonly schemaRequest?: SeverityLevel; /** - * Get other ranges which are related to the item at the given position in the file (often used for highlighting). - * @returns `Promise | undefined>` + * The severity of reported trailing commas. If not set, trailing commas will be reported as errors. */ - getOccurrencesAtPosition(fileName: string, position: number): Promise | undefined>; + readonly trailingCommas?: SeverityLevel; /** - * Get the definition of the item at the given position in the file. - * @returns `Promise | undefined>` + * The severity of reported comments. If not set, 'DiagnosticsOptions.allowComments' defines whether comments are ignored or reported as errors. */ - getDefinitionAtPosition(fileName: string, position: number): Promise | undefined>; + readonly comments?: SeverityLevel; + } + export type SeverityLevel = 'error' | 'warning' | 'ignore'; + export interface ModeConfiguration { /** - * Get references to the item at the given position in the file. - * @returns `Promise` + * Defines whether the built-in documentFormattingEdit provider is enabled. */ - getReferencesAtPosition(fileName: string, position: number): Promise; + readonly documentFormattingEdits?: boolean; /** - * Get outline entries for the item at the given position in the file. - * @returns `Promise` + * Defines whether the built-in documentRangeFormattingEdit provider is enabled. */ - getNavigationBarItems(fileName: string): Promise; + readonly documentRangeFormattingEdits?: boolean; /** - * Get changes which should be applied to format the given file. - * @param options `typescript.FormatCodeOptions` - * @returns `Promise` + * Defines whether the built-in completionItemProvider is enabled. */ - getFormattingEditsForDocument(fileName: string, options: any): Promise; + readonly completionItems?: boolean; /** - * Get changes which should be applied to format the given range in the file. - * @param options `typescript.FormatCodeOptions` - * @returns `Promise` + * Defines whether the built-in hoverProvider is enabled. */ - getFormattingEditsForRange(fileName: string, start: number, end: number, options: any): Promise; + readonly hovers?: boolean; /** - * Get formatting changes which should be applied after the given keystroke. - * @param options `typescript.FormatCodeOptions` - * @returns `Promise` + * Defines whether the built-in documentSymbolProvider is enabled. */ - getFormattingEditsAfterKeystroke(fileName: string, postion: number, ch: string, options: any): Promise; + readonly documentSymbols?: boolean; /** - * Get other occurrences which should be updated when renaming the item at the given file and position. - * @returns `Promise` + * Defines whether the built-in tokens provider is enabled. */ - findRenameLocations(fileName: string, positon: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename: boolean): Promise; + readonly tokens?: boolean; /** - * 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` + * Defines whether the built-in color provider is enabled. */ - getRenameInfo(fileName: string, positon: number, options: any): Promise; + readonly colors?: boolean; /** - * Get transpiled output for the given file. - * @returns `typescript.EmitOutput` + * Defines whether the built-in foldingRange provider is enabled. */ - getEmitOutput(fileName: string): Promise; + readonly foldingRanges?: boolean; /** - * Get possible code fixes at the given position in the file. - * @param formatOptions `typescript.FormatCodeOptions` - * @returns `Promise>` + * Defines whether the built-in diagnostic provider is enabled. */ - getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: any): Promise>; + readonly diagnostics?: boolean; /** - * Get inlay hints in the range of the file. - * @param fileName - * @returns `Promise` + * Defines whether the built-in selection range provider is enabled. */ - provideInlayHints(fileName: string, start: number, end: number): Promise>; + readonly selectionRanges?: boolean; } - 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 interface LanguageServiceDefaults { + readonly languageId: string; + readonly onDidChange: IEvent; + readonly diagnosticsOptions: DiagnosticsOptions; + readonly modeConfiguration: ModeConfiguration; + setDiagnosticsOptions(options: DiagnosticsOptions): void; + setModeConfiguration(modeConfiguration: ModeConfiguration): void; + } + export const jsonDefaults: LanguageServiceDefaults; } /*--------------------------------------------------------------------------------------------- @@ -7526,446 +7582,390 @@ declare namespace monaco.languages.typescript { * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -declare namespace monaco.languages.css { - export interface Options { - 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'; - }; - /** - * Configures the CSS data types known by the langauge service. - */ - readonly data?: CSSDataConfiguration; +declare namespace monaco.languages.typescript { + export enum ModuleKind { + None = 0, + CommonJS = 1, + AMD = 2, + UMD = 3, + System = 4, + ES2015 = 5, + ESNext = 99 + } + export enum JsxEmit { + None = 0, + Preserve = 1, + React = 2, + ReactNative = 3, + ReactJSX = 4, + ReactJSXDev = 5 + } + export enum NewLineKind { + CarriageReturnLineFeed = 0, + LineFeed = 1 + } + export enum ScriptTarget { + ES3 = 0, + ES5 = 1, + ES2015 = 2, + ES2016 = 3, + ES2017 = 4, + ES2018 = 5, + ES2019 = 6, + ES2020 = 7, + ESNext = 99, + JSON = 100, + 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; + interface CompilerOptions { + allowJs?: boolean; + allowSyntheticDefaultImports?: boolean; + allowUmdGlobalAccess?: boolean; + allowUnreachableCode?: boolean; + allowUnusedLabels?: boolean; + alwaysStrict?: boolean; + baseUrl?: string; + charset?: string; + checkJs?: boolean; + declaration?: boolean; + declarationMap?: boolean; + emitDeclarationOnly?: boolean; + declarationDir?: string; + disableSizeLimit?: boolean; + disableSourceOfProjectReferenceRedirect?: boolean; + downlevelIteration?: boolean; + emitBOM?: boolean; + emitDecoratorMetadata?: boolean; + experimentalDecorators?: boolean; + forceConsistentCasingInFileNames?: boolean; + importHelpers?: boolean; + inlineSourceMap?: boolean; + inlineSources?: boolean; + isolatedModules?: boolean; + jsx?: JsxEmit; + keyofStringsOnly?: boolean; + lib?: string[]; + locale?: string; + mapRoot?: string; + maxNodeModuleJsDepth?: number; + module?: ModuleKind; + moduleResolution?: ModuleResolutionKind; + newLine?: NewLineKind; + noEmit?: boolean; + noEmitHelpers?: boolean; + noEmitOnError?: boolean; + noErrorTruncation?: boolean; + noFallthroughCasesInSwitch?: boolean; + noImplicitAny?: boolean; + noImplicitReturns?: boolean; + noImplicitThis?: boolean; + noStrictGenericChecks?: boolean; + noUnusedLocals?: boolean; + noUnusedParameters?: boolean; + noImplicitUseStrict?: boolean; + noLib?: boolean; + noResolve?: boolean; + out?: string; + outDir?: string; + outFile?: string; + paths?: MapLike; + preserveConstEnums?: boolean; + preserveSymlinks?: boolean; + project?: string; + reactNamespace?: string; + jsxFactory?: string; + composite?: boolean; + removeComments?: boolean; + rootDir?: string; + rootDirs?: string[]; + skipLibCheck?: boolean; + skipDefaultLibCheck?: boolean; + sourceMap?: boolean; + sourceRoot?: string; + strict?: boolean; + strictFunctionTypes?: boolean; + strictBindCallApply?: boolean; + strictNullChecks?: boolean; + strictPropertyInitialization?: boolean; + stripInternal?: boolean; + suppressExcessPropertyErrors?: boolean; + suppressImplicitAnyIndexErrors?: boolean; + target?: ScriptTarget; + traceResolution?: boolean; + resolveJsonModule?: boolean; + types?: string[]; + /** Paths used to compute primary types search locations */ + typeRoots?: string[]; + esModuleInterop?: boolean; + useDefineForClassFields?: boolean; + [option: string]: CompilerOptionsValue | undefined; } - 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; + export interface DiagnosticsOptions { + noSemanticValidation?: boolean; + noSyntaxValidation?: boolean; + noSuggestionDiagnostics?: boolean; /** - * Defines whether the built-in selection range provider is enabled. + * Limit diagnostic computation to only visible files. + * Defaults to false. */ - readonly selectionRanges?: boolean; + onlyVisible?: boolean; + diagnosticCodesToIgnore?: number[]; } - export interface LanguageServiceDefaults { - readonly languageId: string; - readonly onDidChange: IEvent; - readonly modeConfiguration: ModeConfiguration; - readonly options: Options; - setOptions(options: Options): void; - setModeConfiguration(modeConfiguration: ModeConfiguration): void; - /** @deprecated Use options instead */ - readonly diagnosticsOptions: DiagnosticsOptions; - /** @deprecated Use setOptions instead */ - setDiagnosticsOptions(options: DiagnosticsOptions): void; + 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; } - /** @deprecated Use Options instead */ - export type DiagnosticsOptions = Options; - export const cssDefaults: LanguageServiceDefaults; - export const scssDefaults: LanguageServiceDefaults; - export const lessDefaults: LanguageServiceDefaults; - export interface CSSDataConfiguration { - /** - * Defines whether the standard CSS properties, at-directives, pseudoClasses and pseudoElements are shown. - */ - useDefaultDataProvider?: boolean; - /** - * Provides a set of custom data providers. - */ - dataProviders?: { - [providerId: string]: CSSDataV1; - }; + interface InlayHintsOptions { + readonly includeInlayParameterNameHints?: 'none' | 'literals' | 'all'; + readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; + readonly includeInlayFunctionParameterTypeHints?: boolean; + readonly includeInlayVariableTypeHints?: boolean; + readonly includeInlayPropertyDeclarationTypeHints?: boolean; + readonly includeInlayFunctionLikeReturnTypeHints?: boolean; + readonly includeInlayEnumMemberValueHints?: boolean; } - /** - * Custom CSS properties, at-directives, pseudoClasses and pseudoElements - * https://github.com/microsoft/vscode-css-languageservice/blob/main/docs/customData.md - */ - export interface CSSDataV1 { - version: 1 | 1.1; - properties?: IPropertyData[]; - atDirectives?: IAtDirectiveData[]; - pseudoClasses?: IPseudoClassData[]; - pseudoElements?: IPseudoElementData[]; + interface IExtraLib { + content: string; + version: number; } - export type EntryStatus = 'standard' | 'experimental' | 'nonstandard' | 'obsolete'; - export interface IReference { - name: string; - url: string; + export interface IExtraLibs { + [path: string]: IExtraLib; } - export interface IPropertyData { - name: string; - description?: string | MarkupContent; - browsers?: string[]; - restrictions?: string[]; - status?: EntryStatus; - syntax?: string; - values?: IValueData[]; - references?: IReference[]; - relevance?: number; + /** + * 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. + */ + interface DiagnosticMessageChain { + messageText: string; + /** Diagnostic category: warning = 0, error = 1, suggestion = 2, message = 3 */ + category: 0 | 1 | 2 | 3; + code: number; + next?: DiagnosticMessageChain[]; } - export interface IAtDirectiveData { - name: string; - description?: string | MarkupContent; - browsers?: string[]; - status?: EntryStatus; - references?: IReference[]; + 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?: {}; + reportsDeprecated?: {}; + source?: string; + relatedInformation?: DiagnosticRelatedInformation[]; } - export interface IPseudoClassData { - name: string; - description?: string | MarkupContent; - browsers?: string[]; - status?: EntryStatus; - references?: IReference[]; + export interface DiagnosticRelatedInformation { + /** Diagnostic category: warning = 0, error = 1, suggestion = 2, message = 3 */ + category: 0 | 1 | 2 | 3; + code: number; + /** TypeScriptWorker removes all but the `fileName` property to avoid serializing circular JSON structures. */ + file: { + fileName: string; + } | undefined; + start: number | undefined; + length: number | undefined; + messageText: string | DiagnosticMessageChain; } - export interface IPseudoElementData { - name: string; - description?: string | MarkupContent; - browsers?: string[]; - status?: EntryStatus; - references?: IReference[]; + interface EmitOutput { + outputFiles: OutputFile[]; + emitSkipped: boolean; } - export interface IValueData { + interface OutputFile { name: string; - description?: string | MarkupContent; - browsers?: string[]; - status?: EntryStatus; - references?: IReference[]; - } - export interface MarkupContent { - kind: MarkupKind; - value: string; + writeByteOrderMark: boolean; + text: string; } - export type MarkupKind = 'plaintext' | 'markdown'; -} - -/*--------------------------------------------------------------------------------------------- - * 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 { + export interface LanguageServiceDefaults { /** - * If set, the validator will be enabled and perform syntax and schema based validation, - * unless `DiagnosticsOptions.schemaValidation` is set to `ignore`. + * Event fired when compiler options or diagnostics options are changed. */ - readonly validate?: boolean; + readonly onDidChange: IEvent; /** - * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. - * `DiagnosticsOptions.allowComments` will override this setting. + * Event fired when extra libraries registered with the language service change. */ - readonly allowComments?: boolean; + readonly onDidExtraLibsChange: IEvent; + readonly workerOptions: WorkerOptions; + readonly inlayHintsOptions: InlayHintsOptions; /** - * A list of known schemas and/or associations of schemas to file names. + * Get the current extra libs registered with the language service. */ - readonly schemas?: { - /** - * The URI of the schema, which is also the identifier of the schema. - */ - readonly uri: string; - /** - * A list of glob patterns that describe for which file URIs the JSON schema will be used. - * '*' and '**' wildcards are supported. Exclusion patterns start with '!'. - * For example '*.schema.json', 'package.json', '!foo*.schema.json', 'foo/**\/BADRESP.json'. - * A match succeeds when there is at least one pattern matching and last matching pattern does not start with '!'. - */ - readonly fileMatch?: string[]; - /** - * The schema for the given URI. - */ - readonly schema?: any; - }[]; + getExtraLibs(): IExtraLibs; /** - * If set, the schema service would load schema content on-demand with 'fetch' if available + * Add an additional source file to the language service. Use this + * for typescript (definition) files that won't be loaded as editor + * documents, like `jquery.d.ts`. + * + * @param content The file content + * @param filePath An optional file path + * @returns A disposable which will remove the file from the + * language service upon disposal. */ - readonly enableSchemaRequest?: boolean; + addExtraLib(content: string, filePath?: string): IDisposable; /** - * The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used. + * 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. */ - readonly schemaValidation?: SeverityLevel; + setExtraLibs(libs: { + content: string; + filePath?: string; + }[]): void; /** - * The severity of problems that occurred when resolving and loading schemas. If set to 'ignore', schema resolving problems are not reported. If not set, 'warning' is used. + * Get current TypeScript compiler options for the language service. */ - readonly schemaRequest?: SeverityLevel; + getCompilerOptions(): CompilerOptions; /** - * The severity of reported trailing commas. If not set, trailing commas will be reported as errors. + * Set TypeScript compiler options. */ - readonly trailingCommas?: SeverityLevel; + setCompilerOptions(options: CompilerOptions): void; /** - * The severity of reported comments. If not set, 'DiagnosticsOptions.allowComments' defines whether comments are ignored or reported as errors. + * Get the current diagnostics options for the language service. */ - readonly comments?: SeverityLevel; - } - export type SeverityLevel = 'error' | 'warning' | 'ignore'; - export interface ModeConfiguration { + getDiagnosticsOptions(): DiagnosticsOptions; /** - * Defines whether the built-in documentFormattingEdit provider is enabled. + * Configure whether syntactic and/or semantic validation should + * be performed */ - readonly documentFormattingEdits?: boolean; + setDiagnosticsOptions(options: DiagnosticsOptions): void; /** - * Defines whether the built-in documentRangeFormattingEdit provider is enabled. + * Configure webworker options */ - readonly documentRangeFormattingEdits?: boolean; + setWorkerOptions(options: WorkerOptions): void; /** - * Defines whether the built-in completionItemProvider is enabled. + * No-op. */ - readonly completionItems?: boolean; + setMaximumWorkerIdleTime(value: number): void; /** - * Defines whether the built-in hoverProvider is enabled. + * Configure if all existing models should be eagerly sync'd + * to the worker on start or restart. */ - readonly hovers?: boolean; + setEagerModelSync(value: boolean): void; /** - * Defines whether the built-in documentSymbolProvider is enabled. + * Get the current setting for whether all existing models should be eagerly sync'd + * to the worker on start or restart. */ - readonly documentSymbols?: boolean; + getEagerModelSync(): boolean; /** - * Defines whether the built-in tokens provider is enabled. + * Configure inlay hints options. */ - readonly tokens?: boolean; + setInlayHintsOptions(options: InlayHintsOptions): void; + } + export interface TypeScriptWorker { /** - * Defines whether the built-in color provider is enabled. + * Get diagnostic messages for any syntax issues in the given file. */ - readonly colors?: boolean; + getSyntacticDiagnostics(fileName: string): Promise; /** - * Defines whether the built-in foldingRange provider is enabled. + * Get diagnostic messages for any semantic issues in the given file. */ - readonly foldingRanges?: boolean; + getSemanticDiagnostics(fileName: string): Promise; /** - * Defines whether the built-in diagnostic provider is enabled. + * Get diagnostic messages for any suggestions related to the given file. */ - readonly diagnostics?: boolean; + getSuggestionDiagnostics(fileName: string): Promise; /** - * Defines whether the built-in selection range provider is enabled. + * Get the content of a given file. */ - 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 const jsonDefaults: 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.html { - export interface HTMLFormatConfiguration { - readonly tabSize: number; - readonly insertSpaces: boolean; - readonly wrapLineLength: number; - readonly unformatted: string; - readonly contentUnformatted: string; - readonly indentInnerHtml: boolean; - readonly preserveNewLines: boolean; - readonly maxPreserveNewLines: number | undefined; - readonly indentHandlebars: boolean; - readonly endWithNewline: boolean; - readonly extraLiners: string; - readonly wrapAttributes: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline'; - } - export interface CompletionConfiguration { - readonly [providerId: string]: boolean; - } - export interface Options { + getScriptText(fileName: string): Promise; /** - * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. + * Get diagnostic messages related to the current compiler options. + * @param fileName Not used */ - readonly format?: HTMLFormatConfiguration; + getCompilerOptionsDiagnostics(fileName: string): Promise; /** - * A list of known schemas and/or associations of schemas to file names. + * Get code completions for the given file and position. + * @returns `Promise` */ - readonly suggest?: CompletionConfiguration; + getCompletionsAtPosition(fileName: string, position: number): Promise; /** - * Configures the HTML data types known by the HTML langauge service. + * Get code completion details for the given file, position, and entry. + * @returns `Promise` */ - readonly data?: HTMLDataConfiguration; - } - export interface ModeConfiguration { + getCompletionEntryDetails(fileName: string, position: number, entry: string): Promise; /** - * Defines whether the built-in completionItemProvider is enabled. + * Get signature help items for the item at the given file and position. + * @returns `Promise` */ - readonly completionItems?: boolean; + getSignatureHelpItems(fileName: string, position: number, options: any): Promise; /** - * Defines whether the built-in hoverProvider is enabled. + * Get quick info for the item at the given position in the file. + * @returns `Promise` */ - readonly hovers?: boolean; + getQuickInfoAtPosition(fileName: string, position: number): Promise; /** - * Defines whether the built-in documentSymbolProvider is enabled. + * Get other ranges which are related to the item at the given position in the file (often used for highlighting). + * @returns `Promise | undefined>` */ - readonly documentSymbols?: boolean; + getOccurrencesAtPosition(fileName: string, position: number): Promise | undefined>; /** - * Defines whether the built-in definitions provider is enabled. + * Get the definition of the item at the given position in the file. + * @returns `Promise | undefined>` */ - readonly links?: boolean; + getDefinitionAtPosition(fileName: string, position: number): Promise | undefined>; /** - * Defines whether the built-in references provider is enabled. + * Get references to the item at the given position in the file. + * @returns `Promise` */ - readonly documentHighlights?: boolean; + getReferencesAtPosition(fileName: string, position: number): Promise; /** - * Defines whether the built-in rename provider is enabled. + * Get outline entries for the item at the given position in the file. + * @returns `Promise` */ - readonly rename?: boolean; + getNavigationBarItems(fileName: string): Promise; /** - * Defines whether the built-in color provider is enabled. + * Get changes which should be applied to format the given file. + * @param options `typescript.FormatCodeOptions` + * @returns `Promise` */ - readonly colors?: boolean; + getFormattingEditsForDocument(fileName: string, options: any): Promise; /** - * Defines whether the built-in foldingRange provider is enabled. + * Get changes which should be applied to format the given range in the file. + * @param options `typescript.FormatCodeOptions` + * @returns `Promise` */ - readonly foldingRanges?: boolean; + getFormattingEditsForRange(fileName: string, start: number, end: number, options: any): Promise; /** - * Defines whether the built-in diagnostic provider is enabled. + * Get formatting changes which should be applied after the given keystroke. + * @param options `typescript.FormatCodeOptions` + * @returns `Promise` */ - readonly diagnostics?: boolean; + getFormattingEditsAfterKeystroke(fileName: string, postion: number, ch: string, options: any): Promise; /** - * Defines whether the built-in selection range provider is enabled. + * Get other occurrences which should be updated when renaming the item at the given file and position. + * @returns `Promise` */ - readonly selectionRanges?: boolean; + findRenameLocations(fileName: string, positon: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename: boolean): Promise; /** - * Defines whether the built-in documentFormattingEdit provider is enabled. + * 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` */ - readonly documentFormattingEdits?: boolean; + getRenameInfo(fileName: string, positon: number, options: any): Promise; /** - * Defines whether the built-in documentRangeFormattingEdit provider is enabled. + * Get transpiled output for the given file. + * @returns `typescript.EmitOutput` */ - readonly documentRangeFormattingEdits?: boolean; - } - export interface LanguageServiceDefaults { - readonly languageId: string; - readonly modeConfiguration: ModeConfiguration; - readonly onDidChange: IEvent; - readonly options: Options; - setOptions(options: Options): void; - setModeConfiguration(modeConfiguration: ModeConfiguration): void; - } - export const htmlLanguageService: LanguageServiceRegistration; - export const htmlDefaults: LanguageServiceDefaults; - export const handlebarLanguageService: LanguageServiceRegistration; - export const handlebarDefaults: LanguageServiceDefaults; - export const razorLanguageService: LanguageServiceRegistration; - export const razorDefaults: LanguageServiceDefaults; - export interface LanguageServiceRegistration extends IDisposable { - readonly defaults: LanguageServiceDefaults; - } - /** - * Registers a new HTML language service for the languageId. - * Note: 'html', 'handlebar' and 'razor' are registered by default. - * - * Use this method to register additional language ids with a HTML service. - * The language server has to be registered before an editor model is opened. - */ - export function registerHTMLLanguageService(languageId: string, options?: Options, modeConfiguration?: ModeConfiguration): LanguageServiceRegistration; - export interface HTMLDataConfiguration { + getEmitOutput(fileName: string): Promise; /** - * Defines whether the standard HTML tags and attributes are shown + * Get possible code fixes at the given position in the file. + * @param formatOptions `typescript.FormatCodeOptions` + * @returns `Promise>` */ - readonly useDefaultDataProvider?: boolean; + getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: any): Promise>; /** - * Provides a set of custom data providers. + * Get inlay hints in the range of the file. + * @param fileName + * @returns `Promise` */ - readonly dataProviders?: { - [providerId: string]: HTMLDataV1; - }; - } - /** - * Custom HTML tags attributes and attribute values - * https://github.com/microsoft/vscode-html-languageservice/blob/main/docs/customData.md - */ - export interface HTMLDataV1 { - readonly version: 1 | 1.1; - readonly tags?: ITagData[]; - readonly globalAttributes?: IAttributeData[]; - readonly valueSets?: IValueSet[]; - } - export interface IReference { - readonly name: string; - readonly url: string; - } - export interface ITagData { - readonly name: string; - readonly description?: string | MarkupContent; - readonly attributes: IAttributeData[]; - readonly references?: IReference[]; - } - export interface IAttributeData { - readonly name: string; - readonly description?: string | MarkupContent; - readonly valueSet?: string; - readonly values?: IValueData[]; - readonly references?: IReference[]; - } - export interface IValueData { - readonly name: string; - readonly description?: string | MarkupContent; - readonly references?: IReference[]; - } - export interface IValueSet { - readonly name: string; - readonly values: IValueData[]; - } - export interface MarkupContent { - readonly kind: MarkupKind; - readonly value: string; + provideInlayHints(fileName: string, start: number, end: number): Promise>; } - export type MarkupKind = 'plaintext' | 'markdown'; + 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>; } diff --git a/website/typedoc/monaco.d.ts b/website/typedoc/monaco.d.ts index d2c4c98b..830e8843 100644 --- a/website/typedoc/monaco.d.ts +++ b/website/typedoc/monaco.d.ts @@ -7133,392 +7133,448 @@ declare namespace monaco.worker { * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -declare namespace monaco.languages.typescript { - export enum ModuleKind { - None = 0, - CommonJS = 1, - AMD = 2, - UMD = 3, - System = 4, - ES2015 = 5, - ESNext = 99 - } - export enum JsxEmit { - None = 0, - Preserve = 1, - React = 2, - ReactNative = 3, - ReactJSX = 4, - ReactJSXDev = 5 - } - export enum NewLineKind { - CarriageReturnLineFeed = 0, - LineFeed = 1 - } - export enum ScriptTarget { - ES3 = 0, - ES5 = 1, - ES2015 = 2, - ES2016 = 3, - ES2017 = 4, - ES2018 = 5, - ES2019 = 6, - ES2020 = 7, - ESNext = 99, - JSON = 100, - 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; - interface CompilerOptions { - allowJs?: boolean; - allowSyntheticDefaultImports?: boolean; - allowUmdGlobalAccess?: boolean; - allowUnreachableCode?: boolean; - allowUnusedLabels?: boolean; - alwaysStrict?: boolean; - baseUrl?: string; - charset?: string; - checkJs?: boolean; - declaration?: boolean; - declarationMap?: boolean; - emitDeclarationOnly?: boolean; - declarationDir?: string; - disableSizeLimit?: boolean; - disableSourceOfProjectReferenceRedirect?: boolean; - downlevelIteration?: boolean; - emitBOM?: boolean; - emitDecoratorMetadata?: boolean; - experimentalDecorators?: boolean; - forceConsistentCasingInFileNames?: boolean; - importHelpers?: boolean; - inlineSourceMap?: boolean; - inlineSources?: boolean; - isolatedModules?: boolean; - jsx?: JsxEmit; - keyofStringsOnly?: boolean; - lib?: string[]; - locale?: string; - mapRoot?: string; - maxNodeModuleJsDepth?: number; - module?: ModuleKind; - moduleResolution?: ModuleResolutionKind; - newLine?: NewLineKind; - noEmit?: boolean; - noEmitHelpers?: boolean; - noEmitOnError?: boolean; - noErrorTruncation?: boolean; - noFallthroughCasesInSwitch?: boolean; - noImplicitAny?: boolean; - noImplicitReturns?: boolean; - noImplicitThis?: boolean; - noStrictGenericChecks?: boolean; - noUnusedLocals?: boolean; - noUnusedParameters?: boolean; - noImplicitUseStrict?: boolean; - noLib?: boolean; - noResolve?: boolean; - out?: string; - outDir?: string; - outFile?: string; - paths?: MapLike; - preserveConstEnums?: boolean; - preserveSymlinks?: boolean; - project?: string; - reactNamespace?: string; - jsxFactory?: string; - composite?: boolean; - removeComments?: boolean; - rootDir?: string; - rootDirs?: string[]; - skipLibCheck?: boolean; - skipDefaultLibCheck?: boolean; - sourceMap?: boolean; - sourceRoot?: string; - strict?: boolean; - strictFunctionTypes?: boolean; - strictBindCallApply?: boolean; - strictNullChecks?: boolean; - strictPropertyInitialization?: boolean; - stripInternal?: boolean; - suppressExcessPropertyErrors?: boolean; - suppressImplicitAnyIndexErrors?: boolean; - target?: ScriptTarget; - traceResolution?: boolean; - resolveJsonModule?: boolean; - types?: string[]; - /** Paths used to compute primary types search locations */ - typeRoots?: string[]; - esModuleInterop?: boolean; - useDefineForClassFields?: boolean; - [option: string]: CompilerOptionsValue | undefined; - } - export interface DiagnosticsOptions { - noSemanticValidation?: boolean; - noSyntaxValidation?: boolean; - noSuggestionDiagnostics?: boolean; +declare namespace monaco.languages.css { + export interface Options { + 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'; + }; /** - * Limit diagnostic computation to only visible files. - * Defaults to false. + * Configures the CSS data types known by the langauge service. */ - onlyVisible?: 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; + readonly data?: CSSDataConfiguration; } - interface InlayHintsOptions { - readonly includeInlayParameterNameHints?: 'none' | 'literals' | 'all'; - readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; - readonly includeInlayFunctionParameterTypeHints?: boolean; - readonly includeInlayVariableTypeHints?: boolean; - readonly includeInlayPropertyDeclarationTypeHints?: boolean; - readonly includeInlayFunctionLikeReturnTypeHints?: boolean; - readonly includeInlayEnumMemberValueHints?: boolean; + 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; } - interface IExtraLib { - content: string; - version: number; + export interface LanguageServiceDefaults { + readonly languageId: string; + readonly onDidChange: IEvent; + readonly modeConfiguration: ModeConfiguration; + readonly options: Options; + setOptions(options: Options): void; + setModeConfiguration(modeConfiguration: ModeConfiguration): void; + /** @deprecated Use options instead */ + readonly diagnosticsOptions: DiagnosticsOptions; + /** @deprecated Use setOptions instead */ + setDiagnosticsOptions(options: DiagnosticsOptions): void; } - export interface IExtraLibs { - [path: string]: IExtraLib; + /** @deprecated Use Options instead */ + export type DiagnosticsOptions = Options; + export const cssDefaults: LanguageServiceDefaults; + export const scssDefaults: LanguageServiceDefaults; + export const lessDefaults: LanguageServiceDefaults; + export interface CSSDataConfiguration { + /** + * Defines whether the standard CSS properties, at-directives, pseudoClasses and pseudoElements are shown. + */ + useDefaultDataProvider?: boolean; + /** + * Provides a set of custom data providers. + */ + dataProviders?: { + [providerId: string]: CSSDataV1; + }; } /** - * 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. + * Custom CSS properties, at-directives, pseudoClasses and pseudoElements + * https://github.com/microsoft/vscode-css-languageservice/blob/main/docs/customData.md */ - interface DiagnosticMessageChain { - messageText: string; - /** Diagnostic category: warning = 0, error = 1, suggestion = 2, message = 3 */ - category: 0 | 1 | 2 | 3; - code: number; - next?: DiagnosticMessageChain[]; + export interface CSSDataV1 { + version: 1 | 1.1; + properties?: IPropertyData[]; + atDirectives?: IAtDirectiveData[]; + pseudoClasses?: IPseudoClassData[]; + pseudoElements?: IPseudoElementData[]; } - 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?: {}; - reportsDeprecated?: {}; - source?: string; - relatedInformation?: DiagnosticRelatedInformation[]; + export type EntryStatus = 'standard' | 'experimental' | 'nonstandard' | 'obsolete'; + export interface IReference { + name: string; + url: string; + } + export interface IPropertyData { + name: string; + description?: string | MarkupContent; + browsers?: string[]; + restrictions?: string[]; + status?: EntryStatus; + syntax?: string; + values?: IValueData[]; + references?: IReference[]; + relevance?: number; + } + export interface IAtDirectiveData { + name: string; + description?: string | MarkupContent; + browsers?: string[]; + status?: EntryStatus; + references?: IReference[]; } - export interface DiagnosticRelatedInformation { - /** Diagnostic category: warning = 0, error = 1, suggestion = 2, message = 3 */ - category: 0 | 1 | 2 | 3; - code: number; - /** TypeScriptWorker removes all but the `fileName` property to avoid serializing circular JSON structures. */ - file: { - fileName: string; - } | undefined; - start: number | undefined; - length: number | undefined; - messageText: string | DiagnosticMessageChain; + export interface IPseudoClassData { + name: string; + description?: string | MarkupContent; + browsers?: string[]; + status?: EntryStatus; + references?: IReference[]; } - interface EmitOutput { - outputFiles: OutputFile[]; - emitSkipped: boolean; + export interface IPseudoElementData { + name: string; + description?: string | MarkupContent; + browsers?: string[]; + status?: EntryStatus; + references?: IReference[]; } - interface OutputFile { + export interface IValueData { name: string; - writeByteOrderMark: boolean; - text: string; + description?: string | MarkupContent; + browsers?: string[]; + status?: EntryStatus; + references?: IReference[]; } - export interface LanguageServiceDefaults { + export interface MarkupContent { + kind: MarkupKind; + value: string; + } + export type MarkupKind = 'plaintext' | 'markdown'; +} + +/*--------------------------------------------------------------------------------------------- + * 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.html { + export interface HTMLFormatConfiguration { + readonly tabSize: number; + readonly insertSpaces: boolean; + readonly wrapLineLength: number; + readonly unformatted: string; + readonly contentUnformatted: string; + readonly indentInnerHtml: boolean; + readonly preserveNewLines: boolean; + readonly maxPreserveNewLines: number | undefined; + readonly indentHandlebars: boolean; + readonly endWithNewline: boolean; + readonly extraLiners: string; + readonly wrapAttributes: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline'; + } + export interface CompletionConfiguration { + readonly [providerId: string]: boolean; + } + export interface Options { /** - * Event fired when compiler options or diagnostics options are changed. + * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. */ - readonly onDidChange: IEvent; + readonly format?: HTMLFormatConfiguration; /** - * Event fired when extra libraries registered with the language service change. + * A list of known schemas and/or associations of schemas to file names. */ - readonly onDidExtraLibsChange: IEvent; - readonly workerOptions: WorkerOptions; - readonly inlayHintsOptions: InlayHintsOptions; + readonly suggest?: CompletionConfiguration; /** - * Get the current extra libs registered with the language service. + * Configures the HTML data types known by the HTML langauge service. */ - getExtraLibs(): IExtraLibs; + readonly data?: HTMLDataConfiguration; + } + export interface ModeConfiguration { /** - * Add an additional source file to the language service. Use this - * for typescript (definition) files that won't be loaded as editor - * documents, like `jquery.d.ts`. - * - * @param content The file content - * @param filePath An optional file path - * @returns A disposable which will remove the file from the - * language service upon disposal. + * Defines whether the built-in completionItemProvider is enabled. */ - addExtraLib(content: string, filePath?: string): IDisposable; + readonly completionItems?: boolean; /** - * 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. + * Defines whether the built-in hoverProvider is enabled. */ - setExtraLibs(libs: { - content: string; - filePath?: string; - }[]): void; + readonly hovers?: boolean; /** - * Get current TypeScript compiler options for the language service. + * Defines whether the built-in documentSymbolProvider is enabled. */ - getCompilerOptions(): CompilerOptions; + readonly documentSymbols?: boolean; /** - * Set TypeScript compiler options. + * Defines whether the built-in definitions provider is enabled. */ - setCompilerOptions(options: CompilerOptions): void; + readonly links?: boolean; /** - * Get the current diagnostics options for the language service. + * Defines whether the built-in references provider is enabled. */ - getDiagnosticsOptions(): DiagnosticsOptions; + readonly documentHighlights?: boolean; /** - * Configure whether syntactic and/or semantic validation should - * be performed + * Defines whether the built-in rename provider is enabled. */ - setDiagnosticsOptions(options: DiagnosticsOptions): void; + readonly rename?: boolean; /** - * Configure webworker options + * Defines whether the built-in color provider is enabled. */ - setWorkerOptions(options: WorkerOptions): void; + readonly colors?: boolean; /** - * No-op. + * Defines whether the built-in foldingRange provider is enabled. */ - setMaximumWorkerIdleTime(value: number): void; + readonly foldingRanges?: boolean; /** - * Configure if all existing models should be eagerly sync'd - * to the worker on start or restart. + * Defines whether the built-in diagnostic provider is enabled. */ - setEagerModelSync(value: boolean): void; + readonly diagnostics?: boolean; /** - * Get the current setting for whether all existing models should be eagerly sync'd - * to the worker on start or restart. + * Defines whether the built-in selection range provider is enabled. */ - getEagerModelSync(): boolean; + readonly selectionRanges?: boolean; /** - * Configure inlay hints options. + * Defines whether the built-in documentFormattingEdit provider is enabled. */ - setInlayHintsOptions(options: InlayHintsOptions): void; - } - export interface TypeScriptWorker { + readonly documentFormattingEdits?: boolean; /** - * Get diagnostic messages for any syntax issues in the given file. + * Defines whether the built-in documentRangeFormattingEdit provider is enabled. */ - getSyntacticDiagnostics(fileName: string): Promise; + readonly documentRangeFormattingEdits?: boolean; + } + export interface LanguageServiceDefaults { + readonly languageId: string; + readonly modeConfiguration: ModeConfiguration; + readonly onDidChange: IEvent; + readonly options: Options; + setOptions(options: Options): void; + setModeConfiguration(modeConfiguration: ModeConfiguration): void; + } + export const htmlLanguageService: LanguageServiceRegistration; + export const htmlDefaults: LanguageServiceDefaults; + export const handlebarLanguageService: LanguageServiceRegistration; + export const handlebarDefaults: LanguageServiceDefaults; + export const razorLanguageService: LanguageServiceRegistration; + export const razorDefaults: LanguageServiceDefaults; + export interface LanguageServiceRegistration extends IDisposable { + readonly defaults: LanguageServiceDefaults; + } + /** + * Registers a new HTML language service for the languageId. + * Note: 'html', 'handlebar' and 'razor' are registered by default. + * + * Use this method to register additional language ids with a HTML service. + * The language server has to be registered before an editor model is opened. + */ + export function registerHTMLLanguageService(languageId: string, options?: Options, modeConfiguration?: ModeConfiguration): LanguageServiceRegistration; + export interface HTMLDataConfiguration { /** - * Get diagnostic messages for any semantic issues in the given file. + * Defines whether the standard HTML tags and attributes are shown */ - getSemanticDiagnostics(fileName: string): Promise; + readonly useDefaultDataProvider?: boolean; /** - * Get diagnostic messages for any suggestions related to the given file. + * Provides a set of custom data providers. */ - getSuggestionDiagnostics(fileName: string): Promise; + readonly dataProviders?: { + [providerId: string]: HTMLDataV1; + }; + } + /** + * Custom HTML tags attributes and attribute values + * https://github.com/microsoft/vscode-html-languageservice/blob/main/docs/customData.md + */ + export interface HTMLDataV1 { + readonly version: 1 | 1.1; + readonly tags?: ITagData[]; + readonly globalAttributes?: IAttributeData[]; + readonly valueSets?: IValueSet[]; + } + export interface IReference { + readonly name: string; + readonly url: string; + } + export interface ITagData { + readonly name: string; + readonly description?: string | MarkupContent; + readonly attributes: IAttributeData[]; + readonly references?: IReference[]; + } + export interface IAttributeData { + readonly name: string; + readonly description?: string | MarkupContent; + readonly valueSet?: string; + readonly values?: IValueData[]; + readonly references?: IReference[]; + } + export interface IValueData { + readonly name: string; + readonly description?: string | MarkupContent; + readonly references?: IReference[]; + } + export interface IValueSet { + readonly name: string; + readonly values: IValueData[]; + } + export interface MarkupContent { + readonly kind: MarkupKind; + readonly value: string; + } + export type MarkupKind = 'plaintext' | 'markdown'; +} + +/*--------------------------------------------------------------------------------------------- + * 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 { /** - * Get the content of a given file. + * If set, the validator will be enabled and perform syntax and schema based validation, + * unless `DiagnosticsOptions.schemaValidation` is set to `ignore`. */ - getScriptText(fileName: string): Promise; + readonly validate?: boolean; /** - * Get diagnostic messages related to the current compiler options. - * @param fileName Not used + * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. + * `DiagnosticsOptions.allowComments` will override this setting. */ - getCompilerOptionsDiagnostics(fileName: string): Promise; + readonly allowComments?: boolean; /** - * Get code completions for the given file and position. - * @returns `Promise` + * A list of known schemas and/or associations of schemas to file names. */ - getCompletionsAtPosition(fileName: string, position: number): Promise; + readonly schemas?: { + /** + * The URI of the schema, which is also the identifier of the schema. + */ + readonly uri: string; + /** + * A list of glob patterns that describe for which file URIs the JSON schema will be used. + * '*' and '**' wildcards are supported. Exclusion patterns start with '!'. + * For example '*.schema.json', 'package.json', '!foo*.schema.json', 'foo/**\/BADRESP.json'. + * A match succeeds when there is at least one pattern matching and last matching pattern does not start with '!'. + */ + readonly fileMatch?: string[]; + /** + * The schema for the given URI. + */ + readonly schema?: any; + }[]; /** - * Get code completion details for the given file, position, and entry. - * @returns `Promise` + * If set, the schema service would load schema content on-demand with 'fetch' if available */ - getCompletionEntryDetails(fileName: string, position: number, entry: string): Promise; + readonly enableSchemaRequest?: boolean; /** - * Get signature help items for the item at the given file and position. - * @returns `Promise` + * The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used. */ - getSignatureHelpItems(fileName: string, position: number, options: any): Promise; + readonly schemaValidation?: SeverityLevel; /** - * Get quick info for the item at the given position in the file. - * @returns `Promise` + * The severity of problems that occurred when resolving and loading schemas. If set to 'ignore', schema resolving problems are not reported. If not set, 'warning' is used. */ - getQuickInfoAtPosition(fileName: string, position: number): Promise; + readonly schemaRequest?: SeverityLevel; /** - * Get other ranges which are related to the item at the given position in the file (often used for highlighting). - * @returns `Promise | undefined>` + * The severity of reported trailing commas. If not set, trailing commas will be reported as errors. */ - getOccurrencesAtPosition(fileName: string, position: number): Promise | undefined>; + readonly trailingCommas?: SeverityLevel; /** - * Get the definition of the item at the given position in the file. - * @returns `Promise | undefined>` + * The severity of reported comments. If not set, 'DiagnosticsOptions.allowComments' defines whether comments are ignored or reported as errors. */ - getDefinitionAtPosition(fileName: string, position: number): Promise | undefined>; + readonly comments?: SeverityLevel; + } + export type SeverityLevel = 'error' | 'warning' | 'ignore'; + export interface ModeConfiguration { /** - * Get references to the item at the given position in the file. - * @returns `Promise` + * Defines whether the built-in documentFormattingEdit provider is enabled. */ - getReferencesAtPosition(fileName: string, position: number): Promise; + readonly documentFormattingEdits?: boolean; /** - * Get outline entries for the item at the given position in the file. - * @returns `Promise` + * Defines whether the built-in documentRangeFormattingEdit provider is enabled. */ - getNavigationBarItems(fileName: string): Promise; + readonly documentRangeFormattingEdits?: boolean; /** - * Get changes which should be applied to format the given file. - * @param options `typescript.FormatCodeOptions` - * @returns `Promise` + * Defines whether the built-in completionItemProvider is enabled. */ - getFormattingEditsForDocument(fileName: string, options: any): Promise; + readonly completionItems?: boolean; /** - * Get changes which should be applied to format the given range in the file. - * @param options `typescript.FormatCodeOptions` - * @returns `Promise` + * Defines whether the built-in hoverProvider is enabled. */ - getFormattingEditsForRange(fileName: string, start: number, end: number, options: any): Promise; + readonly hovers?: boolean; /** - * Get formatting changes which should be applied after the given keystroke. - * @param options `typescript.FormatCodeOptions` - * @returns `Promise` + * Defines whether the built-in documentSymbolProvider is enabled. */ - getFormattingEditsAfterKeystroke(fileName: string, postion: number, ch: string, options: any): Promise; + readonly documentSymbols?: boolean; /** - * Get other occurrences which should be updated when renaming the item at the given file and position. - * @returns `Promise` + * Defines whether the built-in tokens provider is enabled. */ - findRenameLocations(fileName: string, positon: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename: boolean): Promise; + readonly tokens?: boolean; /** - * 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` + * Defines whether the built-in color provider is enabled. */ - getRenameInfo(fileName: string, positon: number, options: any): Promise; + readonly colors?: boolean; /** - * Get transpiled output for the given file. - * @returns `typescript.EmitOutput` + * Defines whether the built-in foldingRange provider is enabled. */ - getEmitOutput(fileName: string): Promise; + readonly foldingRanges?: boolean; /** - * Get possible code fixes at the given position in the file. - * @param formatOptions `typescript.FormatCodeOptions` - * @returns `Promise>` + * Defines whether the built-in diagnostic provider is enabled. */ - getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: any): Promise>; + readonly diagnostics?: boolean; /** - * Get inlay hints in the range of the file. - * @param fileName - * @returns `Promise` + * Defines whether the built-in selection range provider is enabled. */ - provideInlayHints(fileName: string, start: number, end: number): Promise>; + readonly selectionRanges?: boolean; } - 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 interface LanguageServiceDefaults { + readonly languageId: string; + readonly onDidChange: IEvent; + readonly diagnosticsOptions: DiagnosticsOptions; + readonly modeConfiguration: ModeConfiguration; + setDiagnosticsOptions(options: DiagnosticsOptions): void; + setModeConfiguration(modeConfiguration: ModeConfiguration): void; + } + export const jsonDefaults: LanguageServiceDefaults; } /*--------------------------------------------------------------------------------------------- @@ -7526,446 +7582,390 @@ declare namespace monaco.languages.typescript { * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -declare namespace monaco.languages.css { - export interface Options { - 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'; - }; - /** - * Configures the CSS data types known by the langauge service. - */ - readonly data?: CSSDataConfiguration; +declare namespace monaco.languages.typescript { + export enum ModuleKind { + None = 0, + CommonJS = 1, + AMD = 2, + UMD = 3, + System = 4, + ES2015 = 5, + ESNext = 99 + } + export enum JsxEmit { + None = 0, + Preserve = 1, + React = 2, + ReactNative = 3, + ReactJSX = 4, + ReactJSXDev = 5 + } + export enum NewLineKind { + CarriageReturnLineFeed = 0, + LineFeed = 1 + } + export enum ScriptTarget { + ES3 = 0, + ES5 = 1, + ES2015 = 2, + ES2016 = 3, + ES2017 = 4, + ES2018 = 5, + ES2019 = 6, + ES2020 = 7, + ESNext = 99, + JSON = 100, + 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; + interface CompilerOptions { + allowJs?: boolean; + allowSyntheticDefaultImports?: boolean; + allowUmdGlobalAccess?: boolean; + allowUnreachableCode?: boolean; + allowUnusedLabels?: boolean; + alwaysStrict?: boolean; + baseUrl?: string; + charset?: string; + checkJs?: boolean; + declaration?: boolean; + declarationMap?: boolean; + emitDeclarationOnly?: boolean; + declarationDir?: string; + disableSizeLimit?: boolean; + disableSourceOfProjectReferenceRedirect?: boolean; + downlevelIteration?: boolean; + emitBOM?: boolean; + emitDecoratorMetadata?: boolean; + experimentalDecorators?: boolean; + forceConsistentCasingInFileNames?: boolean; + importHelpers?: boolean; + inlineSourceMap?: boolean; + inlineSources?: boolean; + isolatedModules?: boolean; + jsx?: JsxEmit; + keyofStringsOnly?: boolean; + lib?: string[]; + locale?: string; + mapRoot?: string; + maxNodeModuleJsDepth?: number; + module?: ModuleKind; + moduleResolution?: ModuleResolutionKind; + newLine?: NewLineKind; + noEmit?: boolean; + noEmitHelpers?: boolean; + noEmitOnError?: boolean; + noErrorTruncation?: boolean; + noFallthroughCasesInSwitch?: boolean; + noImplicitAny?: boolean; + noImplicitReturns?: boolean; + noImplicitThis?: boolean; + noStrictGenericChecks?: boolean; + noUnusedLocals?: boolean; + noUnusedParameters?: boolean; + noImplicitUseStrict?: boolean; + noLib?: boolean; + noResolve?: boolean; + out?: string; + outDir?: string; + outFile?: string; + paths?: MapLike; + preserveConstEnums?: boolean; + preserveSymlinks?: boolean; + project?: string; + reactNamespace?: string; + jsxFactory?: string; + composite?: boolean; + removeComments?: boolean; + rootDir?: string; + rootDirs?: string[]; + skipLibCheck?: boolean; + skipDefaultLibCheck?: boolean; + sourceMap?: boolean; + sourceRoot?: string; + strict?: boolean; + strictFunctionTypes?: boolean; + strictBindCallApply?: boolean; + strictNullChecks?: boolean; + strictPropertyInitialization?: boolean; + stripInternal?: boolean; + suppressExcessPropertyErrors?: boolean; + suppressImplicitAnyIndexErrors?: boolean; + target?: ScriptTarget; + traceResolution?: boolean; + resolveJsonModule?: boolean; + types?: string[]; + /** Paths used to compute primary types search locations */ + typeRoots?: string[]; + esModuleInterop?: boolean; + useDefineForClassFields?: boolean; + [option: string]: CompilerOptionsValue | undefined; } - 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; + export interface DiagnosticsOptions { + noSemanticValidation?: boolean; + noSyntaxValidation?: boolean; + noSuggestionDiagnostics?: boolean; /** - * Defines whether the built-in selection range provider is enabled. + * Limit diagnostic computation to only visible files. + * Defaults to false. */ - readonly selectionRanges?: boolean; + onlyVisible?: boolean; + diagnosticCodesToIgnore?: number[]; } - export interface LanguageServiceDefaults { - readonly languageId: string; - readonly onDidChange: IEvent; - readonly modeConfiguration: ModeConfiguration; - readonly options: Options; - setOptions(options: Options): void; - setModeConfiguration(modeConfiguration: ModeConfiguration): void; - /** @deprecated Use options instead */ - readonly diagnosticsOptions: DiagnosticsOptions; - /** @deprecated Use setOptions instead */ - setDiagnosticsOptions(options: DiagnosticsOptions): void; + 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; } - /** @deprecated Use Options instead */ - export type DiagnosticsOptions = Options; - export const cssDefaults: LanguageServiceDefaults; - export const scssDefaults: LanguageServiceDefaults; - export const lessDefaults: LanguageServiceDefaults; - export interface CSSDataConfiguration { - /** - * Defines whether the standard CSS properties, at-directives, pseudoClasses and pseudoElements are shown. - */ - useDefaultDataProvider?: boolean; - /** - * Provides a set of custom data providers. - */ - dataProviders?: { - [providerId: string]: CSSDataV1; - }; + interface InlayHintsOptions { + readonly includeInlayParameterNameHints?: 'none' | 'literals' | 'all'; + readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; + readonly includeInlayFunctionParameterTypeHints?: boolean; + readonly includeInlayVariableTypeHints?: boolean; + readonly includeInlayPropertyDeclarationTypeHints?: boolean; + readonly includeInlayFunctionLikeReturnTypeHints?: boolean; + readonly includeInlayEnumMemberValueHints?: boolean; } - /** - * Custom CSS properties, at-directives, pseudoClasses and pseudoElements - * https://github.com/microsoft/vscode-css-languageservice/blob/main/docs/customData.md - */ - export interface CSSDataV1 { - version: 1 | 1.1; - properties?: IPropertyData[]; - atDirectives?: IAtDirectiveData[]; - pseudoClasses?: IPseudoClassData[]; - pseudoElements?: IPseudoElementData[]; + interface IExtraLib { + content: string; + version: number; } - export type EntryStatus = 'standard' | 'experimental' | 'nonstandard' | 'obsolete'; - export interface IReference { - name: string; - url: string; + export interface IExtraLibs { + [path: string]: IExtraLib; } - export interface IPropertyData { - name: string; - description?: string | MarkupContent; - browsers?: string[]; - restrictions?: string[]; - status?: EntryStatus; - syntax?: string; - values?: IValueData[]; - references?: IReference[]; - relevance?: number; + /** + * 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. + */ + interface DiagnosticMessageChain { + messageText: string; + /** Diagnostic category: warning = 0, error = 1, suggestion = 2, message = 3 */ + category: 0 | 1 | 2 | 3; + code: number; + next?: DiagnosticMessageChain[]; } - export interface IAtDirectiveData { - name: string; - description?: string | MarkupContent; - browsers?: string[]; - status?: EntryStatus; - references?: IReference[]; + 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?: {}; + reportsDeprecated?: {}; + source?: string; + relatedInformation?: DiagnosticRelatedInformation[]; } - export interface IPseudoClassData { - name: string; - description?: string | MarkupContent; - browsers?: string[]; - status?: EntryStatus; - references?: IReference[]; + export interface DiagnosticRelatedInformation { + /** Diagnostic category: warning = 0, error = 1, suggestion = 2, message = 3 */ + category: 0 | 1 | 2 | 3; + code: number; + /** TypeScriptWorker removes all but the `fileName` property to avoid serializing circular JSON structures. */ + file: { + fileName: string; + } | undefined; + start: number | undefined; + length: number | undefined; + messageText: string | DiagnosticMessageChain; } - export interface IPseudoElementData { - name: string; - description?: string | MarkupContent; - browsers?: string[]; - status?: EntryStatus; - references?: IReference[]; + interface EmitOutput { + outputFiles: OutputFile[]; + emitSkipped: boolean; } - export interface IValueData { + interface OutputFile { name: string; - description?: string | MarkupContent; - browsers?: string[]; - status?: EntryStatus; - references?: IReference[]; - } - export interface MarkupContent { - kind: MarkupKind; - value: string; + writeByteOrderMark: boolean; + text: string; } - export type MarkupKind = 'plaintext' | 'markdown'; -} - -/*--------------------------------------------------------------------------------------------- - * 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 { + export interface LanguageServiceDefaults { /** - * If set, the validator will be enabled and perform syntax and schema based validation, - * unless `DiagnosticsOptions.schemaValidation` is set to `ignore`. + * Event fired when compiler options or diagnostics options are changed. */ - readonly validate?: boolean; + readonly onDidChange: IEvent; /** - * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. - * `DiagnosticsOptions.allowComments` will override this setting. + * Event fired when extra libraries registered with the language service change. */ - readonly allowComments?: boolean; + readonly onDidExtraLibsChange: IEvent; + readonly workerOptions: WorkerOptions; + readonly inlayHintsOptions: InlayHintsOptions; /** - * A list of known schemas and/or associations of schemas to file names. + * Get the current extra libs registered with the language service. */ - readonly schemas?: { - /** - * The URI of the schema, which is also the identifier of the schema. - */ - readonly uri: string; - /** - * A list of glob patterns that describe for which file URIs the JSON schema will be used. - * '*' and '**' wildcards are supported. Exclusion patterns start with '!'. - * For example '*.schema.json', 'package.json', '!foo*.schema.json', 'foo/**\/BADRESP.json'. - * A match succeeds when there is at least one pattern matching and last matching pattern does not start with '!'. - */ - readonly fileMatch?: string[]; - /** - * The schema for the given URI. - */ - readonly schema?: any; - }[]; + getExtraLibs(): IExtraLibs; /** - * If set, the schema service would load schema content on-demand with 'fetch' if available + * Add an additional source file to the language service. Use this + * for typescript (definition) files that won't be loaded as editor + * documents, like `jquery.d.ts`. + * + * @param content The file content + * @param filePath An optional file path + * @returns A disposable which will remove the file from the + * language service upon disposal. */ - readonly enableSchemaRequest?: boolean; + addExtraLib(content: string, filePath?: string): IDisposable; /** - * The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used. + * 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. */ - readonly schemaValidation?: SeverityLevel; + setExtraLibs(libs: { + content: string; + filePath?: string; + }[]): void; /** - * The severity of problems that occurred when resolving and loading schemas. If set to 'ignore', schema resolving problems are not reported. If not set, 'warning' is used. + * Get current TypeScript compiler options for the language service. */ - readonly schemaRequest?: SeverityLevel; + getCompilerOptions(): CompilerOptions; /** - * The severity of reported trailing commas. If not set, trailing commas will be reported as errors. + * Set TypeScript compiler options. */ - readonly trailingCommas?: SeverityLevel; + setCompilerOptions(options: CompilerOptions): void; /** - * The severity of reported comments. If not set, 'DiagnosticsOptions.allowComments' defines whether comments are ignored or reported as errors. + * Get the current diagnostics options for the language service. */ - readonly comments?: SeverityLevel; - } - export type SeverityLevel = 'error' | 'warning' | 'ignore'; - export interface ModeConfiguration { + getDiagnosticsOptions(): DiagnosticsOptions; /** - * Defines whether the built-in documentFormattingEdit provider is enabled. + * Configure whether syntactic and/or semantic validation should + * be performed */ - readonly documentFormattingEdits?: boolean; + setDiagnosticsOptions(options: DiagnosticsOptions): void; /** - * Defines whether the built-in documentRangeFormattingEdit provider is enabled. + * Configure webworker options */ - readonly documentRangeFormattingEdits?: boolean; + setWorkerOptions(options: WorkerOptions): void; /** - * Defines whether the built-in completionItemProvider is enabled. + * No-op. */ - readonly completionItems?: boolean; + setMaximumWorkerIdleTime(value: number): void; /** - * Defines whether the built-in hoverProvider is enabled. + * Configure if all existing models should be eagerly sync'd + * to the worker on start or restart. */ - readonly hovers?: boolean; + setEagerModelSync(value: boolean): void; /** - * Defines whether the built-in documentSymbolProvider is enabled. + * Get the current setting for whether all existing models should be eagerly sync'd + * to the worker on start or restart. */ - readonly documentSymbols?: boolean; + getEagerModelSync(): boolean; /** - * Defines whether the built-in tokens provider is enabled. + * Configure inlay hints options. */ - readonly tokens?: boolean; + setInlayHintsOptions(options: InlayHintsOptions): void; + } + export interface TypeScriptWorker { /** - * Defines whether the built-in color provider is enabled. + * Get diagnostic messages for any syntax issues in the given file. */ - readonly colors?: boolean; + getSyntacticDiagnostics(fileName: string): Promise; /** - * Defines whether the built-in foldingRange provider is enabled. + * Get diagnostic messages for any semantic issues in the given file. */ - readonly foldingRanges?: boolean; + getSemanticDiagnostics(fileName: string): Promise; /** - * Defines whether the built-in diagnostic provider is enabled. + * Get diagnostic messages for any suggestions related to the given file. */ - readonly diagnostics?: boolean; + getSuggestionDiagnostics(fileName: string): Promise; /** - * Defines whether the built-in selection range provider is enabled. + * Get the content of a given file. */ - 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 const jsonDefaults: 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.html { - export interface HTMLFormatConfiguration { - readonly tabSize: number; - readonly insertSpaces: boolean; - readonly wrapLineLength: number; - readonly unformatted: string; - readonly contentUnformatted: string; - readonly indentInnerHtml: boolean; - readonly preserveNewLines: boolean; - readonly maxPreserveNewLines: number | undefined; - readonly indentHandlebars: boolean; - readonly endWithNewline: boolean; - readonly extraLiners: string; - readonly wrapAttributes: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline'; - } - export interface CompletionConfiguration { - readonly [providerId: string]: boolean; - } - export interface Options { + getScriptText(fileName: string): Promise; /** - * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. + * Get diagnostic messages related to the current compiler options. + * @param fileName Not used */ - readonly format?: HTMLFormatConfiguration; + getCompilerOptionsDiagnostics(fileName: string): Promise; /** - * A list of known schemas and/or associations of schemas to file names. + * Get code completions for the given file and position. + * @returns `Promise` */ - readonly suggest?: CompletionConfiguration; + getCompletionsAtPosition(fileName: string, position: number): Promise; /** - * Configures the HTML data types known by the HTML langauge service. + * Get code completion details for the given file, position, and entry. + * @returns `Promise` */ - readonly data?: HTMLDataConfiguration; - } - export interface ModeConfiguration { + getCompletionEntryDetails(fileName: string, position: number, entry: string): Promise; /** - * Defines whether the built-in completionItemProvider is enabled. + * Get signature help items for the item at the given file and position. + * @returns `Promise` */ - readonly completionItems?: boolean; + getSignatureHelpItems(fileName: string, position: number, options: any): Promise; /** - * Defines whether the built-in hoverProvider is enabled. + * Get quick info for the item at the given position in the file. + * @returns `Promise` */ - readonly hovers?: boolean; + getQuickInfoAtPosition(fileName: string, position: number): Promise; /** - * Defines whether the built-in documentSymbolProvider is enabled. + * Get other ranges which are related to the item at the given position in the file (often used for highlighting). + * @returns `Promise | undefined>` */ - readonly documentSymbols?: boolean; + getOccurrencesAtPosition(fileName: string, position: number): Promise | undefined>; /** - * Defines whether the built-in definitions provider is enabled. + * Get the definition of the item at the given position in the file. + * @returns `Promise | undefined>` */ - readonly links?: boolean; + getDefinitionAtPosition(fileName: string, position: number): Promise | undefined>; /** - * Defines whether the built-in references provider is enabled. + * Get references to the item at the given position in the file. + * @returns `Promise` */ - readonly documentHighlights?: boolean; + getReferencesAtPosition(fileName: string, position: number): Promise; /** - * Defines whether the built-in rename provider is enabled. + * Get outline entries for the item at the given position in the file. + * @returns `Promise` */ - readonly rename?: boolean; + getNavigationBarItems(fileName: string): Promise; /** - * Defines whether the built-in color provider is enabled. + * Get changes which should be applied to format the given file. + * @param options `typescript.FormatCodeOptions` + * @returns `Promise` */ - readonly colors?: boolean; + getFormattingEditsForDocument(fileName: string, options: any): Promise; /** - * Defines whether the built-in foldingRange provider is enabled. + * Get changes which should be applied to format the given range in the file. + * @param options `typescript.FormatCodeOptions` + * @returns `Promise` */ - readonly foldingRanges?: boolean; + getFormattingEditsForRange(fileName: string, start: number, end: number, options: any): Promise; /** - * Defines whether the built-in diagnostic provider is enabled. + * Get formatting changes which should be applied after the given keystroke. + * @param options `typescript.FormatCodeOptions` + * @returns `Promise` */ - readonly diagnostics?: boolean; + getFormattingEditsAfterKeystroke(fileName: string, postion: number, ch: string, options: any): Promise; /** - * Defines whether the built-in selection range provider is enabled. + * Get other occurrences which should be updated when renaming the item at the given file and position. + * @returns `Promise` */ - readonly selectionRanges?: boolean; + findRenameLocations(fileName: string, positon: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename: boolean): Promise; /** - * Defines whether the built-in documentFormattingEdit provider is enabled. + * 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` */ - readonly documentFormattingEdits?: boolean; + getRenameInfo(fileName: string, positon: number, options: any): Promise; /** - * Defines whether the built-in documentRangeFormattingEdit provider is enabled. + * Get transpiled output for the given file. + * @returns `typescript.EmitOutput` */ - readonly documentRangeFormattingEdits?: boolean; - } - export interface LanguageServiceDefaults { - readonly languageId: string; - readonly modeConfiguration: ModeConfiguration; - readonly onDidChange: IEvent; - readonly options: Options; - setOptions(options: Options): void; - setModeConfiguration(modeConfiguration: ModeConfiguration): void; - } - export const htmlLanguageService: LanguageServiceRegistration; - export const htmlDefaults: LanguageServiceDefaults; - export const handlebarLanguageService: LanguageServiceRegistration; - export const handlebarDefaults: LanguageServiceDefaults; - export const razorLanguageService: LanguageServiceRegistration; - export const razorDefaults: LanguageServiceDefaults; - export interface LanguageServiceRegistration extends IDisposable { - readonly defaults: LanguageServiceDefaults; - } - /** - * Registers a new HTML language service for the languageId. - * Note: 'html', 'handlebar' and 'razor' are registered by default. - * - * Use this method to register additional language ids with a HTML service. - * The language server has to be registered before an editor model is opened. - */ - export function registerHTMLLanguageService(languageId: string, options?: Options, modeConfiguration?: ModeConfiguration): LanguageServiceRegistration; - export interface HTMLDataConfiguration { + getEmitOutput(fileName: string): Promise; /** - * Defines whether the standard HTML tags and attributes are shown + * Get possible code fixes at the given position in the file. + * @param formatOptions `typescript.FormatCodeOptions` + * @returns `Promise>` */ - readonly useDefaultDataProvider?: boolean; + getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: any): Promise>; /** - * Provides a set of custom data providers. + * Get inlay hints in the range of the file. + * @param fileName + * @returns `Promise` */ - readonly dataProviders?: { - [providerId: string]: HTMLDataV1; - }; - } - /** - * Custom HTML tags attributes and attribute values - * https://github.com/microsoft/vscode-html-languageservice/blob/main/docs/customData.md - */ - export interface HTMLDataV1 { - readonly version: 1 | 1.1; - readonly tags?: ITagData[]; - readonly globalAttributes?: IAttributeData[]; - readonly valueSets?: IValueSet[]; - } - export interface IReference { - readonly name: string; - readonly url: string; - } - export interface ITagData { - readonly name: string; - readonly description?: string | MarkupContent; - readonly attributes: IAttributeData[]; - readonly references?: IReference[]; - } - export interface IAttributeData { - readonly name: string; - readonly description?: string | MarkupContent; - readonly valueSet?: string; - readonly values?: IValueData[]; - readonly references?: IReference[]; - } - export interface IValueData { - readonly name: string; - readonly description?: string | MarkupContent; - readonly references?: IReference[]; - } - export interface IValueSet { - readonly name: string; - readonly values: IValueData[]; - } - export interface MarkupContent { - readonly kind: MarkupKind; - readonly value: string; + provideInlayHints(fileName: string, start: number, end: number): Promise>; } - export type MarkupKind = 'plaintext' | 'markdown'; + 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>; }