diff --git a/examples/api-tests/src/saveable.spec.js b/examples/api-tests/src/saveable.spec.js index 27c807946bc09..cfaca9ed11c34 100644 --- a/examples/api-tests/src/saveable.spec.js +++ b/examples/api-tests/src/saveable.spec.js @@ -62,6 +62,7 @@ describe('Saveable', function () { const toTearDown = new DisposableCollection(); + /** @type {string | undefined} */ const autoSave = preferences.get('editor.autoSave', undefined, rootUri.toString()); beforeEach(async () => { diff --git a/examples/api-tests/src/typescript.spec.js b/examples/api-tests/src/typescript.spec.js index 8d79c64ee16d1..0c11b631ac6ff 100644 --- a/examples/api-tests/src/typescript.spec.js +++ b/examples/api-tests/src/typescript.spec.js @@ -39,6 +39,7 @@ describe('TypeScript', function () { const { ProgressStatusBarItem } = require('@theia/core/lib/browser/progress-status-bar-item'); const { FileService } = require('@theia/filesystem/lib/browser/file-service'); const { PluginViewRegistry } = require('@theia/plugin-ext/lib/main/browser/view/plugin-view-registry'); + const { Deferred } = require('@theia/core/lib/common/promise-util'); const container = window.theia.container; const editorManager = container.get(EditorManager); @@ -504,7 +505,7 @@ module.exports = (port, host, argv) => Promise.resolve() assert.isTrue(contextKeyService.match('editorTextFocus')); assert.isFalse(contextKeyService.match('renameInputVisible')); - const renaming = commands.executeCommand('editor.action.rename'); + commands.executeCommand('editor.action.rename'); await waitForAnimation(() => contextKeyService.match('renameInputVisible') && document.activeElement instanceof HTMLInputElement && document.activeElement.selectionEnd === 'container'.length); @@ -520,7 +521,11 @@ module.exports = (port, host, argv) => Promise.resolve() input.value = 'foo'; keybindings.dispatchKeyDown('Enter', input); - await renaming; + // all rename edits should be grouped in one edit operation and applied in the same tick + const waitForApplyRenameEdits = new Deferred(); + editor.getControl().onDidChangeModelContent(waitForApplyRenameEdits.resolve); + await waitForApplyRenameEdits.promise; + assert.isTrue(contextKeyService.match('editorTextFocus')); assert.isFalse(contextKeyService.match('renameInputVisible')); diff --git a/packages/console/src/browser/console-widget.ts b/packages/console/src/browser/console-widget.ts index 10f3f4b9302f9..ff1a2d4b0efc5 100644 --- a/packages/console/src/browser/console-widget.ts +++ b/packages/console/src/browser/console-widget.ts @@ -103,10 +103,11 @@ export class ConsoleWidget extends BaseWidget implements StatefulWidget { this.toDispose.push(input); this.toDispose.push(input.getControl().onDidLayoutChange(() => this.resizeContent())); - // todo update font if fontInfo was changed only - // it's impossible at the moment, but will be fixed for next upgrade of monaco version - // see https://github.com/microsoft/vscode/commit/5084e8ca1935698c98c163e339ca664818786c6d - this.toDispose.push(input.getControl().onDidChangeConfiguration(() => this.updateFont())); + this.toDispose.push(input.getControl().onDidChangeConfiguration(event => { + if (event.hasChanged(monaco.editor.EditorOption.fontInfo)) { + this.updateFont(); + } + })); this.updateFont(); if (inputFocusContextKey) { diff --git a/packages/core/package.json b/packages/core/package.json index b2d2755f1ddb6..4133ba2277ba3 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -47,8 +47,8 @@ "reflect-metadata": "^0.1.10", "route-parser": "^0.0.5", "safer-buffer": "^2.1.2", - "vscode-languageserver-protocol": "^3.15.0-next.8", - "vscode-languageserver-types": "^3.15.0-next", + "vscode-languageserver-types": "^3.15.1", + "vscode-languageserver-protocol": "^3.15.3", "vscode-uri": "^2.1.1", "vscode-ws-jsonrpc": "^0.2.0", "ws": "^7.1.2", @@ -107,4 +107,4 @@ "nyc": { "extends": "../../configs/nyc.json" } -} \ No newline at end of file +} diff --git a/packages/debug/package.json b/packages/debug/package.json index e37766b78de45..46ca4adeef0dc 100644 --- a/packages/debug/package.json +++ b/packages/debug/package.json @@ -18,7 +18,7 @@ "@theia/userstorage": "^1.4.0", "@theia/variable-resolver": "^1.4.0", "@theia/workspace": "^1.4.0", - "jsonc-parser": "^2.0.2", + "jsonc-parser": "^2.2.0", "mkdirp": "^0.5.0", "p-debounce": "^2.1.0", "requestretry": "^3.1.0", diff --git a/packages/editor/src/browser/editor-preferences.ts b/packages/editor/src/browser/editor-preferences.ts index 971aa6f8d0d08..552ebc729e4aa 100644 --- a/packages/editor/src/browser/editor-preferences.ts +++ b/packages/editor/src/browser/editor-preferences.ts @@ -35,7 +35,7 @@ const platform = { isLinux: OS.type() === OS.Type.Linux }; -// should be in sync with https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/config/editorOptions.ts#L2974 +// should be in sync with https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/config/editorOptions.ts#L3042 export const EDITOR_FONT_DEFAULTS = { fontFamily: ( isOSX ? DEFAULT_MAC_FONT_FAMILY : (isWindows ? DEFAULT_WINDOWS_FONT_FAMILY : DEFAULT_LINUX_FONT_FAMILY) @@ -48,7 +48,7 @@ export const EDITOR_FONT_DEFAULTS = { letterSpacing: 0, }; -// should be in sync with https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/config/editorOptions.ts#L2989 +// should be in sync with https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/config/editorOptions.ts#L3057 export const EDITOR_MODEL_DEFAULTS = { tabSize: 4, indentSize: 4, @@ -62,11 +62,11 @@ export const EDITOR_MODEL_DEFAULTS = { /* eslint-disable max-len */ // should be in sync with: -// 1. https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/config/commonEditorConfig.ts#L442 -// 2. https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/config/commonEditorConfig.ts#L526 +// 1. https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/config/commonEditorConfig.ts#L441 +// 2. https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/config/commonEditorConfig.ts#L530 -// 1. Copy from https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/config/commonEditorConfig.ts#L526 -// 2. Align first items with https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/config/commonEditorConfig.ts#L442 +// 1. Copy from https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/config/commonEditorConfig.ts#L530 +// 2. Align first items with https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/config/commonEditorConfig.ts#L441 // 3. Find -> Use Regular Expressions to clean up data and replace " by ', for example -> nls\.localize\(.*, "(.*)"\) -> "$1" // 4. Apply `quotemark` quick fixes // 5. Fix the rest manually @@ -102,6 +102,11 @@ const codeEditorPreferenceProperties = { 'default': true, 'description': 'Controls whether completions should be computed based on words in the document.' }, + 'editor.semanticHighlighting.enabled': { + 'type': 'boolean', + 'default': false, + 'description': 'Controls whether the semanticHighlighting is shown for the languages that support it.' + }, 'editor.stablePeek': { 'type': 'boolean', 'default': false, @@ -269,6 +274,11 @@ const codeEditorPreferenceProperties = { 'type': 'boolean', 'default': true }, + 'editor.comments.insertSpace': { + 'type': 'boolean', + 'default': true, + 'description': 'Controls whether a space character is inserted when commenting.' + }, 'editor.copyWithSyntaxHighlighting': { 'description': 'Controls whether syntax highlighting should be copied into the clipboard.', 'type': 'boolean', @@ -391,6 +401,11 @@ const codeEditorPreferenceProperties = { ], 'default': 'auto' }, + 'editor.foldingHighlight': { + 'description': 'Controls whether the editor should highlight folded ranges.', + 'type': 'boolean', + 'default': true + }, 'editor.fontFamily': { 'description': 'Controls the font family.', 'type': 'string', @@ -730,6 +745,19 @@ const codeEditorPreferenceProperties = { 'default': false, 'description': 'Controls whether the parameter hints menu cycles or closes when reaching the end of the list.' }, + 'editor.peekWidgetDefaultFocus': { + 'enumDescriptions': [ + 'Focus the tree when opening peek', + 'Focus the editor when opening peek' + ], + 'description': 'Controls whether to focus the inline editor or the tree in the peek widget.', + 'type': 'string', + 'enum': [ + 'tree', + 'editor' + ], + 'default': 'tree' + }, 'editor.quickSuggestions': { 'anyOf': [ { @@ -927,7 +955,7 @@ const codeEditorPreferenceProperties = { 'editor.suggest.snippetsPreventQuickSuggestions': { 'type': 'boolean', 'default': true, - 'description': 'Control whether an active snippet prevents quick suggestions.' + 'description': 'Controls whether an active snippet prevents quick suggestions.' }, 'editor.suggest.showIcons': { 'type': 'boolean', @@ -1076,6 +1104,11 @@ const codeEditorPreferenceProperties = { 'default': true, 'markdownDescription': 'When enabled IntelliSense shows `snippet`-suggestions.' }, + 'editor.suggest.hideStatusBar': { + 'type': 'boolean', + 'default': true, + 'markdownDescription': 'Controls the visibility of the status bar at the bottom of the suggest widget.' + }, 'editor.suggestFontSize': { 'markdownDescription': 'Font size for the suggest widget. When set to `0`, the value of `#editor.fontSize#` is used.', 'type': 'integer', @@ -1175,6 +1208,19 @@ const codeEditorPreferenceProperties = { 'deepIndent' ], 'default': 'same' + }, + 'editor.wrappingStrategy': { + 'enumDescriptions': [ + 'Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width.', + 'Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.' + ], + 'description': 'Controls the algorithm that computes wrapping points.', + 'type': 'string', + 'enum': [ + 'simple', + 'advanced' + ], + 'default': 'simple' } }; /* eslint-enable max-len */ diff --git a/packages/keymaps/package.json b/packages/keymaps/package.json index f95cfd66fa39f..efbf41c1eb958 100644 --- a/packages/keymaps/package.json +++ b/packages/keymaps/package.json @@ -10,7 +10,7 @@ "@types/lodash.debounce": "4.0.3", "ajv": "^6.5.3", "fuzzy": "^0.1.3", - "jsonc-parser": "^2.0.2", + "jsonc-parser": "^2.2.0", "lodash.debounce": "^4.0.8" }, "devDependencies": { diff --git a/packages/monaco/package.json b/packages/monaco/package.json index 2556fa1d5de2b..260012b246282 100644 --- a/packages/monaco/package.json +++ b/packages/monaco/package.json @@ -6,16 +6,16 @@ "@theia/core": "^1.4.0", "@theia/editor": "^1.4.0", "@theia/filesystem": "^1.4.0", - "@theia/monaco-editor-core": "^0.19.3", + "@theia/monaco-editor-core": "^0.20.0", "@theia/markers": "^1.4.0", "@theia/outline-view": "^1.4.0", "@theia/workspace": "^1.4.0", "deepmerge": "2.0.1", "fast-plist": "^0.1.2", "idb": "^4.0.5", - "jsonc-parser": "^2.0.2", + "jsonc-parser": "^2.2.0", "onigasm": "^2.2.0", - "vscode-textmate": "^4.0.1" + "vscode-textmate": "^4.4.0" }, "publishConfig": { "access": "public" diff --git a/packages/monaco/src/browser/monaco-bulk-edit-service.ts b/packages/monaco/src/browser/monaco-bulk-edit-service.ts index 1216d8fb9e1c9..afaa3817655aa 100644 --- a/packages/monaco/src/browser/monaco-bulk-edit-service.ts +++ b/packages/monaco/src/browser/monaco-bulk-edit-service.ts @@ -23,8 +23,29 @@ export class MonacoBulkEditService implements monaco.editor.IBulkEditService { @inject(MonacoWorkspace) protected readonly workspace: MonacoWorkspace; + private _previewHandler?: monaco.editor.IBulkEditPreviewHandler; + apply(edit: monaco.languages.WorkspaceEdit): Promise { return this.workspace.applyBulkEdit(edit); } + hasPreviewHandler(): boolean { + return Boolean(this._previewHandler); + } + + setPreviewHandler(handler: monaco.editor.IBulkEditPreviewHandler): monaco.IDisposable { + this._previewHandler = handler; + + const disposePreviewHandler = () => { + if (this._previewHandler === handler) { + this._previewHandler = undefined; + } + }; + + return { + dispose(): void { + disposePreviewHandler(); + } + }; + } } diff --git a/packages/monaco/src/browser/monaco-editor-model.ts b/packages/monaco/src/browser/monaco-editor-model.ts index 6e45ecf41bd87..f03fd4113995f 100644 --- a/packages/monaco/src/browser/monaco-editor-model.ts +++ b/packages/monaco/src/browser/monaco-editor-model.ts @@ -25,6 +25,7 @@ import { Range } from 'vscode-languageserver-types'; import { Saveable } from '@theia/core/lib/browser/saveable'; import { MonacoToProtocolConverter } from './monaco-to-protocol-converter'; import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter'; +import { ILogger, Loggable, Log } from '@theia/core/lib/common/logger'; export { TextDocumentSaveReason @@ -80,7 +81,8 @@ export class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { constructor( protected readonly resource: Resource, protected readonly m2p: MonacoToProtocolConverter, - protected readonly p2m: ProtocolToMonacoConverter + protected readonly p2m: ProtocolToMonacoConverter, + protected readonly logger?: ILogger ) { this.toDispose.push(resource); this.toDispose.push(this.toDisposeOnAutoSave); @@ -301,6 +303,7 @@ export class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { protected syncCancellationTokenSource = new CancellationTokenSource(); protected cancelSync(): CancellationToken { + this.trace(log => log('MonacoEditorModel.cancelSync')); this.syncCancellationTokenSource.cancel(); this.syncCancellationTokenSource = new CancellationTokenSource(); return this.syncCancellationTokenSource.token; @@ -311,12 +314,23 @@ export class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { return this.run(() => this.doSync(token)); } protected async doSync(token: CancellationToken): Promise { + this.trace(log => log('MonacoEditorModel.doSync - enter')); if (token.isCancellationRequested) { + this.trace(log => log('MonacoEditorModel.doSync - exit - cancelled')); return; } const value = await this.readContents(); - if (value === undefined || token.isCancellationRequested || this._dirty) { + if (value === undefined) { + this.trace(log => log('MonacoEditorModel.doSync - exit - resource not found')); + return; + } + if (token.isCancellationRequested) { + this.trace(log => log('MonacoEditorModel.doSync - exit - cancelled while looking for a resource')); + return; + } + if (this._dirty) { + this.trace(log => log('MonacoEditorModel.doSync - exit - pending dirty changes')); return; } @@ -325,6 +339,7 @@ export class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { ignoreDirty: true, ignoreContentChanges: true }); + this.trace(log => log('MonacoEditorModel.doSync - exit')); } protected async readContents(): Promise { try { @@ -350,12 +365,15 @@ export class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { protected ignoreDirtyEdits = false; protected markAsDirty(): void { + this.trace(log => log('MonacoEditorModel.markAsDirty - enter')); if (this.ignoreDirtyEdits) { + this.trace(log => log('MonacoEditorModel.markAsDirty - exit - ignoring dirty changes enabled')); return; } this.cancelSync(); this.setDirty(true); this.doAutoSave(); + this.trace(log => log('MonacoEditorModel.markAsDirty - exit')); } protected doAutoSave(): void { @@ -373,6 +391,7 @@ export class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { protected saveCancellationTokenSource = new CancellationTokenSource(); protected cancelSave(): CancellationToken { + this.trace(log => log('MonacoEditorModel.cancelSave')); this.saveCancellationTokenSource.cancel(); this.saveCancellationTokenSource = new CancellationTokenSource(); return this.saveCancellationTokenSource.token; @@ -391,6 +410,7 @@ export class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { } protected fireDidChangeContent(event: monaco.editor.IModelContentChangedEvent): void { + this.trace(log => log(`MonacoEditorModel.fireDidChangeContent - enter - ${JSON.stringify(event, undefined, 2)}`)); if (this.model.getAlternativeVersionId() === this.bufferSavedVersionId) { this.setDirty(false); } else { @@ -400,6 +420,7 @@ export class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { const changeContentEvent = this.asContentChangedEvent(event); this.onDidChangeContentEmitter.fire(changeContentEvent); this.pushContentChanges(changeContentEvent.contentChanges); + this.trace(log => log('MonacoEditorModel.fireDidChangeContent - exit')); } protected asContentChangedEvent(event: monaco.editor.IModelContentChangedEvent): MonacoModelContentChangedEvent { const contentChanges = event.changes.map(change => this.asTextDocumentContentChangeEvent(change)); @@ -541,6 +562,7 @@ export class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { } async revert(options?: Saveable.RevertOptions): Promise { + this.trace(log => log('MonacoEditorModel.revert - enter')); this.cancelSave(); const soft = options && options.soft; if (soft !== true) { @@ -553,6 +575,7 @@ export class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { } } this.setDirty(false); + this.trace(log => log('MonacoEditorModel.revert - exit')); } createSnapshot(): object { @@ -565,6 +588,14 @@ export class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { this.model.setValue(snapshot.value); } + protected trace(loggable: Loggable): void { + if (this.logger) { + this.logger.debug((log: Log) => + loggable((message, ...params) => log(message, ...params, this.resource.uri.toString(true))) + ); + } + } + } export namespace MonacoEditorModel { export interface ApplyEditsOptions { diff --git a/packages/monaco/src/browser/monaco-editor-provider.ts b/packages/monaco/src/browser/monaco-editor-provider.ts index 7a364fe62c7e8..69392712a25a9 100644 --- a/packages/monaco/src/browser/monaco-editor-provider.ts +++ b/packages/monaco/src/browser/monaco-editor-provider.ts @@ -467,7 +467,7 @@ export class MonacoEditorProvider { if (referencesController._widget) { referencesController._widget.show(range); - referencesController._widget.focus(); + referencesController._widget.focusOnReferenceTree(); } }, (e: any) => { diff --git a/packages/monaco/src/browser/monaco-frontend-module.ts b/packages/monaco/src/browser/monaco-frontend-module.ts index d603cfce725d0..acb05d9cda84d 100644 --- a/packages/monaco/src/browser/monaco-frontend-module.ts +++ b/packages/monaco/src/browser/monaco-frontend-module.ts @@ -18,13 +18,11 @@ import '../../src/browser/style/index.css'; import '../../src/browser/style/symbol-sprite.svg'; import '../../src/browser/style/symbol-icons.css'; -import debounce = require('lodash.debounce'); import { ContainerModule, decorate, injectable, interfaces } from 'inversify'; import { MenuContribution, CommandContribution } from '@theia/core/lib/common'; -import { PreferenceScope } from '@theia/core/lib/common/preferences/preference-scope'; import { QuickOpenService, FrontendApplicationContribution, KeybindingContribution, - PreferenceService, PreferenceSchemaProvider, createPreferenceProxy, QuickOpenContribution, PreferenceChanges + PreferenceService, PreferenceSchemaProvider, createPreferenceProxy, QuickOpenContribution, PreferenceScope, PreferenceChange, OVERRIDE_PROPERTY_PATTERN } from '@theia/core/lib/browser'; import { TextEditorProvider, DiffNavigatorProvider } from '@theia/editor/lib/browser'; import { StrictEditorTextFocusContext } from '@theia/editor/lib/browser/editor-keybinding-contexts'; @@ -149,7 +147,7 @@ export function createMonacoConfigurationService(container: interfaces.Container const service = monaco.services.StaticServices.configurationService.get(); const _configuration = service._configuration; - _configuration.getValue = (section, overrides, workspace) => { + _configuration.getValue = (section, overrides) => { const overrideIdentifier = overrides && 'overrideIdentifier' in overrides && overrides['overrideIdentifier'] as string || undefined; const resourceUri = overrides && 'resource' in overrides && !!overrides['resource'] && overrides['resource'].toString(); // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -162,40 +160,103 @@ export function createMonacoConfigurationService(container: interfaces.Container return proxy; }; - const initFromConfiguration = debounce(() => { - const event = new monaco.services.ConfigurationChangeEvent(); - event._source = 6 /* DEFAULT */; - service._onDidChangeConfiguration.fire(event); - }); - preferences.onPreferenceChanged(e => { - if (e.scope === PreferenceScope.Default) { - initFromConfiguration(); + const toTarget = (scope: PreferenceScope): monaco.services.ConfigurationTarget => { + switch (scope) { + case PreferenceScope.Default: return monaco.services.ConfigurationTarget.DEFAULT; + case PreferenceScope.User: return monaco.services.ConfigurationTarget.USER; + case PreferenceScope.Workspace: return monaco.services.ConfigurationTarget.WORKSPACE; + case PreferenceScope.Folder: return monaco.services.ConfigurationTarget.WORKSPACE_FOLDER; } + }; + + interface FireDidChangeConfigurationContext { + changes: PreferenceChange[]; + affectedKeys: Set; + keys: Set; + overrides: Map> + } + const newFireDidChangeConfigurationContext = (): FireDidChangeConfigurationContext => ({ + changes: [], + affectedKeys: new Set(), + keys: new Set(), + overrides: new Map>() }); - const parseSections = (changes?: PreferenceChanges) => { - if (!changes) { - return undefined; + const fireDidChangeConfiguration = (source: monaco.services.ConfigurationTarget, context: FireDidChangeConfigurationContext): void => { + if (!context.affectedKeys.size) { + return; } - const sections = []; - for (let key of Object.keys(changes)) { - const hasOverride = key.startsWith('['); + const overrides: [string, string[]][] = []; + for (const [override, values] of context.overrides) { + overrides.push([override, [...values]]); + } + service._onDidChangeConfiguration.fire({ + change: { + keys: [...context.keys], + overrides + }, + affectedKeys: [...context.affectedKeys], + source, + affectsConfiguration: (prefix, options) => { + if (!context.affectedKeys.has(prefix)) { + return false; + } + for (const change of context.changes) { + const overridden = preferences.overriddenPreferenceName(change.preferenceName); + const preferenceName = overridden ? overridden.preferenceName : change.preferenceName; + if (preferenceName.startsWith(prefix)) { + if (options?.overrideIdentifier !== undefined) { + if (overridden && overridden.overrideIdentifier !== options?.overrideIdentifier) { + continue; + } + } + if (change.affects(options?.resource?.toString())) { + return true; + } + } + } + return false; + } + }); + }; + + preferences.onPreferencesChanged(event => { + let source: monaco.services.ConfigurationTarget | undefined; + let context = newFireDidChangeConfigurationContext(); + for (let key of Object.keys(event)) { + const change = event[key]; + const target = toTarget(change.scope); + if (source !== undefined && target !== source) { + fireDidChangeConfiguration(source, context); + context = newFireDidChangeConfigurationContext(); + } + context.changes.push(change); + source = target; + + let overrideKeys: Set | undefined; + if (key.startsWith('[')) { + const index = key.indexOf('.'); + const override = key.substring(0, index); + const overrideIdentifier = override.match(OVERRIDE_PROPERTY_PATTERN)?.[1]; + if (overrideIdentifier) { + context.keys.add(override); + context.affectedKeys.add(override); + overrideKeys = context.overrides.get(overrideIdentifier) || new Set(); + context.overrides.set(overrideIdentifier, overrideKeys); + key = key.substring(index + 1); + } + } while (key) { - sections.push(key); - if (hasOverride && key.indexOf('.') !== -1) { - sections.push(key.substr(key.indexOf('.'))); + if (overrideKeys) { + overrideKeys.add(key); } + context.keys.add(key); + context.affectedKeys.add(key); const index = key.lastIndexOf('.'); key = key.substring(0, index); } } - return sections; - }; - preferences.onPreferencesChanged((changes?: PreferenceChanges) => { - const affectedSections = parseSections(changes); - if (affectedSections) { - const event = new monaco.services.ConfigurationChangeEvent(); - event.change(affectedSections); - service._onDidChangeConfiguration.fire(event); + if (source) { + fireDidChangeConfiguration(source, context); } }); diff --git a/packages/monaco/src/browser/monaco-menu.ts b/packages/monaco/src/browser/monaco-menu.ts index 9a8d592ed3ab2..87f86839c50dd 100644 --- a/packages/monaco/src/browser/monaco-menu.ts +++ b/packages/monaco/src/browser/monaco-menu.ts @@ -51,14 +51,15 @@ export class MonacoEditorMenuContribution implements MenuContribution { this.registerPeekSubmenu(registry); registry.registerSubmenu(MonacoMenus.SELECTION, 'Selection'); - for (const item of MenuRegistry.getMenuItems(23)) { + for (const item of MenuRegistry.getMenuItems(25)) { if (!monaco.actions.isIMenuItem(item)) { continue; } const commandId = this.commands.validate(item.command.id); if (commandId) { const menuPath = [...MonacoMenus.SELECTION, (item.group || '')]; - const label = this.removeMnemonic(item.command.title); + const title = typeof item.command.title === 'string' ? item.command.title : item.command.title.value; + const label = this.removeMnemonic(title); const order = item.order ? String(item.order) : ''; registry.registerMenuAction(menuPath, { commandId, order, label }); } @@ -69,6 +70,9 @@ export class MonacoEditorMenuContribution implements MenuContribution { registry.registerSubmenu(MonacoMenus.PEEK_CONTEXT_SUBMENU, 'Peek'); for (const item of MenuRegistry.getMenuItems(8)) { + if (!monaco.actions.isIMenuItem(item)) { + continue; + } const commandId = this.commands.validate(item.command.id); if (commandId) { const order = item.order ? String(item.order) : ''; diff --git a/packages/monaco/src/browser/monaco-text-model-service.ts b/packages/monaco/src/browser/monaco-text-model-service.ts index 9668552af9efe..5b97678e4dc67 100644 --- a/packages/monaco/src/browser/monaco-text-model-service.ts +++ b/packages/monaco/src/browser/monaco-text-model-service.ts @@ -22,6 +22,7 @@ import { MonacoEditorModel } from './monaco-editor-model'; import IReference = monaco.editor.IReference; import { MonacoToProtocolConverter } from './monaco-to-protocol-converter'; import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter'; +import { ILogger } from '@theia/core/lib/common/logger'; export { IReference }; export const MonacoEditorModelFactory = Symbol('MonacoEditorModelFactory'); @@ -58,6 +59,9 @@ export class MonacoTextModelService implements monaco.editor.ITextModelService { @named(MonacoEditorModelFactory) protected readonly factories: ContributionProvider; + @inject(ILogger) + protected readonly logger: ILogger; + get models(): MonacoEditorModel[] { return this._models.values(); } @@ -87,7 +91,7 @@ export class MonacoTextModelService implements monaco.editor.ITextModelService { protected createModel(resource: Resource): MaybePromise { const factory = this.factories.getContributions().find(({ scheme }) => resource.uri.scheme === scheme); - return factory ? factory.createModel(resource) : new MonacoEditorModel(resource, this.m2p, this.p2m); + return factory ? factory.createModel(resource) : new MonacoEditorModel(resource, this.m2p, this.p2m, this.logger); } protected readonly modelOptions: { [name: string]: (keyof monaco.editor.ITextModelUpdateOptions | undefined) } = { diff --git a/packages/monaco/src/browser/monaco-workspace.ts b/packages/monaco/src/browser/monaco-workspace.ts index 5a9690174f31f..909148bfd5049 100644 --- a/packages/monaco/src/browser/monaco-workspace.ts +++ b/packages/monaco/src/browser/monaco-workspace.ts @@ -30,77 +30,25 @@ import { MaybePromise } from '@theia/core/lib/common/types'; import { FileService } from '@theia/filesystem/lib/browser/file-service'; import { FileSystemProviderCapabilities } from '@theia/filesystem/lib/common/files'; -// Note: `newUri` and `oldUri` are both optional although it is mandatory in `monaco.languages.ResourceFileEdit`. -// See: https://github.com/microsoft/monaco-editor/issues/1396 -export interface ResourceEdit { - readonly newUri?: URI; - readonly oldUri?: URI; - readonly options?: { - readonly overwrite?: boolean; - readonly ignoreIfNotExists?: boolean; - readonly ignoreIfExists?: boolean; - readonly recursive?: boolean; +export namespace WorkspaceFileEdit { + export function is(arg: Edit): arg is monaco.languages.WorkspaceFileEdit { + return ('oldUri' in arg && monaco.Uri.isUri(arg.oldUri)) || + ('newUri' in arg && monaco.Uri.isUri(arg.newUri)); } } -export interface CreateResourceEdit extends ResourceEdit { - readonly newUri: URI; -} -export namespace CreateResourceEdit { - export function is(arg: Edit): arg is CreateResourceEdit { - return ('newUri' in arg && (arg as any).newUri instanceof URI) && // eslint-disable-line @typescript-eslint/no-explicit-any - !('oldUri' in arg && (arg as any).oldUri instanceof URI); // eslint-disable-line @typescript-eslint/no-explicit-any - } -} - -export interface DeleteResourceEdit extends ResourceEdit { - readonly oldUri: URI; -} -export namespace DeleteResourceEdit { - export function is(arg: Edit): arg is DeleteResourceEdit { - return !('newUri' in arg && (arg as any).newUri instanceof URI) && // eslint-disable-line @typescript-eslint/no-explicit-any - ('oldUri' in arg && (arg as any).oldUri instanceof URI); // eslint-disable-line @typescript-eslint/no-explicit-any +export namespace WorkspaceTextEdit { + export function is(arg: Edit): arg is monaco.languages.WorkspaceTextEdit { + return !!arg && typeof arg === 'object' + && 'resource' in arg + && monaco.Uri.isUri(arg.resource) + && 'edit' in arg + && arg.edit !== null + && typeof arg.edit === 'object'; } } -export interface RenameResourceEdit extends ResourceEdit { - readonly newUri: URI; - readonly oldUri: URI; -} -export namespace RenameResourceEdit { - export function is(arg: Edit): arg is RenameResourceEdit { - return ('newUri' in arg && (arg as any).newUri instanceof URI) && // eslint-disable-line @typescript-eslint/no-explicit-any - ('oldUri' in arg && (arg as any).oldUri instanceof URI); // eslint-disable-line @typescript-eslint/no-explicit-any - } -} - -export interface TextEdits { - readonly uri: string - readonly version: number | undefined - readonly textEdits: monaco.languages.TextEdit[] -} -export namespace TextEdits { - export function is(arg: Edit): arg is TextEdits { - return 'uri' in arg - && typeof (arg as any).uri === 'string'; // eslint-disable-line @typescript-eslint/no-explicit-any - } - export function isVersioned(arg: TextEdits): boolean { - return is(arg) && arg.version !== undefined; - } -} - -export interface EditsByEditor extends TextEdits { - readonly editor: MonacoEditor; -} -export namespace EditsByEditor { - export function is(arg: Edit): arg is EditsByEditor { - return TextEdits.is(arg) - && 'editor' in arg - && (arg as any).editor instanceof MonacoEditor; // eslint-disable-line @typescript-eslint/no-explicit-any - } -} - -export type Edit = TextEdits | ResourceEdit; +export type Edit = monaco.languages.WorkspaceFileEdit | monaco.languages.WorkspaceTextEdit; export interface WorkspaceFoldersChangeEvent { readonly added: WorkspaceFolder[]; @@ -257,60 +205,33 @@ export class MonacoWorkspace { }); } + protected groupEdits(workspaceEdit: monaco.languages.WorkspaceEdit): Edit[][] { + const groups: Edit[][] = []; + let group: Edit[] | undefined; + for (const edit of workspaceEdit.edits) { + if (!group + || (WorkspaceFileEdit.is(group[0]) && !WorkspaceFileEdit.is(edit)) + || (WorkspaceTextEdit.is(group[0]) && !WorkspaceTextEdit.is(edit)) + ) { + group = []; + groups.push(group); + } + group.push(edit); + } + return groups; + } + async applyBulkEdit(workspaceEdit: monaco.languages.WorkspaceEdit): Promise { try { - const edits = this.groupEdits(workspaceEdit); - this.checkVersions(edits); let totalEdits = 0; let totalFiles = 0; - for (const edit of edits) { - if (TextEdits.is(edit)) { - let eol: monaco.editor.EndOfLineSequence | undefined; - const editOperations: monaco.editor.IIdentifiedSingleEditOperation[] = []; - const minimalEdits = await monaco.services.StaticServices.editorWorkerService.get().computeMoreMinimalEdits(monaco.Uri.parse(edit.uri), edit.textEdits); - if (minimalEdits) { - for (const textEdit of minimalEdits) { - if (typeof textEdit.eol === 'number') { - eol = textEdit.eol; - } - if (monaco.Range.isEmpty(textEdit.range) && !textEdit.text) { - // skip no-op - continue; - } - editOperations.push({ - forceMoveMarkers: false, - range: monaco.Range.lift(textEdit.range), - text: textEdit.text - }); - } - } - if (!editOperations.length && eol === undefined) { - continue; - } - const reference = await this.textModelService.createModelReference(new URI(edit.uri)); - try { - const model = reference.object.textEditorModel; - const editor = MonacoEditor.findByDocument(this.editorManager, reference.object)[0]; - const cursorState = editor?.getControl().getSelections() || []; - // start a fresh operation - model.pushStackElement(); - if (editOperations.length) { - model.pushEditOperations(cursorState, editOperations, () => cursorState); - } - if (eol !== undefined) { - model.pushEOL(eol); - } - // push again to make this change an undoable operation - model.pushStackElement(); - totalFiles += 1; - totalEdits += editOperations.length; - } finally { - reference.dispose(); - } - } else if (CreateResourceEdit.is(edit) || DeleteResourceEdit.is(edit) || RenameResourceEdit.is(edit)) { - await this.performResourceEdit(edit); + for (const group of this.groupEdits(workspaceEdit)) { + if (WorkspaceFileEdit.is(group[0])) { + await this.performFileEdits(group); } else { - throw new Error(`Unexpected edit type: ${JSON.stringify(edit)}`); + const result = await this.performTextEdits(group); + totalEdits += result.totalEdits; + totalFiles += result.totalFiles; } } const ariaSummary = this.getAriaSummary(totalEdits, totalFiles); @@ -324,17 +245,6 @@ export class MonacoWorkspace { } } - protected checkVersions(edits: Edit[]): void { - for (const textEdit of edits.filter(TextEdits.is).filter(TextEdits.isVersioned)) { - if (typeof textEdit.version === 'number') { - const model = this.textModelService.get(textEdit.uri); - if (model && model.textEditorModel.getVersionId() !== textEdit.version) { - throw new Error(`${model.uri} has changed in the meantime`); - } - } - } - } - protected getAriaSummary(totalEdits: number, totalFiles: number): string { if (totalEdits === 0) { return 'Made no edits'; @@ -345,74 +255,107 @@ export class MonacoWorkspace { return `Made ${totalEdits} text edits in one file`; } - protected groupEdits(workspaceEdit: monaco.languages.WorkspaceEdit): Edit[] { - const map = new Map(); - const result = []; - for (const edit of workspaceEdit.edits) { - if (this.isResourceFileEdit(edit)) { - const resourceTextEdit = edit; - const uri = resourceTextEdit.resource.toString(); - const version = resourceTextEdit.modelVersionId; - let editorEdit = map.get(uri); - if (!editorEdit) { - editorEdit = { - uri, - version, - textEdits: [] - }; - map.set(uri, editorEdit); - result.push(editorEdit); - } else { - if (editorEdit.version !== version) { - throw Error(`Multiple versions for the same URI '${uri}' within the same workspace edit.`); - } + protected async performTextEdits(edits: monaco.languages.WorkspaceTextEdit[]): Promise<{ + totalEdits: number, + totalFiles: number + }> { + let totalEdits = 0; + let totalFiles = 0; + const resourceEdits = new Map(); + for (const edit of edits) { + if (typeof edit.modelVersionId === 'number') { + const model = this.textModelService.get(edit.resource.toString()); + if (model && model.textEditorModel.getVersionId() !== edit.modelVersionId) { + throw new Error(`${model.uri} has changed in the meantime`); } - editorEdit.textEdits.push(...resourceTextEdit.edits); - } else { - const { options } = edit; - const oldUri = !!edit.oldUri ? new URI(edit.oldUri.toString()) : undefined; - const newUri = !!edit.newUri ? new URI(edit.newUri.toString()) : undefined; - result.push({ - oldUri, - newUri, - options - }); } + const key = edit.resource.toString(); + let array = resourceEdits.get(key); + if (!array) { + array = []; + resourceEdits.set(key, array); + } + array.push(edit); + } + const pending: Promise[] = []; + for (const [key, value] of resourceEdits) { + pending.push((async () => { + const uri = monaco.Uri.parse(key); + let eol: monaco.editor.EndOfLineSequence | undefined; + const editOperations: monaco.editor.IIdentifiedSingleEditOperation[] = []; + const minimalEdits = await monaco.services.StaticServices.editorWorkerService.get().computeMoreMinimalEdits(uri, value.map(v => v.edit)); + if (minimalEdits) { + for (const textEdit of minimalEdits) { + if (typeof textEdit.eol === 'number') { + eol = textEdit.eol; + } + if (monaco.Range.isEmpty(textEdit.range) && !textEdit.text) { + // skip no-op + continue; + } + editOperations.push({ + forceMoveMarkers: false, + range: monaco.Range.lift(textEdit.range), + text: textEdit.text + }); + } + } + if (!editOperations.length && eol === undefined) { + return; + } + const reference = await this.textModelService.createModelReference(uri); + try { + const model = reference.object.textEditorModel; + const editor = MonacoEditor.findByDocument(this.editorManager, reference.object)[0]; + const cursorState = editor?.getControl().getSelections() || []; + // start a fresh operation + model.pushStackElement(); + if (editOperations.length) { + model.pushEditOperations(cursorState, editOperations, () => cursorState); + } + if (eol !== undefined) { + model.pushEOL(eol); + } + // push again to make this change an undoable operation + model.pushStackElement(); + totalFiles += 1; + totalEdits += editOperations.length; + } finally { + reference.dispose(); + } + })()); } - return result; + await Promise.all(pending); + return { totalEdits, totalFiles }; } - protected async performResourceEdit(edit: CreateResourceEdit | RenameResourceEdit | DeleteResourceEdit): Promise { - const options = edit.options || {}; - if (RenameResourceEdit.is(edit)) { - // rename - if (options.overwrite === undefined && options.ignoreIfExists && await this.fileService.exists(edit.newUri)) { - return; // not overwriting, but ignoring, and the target file exists - } - await this.fileService.move(edit.oldUri, edit.newUri, { overwrite: options.overwrite }); - } else if (DeleteResourceEdit.is(edit)) { - // delete file - if (await this.fileService.exists(edit.oldUri)) { - let useTrash = this.filePreferences['files.enableTrash']; - if (useTrash && !(this.fileService.hasCapability(edit.oldUri, FileSystemProviderCapabilities.Trash))) { - useTrash = false; // not supported by provider + protected async performFileEdits(edits: monaco.languages.WorkspaceFileEdit[]): Promise { + for (const edit of edits) { + const options = edit.options || {}; + if (edit.newUri && edit.oldUri) { + // rename + if (options.overwrite === undefined && options.ignoreIfExists && await this.fileService.exists(new URI(edit.newUri))) { + return; // not overwriting, but ignoring, and the target file exists } - await this.fileService.delete(edit.oldUri, { useTrash, recursive: options.recursive }); - } else if (!options.ignoreIfNotExists) { - throw new Error(`${edit.oldUri} does not exist and can not be deleted`); - } - } else if (CreateResourceEdit.is(edit)) { - // create file - if (options.overwrite === undefined && options.ignoreIfExists && await this.fileService.exists(edit.newUri)) { - return; // not overwriting, but ignoring, and the target file exists + await this.fileService.move(new URI(edit.oldUri), new URI(edit.newUri), { overwrite: options.overwrite }); + } else if (!edit.newUri && edit.oldUri) { + // delete file + if (await this.fileService.exists(new URI(edit.oldUri))) { + let useTrash = this.filePreferences['files.enableTrash']; + if (useTrash && !(this.fileService.hasCapability(new URI(edit.oldUri), FileSystemProviderCapabilities.Trash))) { + useTrash = false; // not supported by provider + } + await this.fileService.delete(new URI(edit.oldUri), { useTrash, recursive: options.recursive }); + } else if (!options.ignoreIfNotExists) { + throw new Error(`${edit.oldUri} does not exist and can not be deleted`); + } + } else if (edit.newUri && !edit.oldUri) { + // create file + if (options.overwrite === undefined && options.ignoreIfExists && await this.fileService.exists(new URI(edit.newUri))) { + return; // not overwriting, but ignoring, and the target file exists + } + await this.fileService.create(new URI(edit.newUri), undefined, { overwrite: options.overwrite }); } - await this.fileService.create(edit.newUri, undefined, { overwrite: options.overwrite }); } } - - protected isResourceFileEdit(edit: monaco.languages.ResourceFileEdit | monaco.languages.ResourceTextEdit): edit is monaco.languages.ResourceTextEdit { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return 'resource' in edit && (edit as any).resource instanceof monaco.Uri; - } - } diff --git a/packages/monaco/src/typings/monaco/index.d.ts b/packages/monaco/src/typings/monaco/index.d.ts index 1c629305e9fed..63726c7e88c40 100644 --- a/packages/monaco/src/typings/monaco/index.d.ts +++ b/packages/monaco/src/typings/monaco/index.d.ts @@ -18,7 +18,7 @@ /// declare module monaco.instantiation { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/instantiation/common/instantiation.ts#L86 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/instantiation/common/instantiation.ts#L86 export interface IInstantiationService { invokeFunction: (fn: any, ...args: any) => any } @@ -58,16 +58,22 @@ declare module monaco.editor { removeDecorations(decorationTypeKey: string): void; } + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/services/bulkEditService.ts#L21 export interface IBulkEditResult { ariaSummary: string; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/browser/services/bulkEditService.ts#L23 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/services/bulkEditService.ts#L25 + export type IBulkEditPreviewHandler = (edit: monaco.languages.WorkspaceEdit, options?: IBulkEditOptions) => Promise; + + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/services/bulkEditService.ts#L27 export interface IBulkEditService { apply(edit: monaco.languages.WorkspaceEdit): Promise; + hasPreviewHandler(): boolean; + setPreviewHandler(handler: IBulkEditPreviewHandler): monaco.IDisposable; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/browser/widget/diffNavigator.ts#L43 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/widget/diffNavigator.ts#L43 export interface IDiffNavigator { readonly ranges: IDiffRange[]; readonly nextIdx: number; @@ -75,12 +81,12 @@ declare module monaco.editor { _initIdx(fwd: boolean): void; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/browser/widget/diffNavigator.ts#L16 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/widget/diffNavigator.ts#L16 export interface IDiffRange { readonly range: Range; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/browser/standaloneCodeEditor.ts#L205 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/browser/standaloneCodeEditor.ts#L206 export interface IStandaloneCodeEditor extends CommonCodeEditor { setDecorations(decorationTypeKey: string, ranges: IDecorationOptions[]): void; setDecorationsFast(decorationTypeKey: string, ranges: IRange[]): void; @@ -94,7 +100,7 @@ declare module monaco.editor { } } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/browser/widget/codeEditorWidget.ts#L104 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/widget/codeEditorWidget.ts#L106 export interface CommonCodeEditor { readonly _commandService: monaco.commands.ICommandService; readonly _instantiationService: monaco.instantiation.IInstantiationService; @@ -111,42 +117,50 @@ declare module monaco.editor { } | null; } - // https://github.com/theia-ide/vscode/blob/d24b5f70c69b3e75cd10c6b5247a071265ccdd38/src/vs/editor/contrib/codeAction/codeActionCommands.ts#L69 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/codeAction/codeActionCommands.ts#L68 export interface QuickFixController { readonly _ui: { rawValue?: CodeActionUi } } + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/codeAction/codeActionUi.ts#L22 export interface CodeActionUi { readonly _lightBulbWidget: { rawValue?: LightBulbWidget } } + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/codeAction/lightBulbWidget.ts#L47 export interface LightBulbWidget { readonly _domNode: HTMLDivElement; } - // https://github.com/theia-ide/vscode/blob/d24b5f70c69b3e75cd10c6b5247a071265ccdd38/src/vs/editor/contrib/codelens/codelensController.ts#L24 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/codelens/codelensController.ts#L24 export interface CodeLensContribution { readonly _lenses: CodeLensWidget[]; } + + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/codelens/codelensWidget.ts#L182 export interface CodeLensWidget { readonly _contentWidget?: CodeLensContentWidget; } + + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/codelens/codelensWidget.ts#L50 export interface CodeLensContentWidget { readonly _domNode: HTMLElement; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/contrib/hover/hover.ts#L31 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/hover/hover.ts#L31 export interface ModesHoverController { - readonly contentWidget: ModesContentHoverWidget + readonly contentWidget: ModesContentHoverWidget; } + + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/hover/modesContentHover.ts#L195 export interface ModesContentHoverWidget { readonly isVisible: boolean; readonly _domNode: HTMLElement; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/controller/cursor.ts#L169 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/controller/cursor.ts#L169 export interface ICursor { trigger(source: string, handlerId: string, payload: any): void; } @@ -160,7 +174,7 @@ declare module monaco.editor { contextKeyService?: monaco.contextKeyService.IContextKeyService; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/editor/common/editor.ts#L63 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/editor/common/editor.ts#L63 export interface IResourceInput { resource: monaco.Uri; options?: IResourceInputOptions; @@ -171,37 +185,37 @@ declare module monaco.editor { * Tells the editor to not receive keyboard focus when the editor is being opened. By default, * the editor will receive keyboard focus on open. */ - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/editor/common/editor.ts#L132 - preserveFocus?: boolean; + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/editor/common/editor.ts#L132 + readonly preserveFocus?: boolean; /** * Will reveal the editor if it is already opened and visible in any of the opened editor groups. */ - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/editor/common/editor.ts#L157 - revealIfVisible?: boolean; + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/editor/common/editor.ts#L157 + readonly revealIfVisible?: boolean; /** * Text editor selection. */ - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/editor/common/editor.ts#L223 - selection?: Partial; + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/editor/common/editor.ts#L223 + readonly selection?: Partial; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/browser/services/codeEditorService.ts#L15 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/services/codeEditorService.ts#L15 export interface ICodeEditorService { getActiveCodeEditor(): monaco.editor.ICodeEditor | undefined; openCodeEditor(input: monaco.editor.IResourceInput, source?: monaco.editor.ICodeEditor, sideBySide?: boolean): Promise; - registerDecorationType(key: string, options: IDecorationRenderOptions, parentTypeKey?: string): void; + registerDecorationType(key: string, options: IDecorationRenderOptions, parentTypeKey?: string, editor?: monaco.editor.ICodeEditor): void; removeDecorationType(key: string): void; resolveDecorationOptions(typeKey: string, writable: boolean): IModelDecorationOptions; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/lifecycle.ts#L209 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/lifecycle.ts#L209 export interface IReference extends monaco.IDisposable { readonly object: T; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/services/resolverService.ts#L14 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/services/resolverService.ts#L14 export interface ITextModelService { /** * Provided a resource URI, it will return a model reference @@ -215,7 +229,7 @@ declare module monaco.editor { registerTextModelContentProvider(scheme: string, provider: ITextModelContentProvider): monaco.IDisposable; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/services/resolverService.ts#L34 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/services/resolverService.ts#L34 export interface ITextModelContentProvider { /** * Given a resource, return the content of the resource as IModel. @@ -223,10 +237,10 @@ declare module monaco.editor { provideTextContent(resource: monaco.Uri): Promise | null; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/services/resolverService.ts#L42 && - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/editor/common/editor.ts#L9 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/services/resolverService.ts#L42 && + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/editor/common/editor.ts#L9 export interface ITextEditorModel { - onDispose: monaco.IEvent; + readonly onDispose: monaco.IEvent; /** * Loads the model. */ @@ -242,7 +256,7 @@ declare module monaco.editor { textEditorModel: monaco.editor.IModel; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/browser/contextmenu.ts#L25 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/browser/contextmenu.ts#L25 export interface IContextMenuDelegate { /** * Returns with an HTML element or the client coordinates as the anchor of the context menu to open. @@ -260,7 +274,7 @@ declare module monaco.editor { onHide(wasCancelled: boolean): void } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/actions.ts#L25 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/actions.ts#L25 export interface IAction extends IDisposable { readonly id: string; label: string; @@ -271,7 +285,7 @@ declare module monaco.editor { run(event?: any): Promise; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/contextview/browser/contextView.ts#L38 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/contextview/browser/contextView.ts#L38 export interface IContextMenuService { /** * Shows the native Monaco context menu in the editor. @@ -279,26 +293,26 @@ declare module monaco.editor { showContextMenu(delegate: IContextMenuDelegate): void; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/editorCommon.ts#L615 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/editorCommon.ts#L623 export interface IDecorationOptions { range: IRange; hoverMessage?: IMarkdownString | IMarkdownString[]; renderOptions?: IDecorationInstanceRenderOptions; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/editorCommon.ts#L599 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/editorCommon.ts#L607 export interface IThemeDecorationInstanceRenderOptions { before?: IContentDecorationRenderOptions; after?: IContentDecorationRenderOptions; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/editorCommon.ts#L607 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/editorCommon.ts#L615 export interface IDecorationInstanceRenderOptions extends IThemeDecorationInstanceRenderOptions { light?: IThemeDecorationInstanceRenderOptions; dark?: IThemeDecorationInstanceRenderOptions; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/editorCommon.ts#L567 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/editorCommon.ts#L575 export interface IContentDecorationRenderOptions { contentText?: string; contentIconPath?: UriComponents; @@ -317,7 +331,7 @@ declare module monaco.editor { height?: string; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/editorCommon.ts#L587 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/editorCommon.ts#L595 export interface IDecorationRenderOptions extends IThemeDecorationRenderOptions { isWholeLine?: boolean; rangeBehavior?: TrackedRangeStickiness; @@ -327,7 +341,7 @@ declare module monaco.editor { dark?: IThemeDecorationRenderOptions; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/editorCommon.ts#L532 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/editorCommon.ts#L540 export interface IThemeDecorationRenderOptions { backgroundColor?: string | ThemeColor; @@ -389,18 +403,18 @@ declare module monaco.editor { declare module monaco.commands { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/commands/common/commands.ts#L55 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/commands/common/commands.ts#L55 export const CommandsRegistry: { getCommands(): Map any }>; }; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/commands/common/commands.ts#L16 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/commands/common/commands.ts#L16 export interface ICommandEvent { commandId: string; args: any[]; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/commands/common/commands.ts#L21 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/commands/common/commands.ts#L21 export interface ICommandService { onWillExecuteCommand: monaco.Event; onDidExecuteCommand: monaco.Event; @@ -411,23 +425,23 @@ declare module monaco.commands { declare module monaco.actions { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/actions/common/actions.ts#L17 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/actions/common/actions.ts#L17 export interface ILocalizedString { value: string; original: string; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/actions/common/actions.ts#L22 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/actions/common/actions.ts#L22 export interface ICommandAction { id: string; - title: string - category?: string; + title: string | ILocalizedString; + category?: string | ILocalizedString; icon?: { dark?: monaco.Uri; light?: monaco.Uri; } | monaco.theme.ThemeIcon; precondition?: monaco.contextkey.ContextKeyExpr; toggled?: monaco.contextkey.ContextKeyExpr; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/actions/common/actions.ts#L35 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/actions/common/actions.ts#L35 export interface IMenuItem { command: ICommandAction; when?: monaco.contextkey.ContextKeyExpr; @@ -436,7 +450,7 @@ declare module monaco.actions { alt?: ICommandAction; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/actions/common/actions.ts#L43 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/actions/common/actions.ts#L43 export interface ISubmenuItem { title: string | ILocalizedString; submenu: number; // enum MenuId @@ -445,30 +459,30 @@ declare module monaco.actions { order?: number; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/actions/common/actions.ts#L133 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/actions/common/actions.ts#L137 export interface IMenuRegistry { /** * Retrieves all the registered menu items for the given menu. - * @param menuId - see https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/actions/common/actions.ts#L67 + * @param menuId - see https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/actions/common/actions.ts#L67 */ - getMenuItems(menuId: 7 /* EditorContext */ | 8 /* EditorContextPeek */ | 23 /* MenubarSelectionMenu */): IMenuItem[]; + getMenuItems(menuId: 7 /* EditorContext */ | 8 /* EditorContextPeek */ | 25 /* MenubarSelectionMenu */): IMenuItem | ISubmenuItem[]; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/actions/common/actions.ts#L51 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/actions/common/actions.ts#L51 export function isIMenuItem(item: IMenuItem | ISubmenuItem): item is IMenuItem; /** * The shared menu registry singleton. */ - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/actions/common/actions.ts#L142 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/actions/common/actions.ts#L146 export const MenuRegistry: IMenuRegistry; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/actions/common/actions.ts#L246 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/actions/common/actions.ts#L250 export class MenuItemAction { } } declare module monaco.platform { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/platform.ts#L206 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/platform.ts#L206 export const enum OperatingSystem { Windows = 1, Macintosh = 2, @@ -479,12 +493,12 @@ declare module monaco.platform { declare module monaco.keybindings { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/keybinding/common/keybindingResolver.ts#L20 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/keybinding/common/keybindingResolver.ts#L20 export class KeybindingResolver { static contextMatchesRules(context: monaco.contextKeyService.IContext, rules: monaco.contextkey.ContextKeyExpr | null | undefined): boolean; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/keyCodes.ts#L443 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/keyCodes.ts#L443 export class SimpleKeybinding { public readonly ctrlKey: boolean; public readonly shiftKey: boolean; @@ -496,22 +510,22 @@ declare module monaco.keybindings { toChord(): ChordKeybinding; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/keyCodes.ts#L503 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/keyCodes.ts#L503 export class ChordKeybinding { readonly parts: SimpleKeybinding[]; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/keyCodes.ts#L540 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/keyCodes.ts#L540 export type Keybinding = ChordKeybinding; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/keybinding/common/keybindingsRegistry.ts#L12 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/keybinding/common/keybindingsRegistry.ts#L12 export interface IKeybindingItem { keybinding: Keybinding; command: string; when?: monaco.contextkey.ContextKeyExpr; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/keybinding/common/keybindingsRegistry.ts#L69 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/keybinding/common/keybindingsRegistry.ts#L69 export interface IKeybindingsRegistry { /** * Returns with all the default, static keybindings. @@ -519,10 +533,10 @@ declare module monaco.keybindings { getDefaultKeybindings(): IKeybindingItem[]; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/keybinding/common/keybindingsRegistry.ts#L76 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/keybinding/common/keybindingsRegistry.ts#L76 export const KeybindingsRegistry: IKeybindingsRegistry; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/keyCodes.ts#L542 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/keyCodes.ts#L542 export class ResolvedKeybindingPart { readonly ctrlKey: boolean; readonly shiftKey: boolean; @@ -535,7 +549,7 @@ declare module monaco.keybindings { constructor(ctrlKey: boolean, shiftKey: boolean, altKey: boolean, metaKey: boolean, kbLabel: string | null, kbAriaLabel: string | null); } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/keyCodes.ts#L564 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/keyCodes.ts#L564 export abstract class ResolvedKeybinding { public abstract getLabel(): string | null; public abstract getAriaLabel(): string | null; @@ -547,12 +561,12 @@ declare module monaco.keybindings { public abstract getDispatchParts(): (string | null)[]; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/keybinding/common/usLayoutResolvedKeybinding.ts#L13 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/keybinding/common/usLayoutResolvedKeybinding.ts#L13 export class USLayoutResolvedKeybinding { public static getDispatchStr(keybinding: SimpleKeybinding): string | null; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/keybindingLabels.ts#L17 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/keybindingLabels.ts#L17 export interface Modifiers { readonly ctrlKey: boolean; readonly shiftKey: boolean; @@ -560,90 +574,120 @@ declare module monaco.keybindings { readonly metaKey: boolean; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/keybindingLabels.ts#L24 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/keybindingLabels.ts#L24 export interface KeyLabelProvider { (keybinding: T): string | null; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/keybindingLabels.ts#L28 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/keybindingLabels.ts#L28 export interface ModifierLabelProvider { toLabel(OS: monaco.platform.OperatingSystem, parts: T[], keyLabelProvider: KeyLabelProvider): string | null; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/keybindingLabels.ts#L61 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/keybindingLabels.ts#L61 export const UILabelProvider: ModifierLabelProvider; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/keybindingLabels.ts#L88 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/keybindingLabels.ts#L88 export const AriaLabelProvider: ModifierLabelProvider; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/keybindingLabels.ts#L116 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/keybindingLabels.ts#L116 export const ElectronAcceleratorLabelProvider: ModifierLabelProvider; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/keybindingLabels.ts#L136 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/keybindingLabels.ts#L136 export const UserSettingsLabelProvider: ModifierLabelProvider; } declare module monaco.services { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/browser/standaloneLanguages.ts#L101 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/browser/standaloneLanguages.ts#L101 export class TokenizationSupport2Adapter implements monaco.modes.ITokenizationSupport { constructor(standaloneThemeService: IStandaloneThemeService, languageIdentifier: LanguageIdentifier, actual: monaco.languages.TokensProvider) tokenize(line: string, state: monaco.languages.IState, offsetDelta: number): any; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/services/resolverService.ts#L12 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/services/resolverService.ts#L12 export const ITextModelService: any; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/browser/services/codeEditorService.ts#L13 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/opener/common/opener.ts#L13 export interface OpenInternalOptions { readonly openToSide?: boolean; } + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/opener/common/opener.ts#L28 export interface OpenExternalOptions { readonly openExternal?: boolean } + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/opener/common/opener.ts#L38 export interface IOpener { open(resource: monaco.Uri | string, options?: OpenInternalOptions | OpenExternalOptions): Promise; } - // https://github.com/TypeFox/vscode/blob/70b8db24a37fafc77247de7f7cb5bb0195120ed0/src/vs/editor/browser/services/openerService.ts#L18 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/services/openerService.ts#L89 export class OpenerService { constructor(editorService: monaco.editor.ICodeEditorService, commandService: monaco.commands.ICommandService); registerOpener(opener: IOpener): monaco.IDisposable; - open(resource: monaco.Uri, options?: { openToSide?: boolean }): Promise; + open(resource: monaco.Uri | string, options?: OpenInternalOptions & OpenExternalOptions): Promise; } + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/services/codeEditorService.ts#L13 export const ICodeEditorService: any; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/configuration/common/configuration.ts#L16 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/configuration/common/configuration.ts#L16 export const IConfigurationService: any; + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/configuration/common/configurationModels.ts#L337 export interface Configuration { - getValue(section: string, overrides: any, workspace: any): any; + getValue(section: string | undefined, overrides: any, workspace: any | undefined): any; + toData(): any; } - export class ConfigurationChangeEvent { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/configuration/common/configuration.ts#L30-L37 - _source?: number; + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/configuration/common/configuration.ts#L30-L37 + export const enum ConfigurationTarget { + USER = 1, + USER_LOCAL, + USER_REMOTE, + WORKSPACE, + WORKSPACE_FOLDER, + DEFAULT, + MEMORY + } + + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/configuration/common/configuration.ts#L51 + export interface IConfigurationChange { + keys: string[]; + overrides: [string, string[]][]; + } + + // https://github.com/theia-ide/vscode/blob/b0b47123a5da83d42c2675f2bfff5bb9f1b2673c/src/vs/platform/configuration/common/configuration.ts#L56 + export class IConfigurationChangeEvent { + + readonly source: ConfigurationTarget; + readonly affectedKeys: string[]; + readonly change: IConfigurationChange; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/configuration/common/configurationModels.ts#L620 - change(keys: string[]): ConfigurationChangeEvent; + affectsConfiguration(configuration: string, overrides?: IConfigurationOverrides): boolean; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/configuration/common/configuration.ts#L65 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/configuration/common/configuration.ts#L25 + export interface IConfigurationOverrides { + overrideIdentifier?: string | null; + resource?: monaco.Uri | null; + } + + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/browser/simpleServices.ts#L434 export interface IConfigurationService { - _onDidChangeConfiguration: monaco.Emitter; + _onDidChangeConfiguration: monaco.Emitter; _configuration: Configuration; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/services/resourceConfiguration.ts#L39 + // https://github.com/microsoft/vscode/blob/standalone/0.20.x/src/vs/editor/common/services/textResourceConfigurationService.ts#L71 export interface ITextResourcePropertiesService { getEOL(resource: monaco.Uri | undefined, language?: string): string; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/browser/services/codeEditorServiceImpl.ts#L17 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/services/codeEditorServiceImpl.ts#L58 export abstract class CodeEditorServiceImpl implements monaco.editor.ICodeEditorService { constructor(themeService: IStandaloneThemeService); abstract getActiveCodeEditor(): monaco.editor.ICodeEditor | undefined; @@ -659,7 +703,7 @@ declare module monaco.services { getFocusedCodeEditor(): monaco.editor.ICodeEditor | undefined; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/browser/simpleServices.ts#L245 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/browser/simpleServices.ts#L249 export class StandaloneCommandService implements monaco.commands.ICommandService { constructor(instantiationService: monaco.instantiation.IInstantiationService); private readonly _onWillExecuteCommand: monaco.Emitter; @@ -669,57 +713,57 @@ declare module monaco.services { executeCommand(commandId: string, ...args: any[]): Promise; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/browser/standaloneServices.ts#L60 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/browser/standaloneServices.ts#L60 export class LazyStaticService { get(overrides?: monaco.editor.IEditorOverrideServices): T; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/common/standaloneThemeService.ts#L28 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/common/standaloneThemeService.ts#L28 export interface IStandaloneThemeService extends monaco.theme.IThemeService { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts#L170 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts#L178 readonly _knownThemes: Map; getTheme(): IStandaloneTheme; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/common/standaloneThemeService.ts#L23 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/common/standaloneThemeService.ts#L23 export interface IStandaloneTheme { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts#L30 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts#L31 themeData: monaco.editor.IStandaloneThemeData tokenTheme: TokenTheme; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/themeService.ts#L91 - getColor(color: string): monaco.color.Color | undefined; + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/themeService.ts#L98 + getColor(color: string, useDefault?: boolean): monaco.color.Color | undefined; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes/supports/tokenization.ts#L188 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes/supports/tokenization.ts#L188 export interface TokenTheme { match(languageId: LanguageId, scope: string): number; getColorMap(): monaco.color.Color[]; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes.ts#L27 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes.ts#L27 export const enum LanguageId { Null = 0, PlainText = 1 } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes.ts#L35 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes.ts#L35 export class LanguageIdentifier { public readonly id: LanguageId; readonly language: string; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes.ts#L58 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes.ts#L58 export interface IMode { getId(): string; getLanguageIdentifier(): LanguageIdentifier; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/services/modeService.ts#L30 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/services/modeService.ts#L30 export interface IModeService { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/services/modeServiceImpl.ts#L46 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/services/modeServiceImpl.ts#L46 private readonly _instantiatedModes: { [modeId: string]: IMode; }; private readonly _onLanguagesMaybeChanged: Emitter; readonly onDidCreateMode: monaco.IEvent; @@ -727,17 +771,17 @@ declare module monaco.services { getLanguageIdentifier(modeId: string | LanguageId): LanguageIdentifier | null; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/services/modeService.ts#L25 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/services/modeService.ts#L25 export interface ILanguageSelection { readonly languageIdentifier: LanguageIdentifier; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/instantiation/common/serviceCollection.ts#L9 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/instantiation/common/serviceCollection.ts#L9 export interface ServiceCollection { set(id: any, instanceOrDescriptor: T): T; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/markers/common/markers.ts#L12 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/markers/common/markers.ts#L12 export interface IMarkerService { read(filter?: { owner?: string; resource?: monaco.Uri; severities?: number, take?: number; }): editor.IMarker[]; } @@ -748,12 +792,12 @@ declare module monaco.services { updateModel(model: monaco.editor.ITextModel, value: string | monaco.editor.ITextBufferFactory): void; } - // https://github.com/microsoft/vscode/blob/2277c8e2a3e1cc630a6397301ba54a1dccd8a60d/src/vs/editor/common/services/editorWorkerService.ts#L21 + // https://github.com/microsoft/vscode/blob/standalone/0.20.x/src/vs/editor/common/services/editorWorkerService.ts#L21 export interface IEditorWorkerService { computeMoreMinimalEdits(resource: monaco.Uri, edits: monaco.languages.TextEdit[] | null | undefined): Promise; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/browser/standaloneServices.ts#L56 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/browser/standaloneServices.ts#L56 export module StaticServices { export function init(overrides: monaco.editor.IEditorOverrideServices): [ServiceCollection, monaco.instantiation.IInstantiationService]; export const standaloneThemeService: LazyStaticService; @@ -769,19 +813,21 @@ declare module monaco.services { } declare module monaco.theme { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/themeService.ts#L82 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/themeService.ts#L89 export interface ITheme { } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/themeService.ts#L124 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/themeService.ts#L131 export interface IThemeService { readonly onThemeChange: monaco.IEvent; } + + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/styler.ts#L10 export interface IThemable { } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/styler.ts#L166 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/styler.ts#L166 export function attachQuickOpenStyler(widget: IThemable, themeService: IThemeService): monaco.IDisposable; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/themeService.ts#L25 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/themeService.ts#L25 export interface ThemeIcon { readonly id: string; } @@ -793,7 +839,7 @@ declare module monaco.theme { declare module monaco.color { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/color.ts#L13 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/color.ts#L13 export class RGBA { readonly r: number; readonly g: number; @@ -803,7 +849,7 @@ declare module monaco.color { constructor(r: number, g: number, b: number, a?: number); } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/color.ts#L48 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/color.ts#L48 export class HSLA { readonly h: number; readonly s: number; @@ -813,84 +859,89 @@ declare module monaco.color { constructor(h: number, s: number, l: number, a: number); } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/color.ts#L256 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/color.ts#L256 export class Color { readonly rgba: RGBA; constructor(arg: RGBA | HSLA); } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/colorRegistry.ts#L20 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/colorRegistry.ts#L20 export interface ColorContribution { readonly id: string; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/colorRegistry.ts#L29 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/colorRegistry.ts#L29 export type ColorFunction = (theme: monaco.theme.ITheme) => Color | undefined; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/colorRegistry.ts#L42 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/colorRegistry.ts#L42 export type ColorValue = string | Color | ColorFunction; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/colorRegistry.ts#L33 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/colorRegistry.ts#L33 export interface ColorDefaults { light?: ColorValue; dark?: ColorValue; hc?: ColorValue; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/colorRegistry.ts#L49 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/colorRegistry.ts#L49 export interface IColorRegistry { getColors(): ColorContribution[]; registerColor(id: string, defaults: ColorDefaults | undefined, description: string): string; deregisterColor(id: string): void; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/colorRegistry.ts#L173 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/colorRegistry.ts#L173 export function getColorRegistry(): IColorRegistry; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/colorRegistry.ts#L434 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/colorRegistry.ts#L434 export function darken(colorValue: ColorValue, factor: number): ColorFunction; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/colorRegistry.ts#L444 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/colorRegistry.ts#L444 export function lighten(colorValue: ColorValue, factor: number): ColorFunction; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/theme/common/colorRegistry.ts#L454 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/theme/common/colorRegistry.ts#L454 export function transparent(colorValue: ColorValue, factor: number): ColorFunction; } declare module monaco.referenceSearch { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes.ts#L749 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes.ts#L784 export interface Location { uri: Uri, range: IRange } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/contrib/gotoSymbol/referencesModel.ts#L20 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/gotoSymbol/referencesModel.ts#L20 export interface OneReference { } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/contrib/gotoSymbol/referencesModel.ts#L148 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/gotoSymbol/referencesModel.ts#L148 export interface ReferencesModel implements IDisposable { - references: OneReference[] + readonly references: OneReference[] } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts#L187 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts#L187 export interface ReferenceWidget { show(range: IRange): void; hide(): void; - focus(): void; + focusOnReferenceTree(): void; + focusOnPreviewEditor(): void; + isPreviewEditorFocused(): boolean; _tree: ReferenceTree } + + // it's used as return value for referenceWidget._tree + // see https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts#L198 export interface ReferenceTree { getFocus(): ReferenceTreeElement[] } export interface ReferenceTreeElement { } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts#L30 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts#L32 export interface ReferencesController extends IDisposable { static readonly ID: string; _widget?: ReferenceWidget; _model?: ReferencesModel; _ignoreModelChangeEvent: boolean; _editorService: monaco.editor.ICodeEditorService; - closeWidget(): void; + closeWidget(focusEditor?: boolean): void; _gotoReference(ref: Location): Promise; toggleWidget(range: IRange, modelPromise: Promise & { cancel: () => void }, peekMode: boolean): void; } @@ -898,14 +949,14 @@ declare module monaco.referenceSearch { declare module monaco.quickOpen { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/browser/ui/inputbox/inputBox.ts#L59 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/browser/ui/inputbox/inputBox.ts#L59 export interface IMessage { content: string; formatContent?: boolean; // defaults to false type?: 1 /* INFO */ | 2 /* WARNING */ | 3 /* ERROR */; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/browser/ui/inputbox/inputBox.ts#L91 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/browser/ui/inputbox/inputBox.ts#L91 export class InputBox { inputElement: HTMLInputElement; setPlaceHolder(placeHolder: string): void; @@ -913,12 +964,13 @@ declare module monaco.quickOpen { hideMessage(): void; } + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/tree/browser/tree.ts#L17 export interface QuickOpenTree { onDidChangeFocus: monaco.Event; getFocus(): monaco.quickOpen.QuickOpenEntry; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts#L96 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts#L96 export class QuickOpenWidget implements IDisposable { inputBox?: InputBox; tree: QuickOpenTree; @@ -933,14 +985,14 @@ declare module monaco.quickOpen { hide(reason?: HideReason): void; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts#L79 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts#L79 export enum HideReason { ELEMENT_SELECTED, FOCUS_LOST, CANCELED } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts#L28 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts#L28 export interface IQuickOpenCallbacks { onOk: () => void; onCancel: () => void; @@ -950,7 +1002,7 @@ declare module monaco.quickOpen { onFocusLost?: () => boolean /* veto close */; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts#L37 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts#L37 export interface IQuickOpenOptions /* extends IQuickOpenStyles */ { minItemsToShow?: number; maxItemsToShow?: number; @@ -960,7 +1012,7 @@ declare module monaco.quickOpen { keyboardSupport?: boolean; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts#L57 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts#L57 export interface IShowOptions { quickNavigateConfiguration?: IQuickNavigateConfiguration; autoFocus?: IAutoFocus; @@ -968,12 +1020,12 @@ declare module monaco.quickOpen { value?: string; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L8 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L8 export interface IQuickNavigateConfiguration { keybindings: monaco.keybindings.ResolvedKeybinding[]; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L12 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L12 export interface IAutoFocus { /** @@ -1005,23 +1057,23 @@ declare module monaco.quickOpen { autoFocusPrefixMatch?: string; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L43-L47 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L43-L47 export type Mode = 0 /* PREVIEW */ | 1 /* OPEN */ | 2 /* OPEN_IN_BACKGROUND */; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L49 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L49 export interface IEntryRunContext { event: any; keymods: IKeyMods; quickNavigateConfiguration: IQuickNavigateConfiguration | undefined; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L55 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L55 export interface IKeyMods { ctrlCmd: boolean; alt: boolean; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L60 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L60 export interface IDataSource { getId(entry: T): string; getLabel(entry: T): string | null; @@ -1029,7 +1081,7 @@ declare module monaco.quickOpen { /** * See vs/base/parts/tree/browser/tree.ts - IRenderer */ - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L68 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L68 export interface IRenderer { getHeight(entry: T): number; getTemplateId(entry: T): string; @@ -1038,21 +1090,21 @@ declare module monaco.quickOpen { disposeTemplate(templateId: string, templateData: any): void; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L78 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L76 export interface IFilter { isVisible(entry: T): boolean; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L82 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L80 export interface IAccessiblityProvider { getAriaLabel(entry: T): string; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L86 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L84 export interface IRunner { run(entry: T, mode: Mode, context: IEntryRunContext): boolean; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L90 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/common/quickOpen.ts#L88 export interface IModel { entries: T[]; dataSource: IDataSource; @@ -1062,13 +1114,13 @@ declare module monaco.quickOpen { accessibilityProvider?: IAccessiblityProvider; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/browser/quickOpenModel.ts#L29 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/browser/quickOpenModel.ts#L29 export interface IHighlight { start: number; end: number; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/browser/ui/iconLabel/iconLabel.ts#L20 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/browser/ui/iconLabel/iconLabel.ts#L20 export interface IIconLabelValueOptions { title?: string; descriptionTitle?: string; @@ -1082,7 +1134,7 @@ declare module monaco.quickOpen { readonly domId?: string; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/browser/quickOpenModel.ts#L55 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/browser/quickOpenModel.ts#L55 export class QuickOpenEntry { constructor(highlights?: IHighlight[]); getLabel(): string | undefined; @@ -1100,27 +1152,33 @@ declare module monaco.quickOpen { run(mode: Mode, context: IEntryRunContext): boolean; } + // todo https://github.com/eclipse-theia/theia/issues/7899 export function compareEntries(elementA: QuickOpenEntry, elementB: QuickOpenEntry, lookFor: string): number; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/browser/quickOpenModel.ts#L197 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/browser/quickOpenModel.ts#L197 export class QuickOpenEntryGroup extends QuickOpenEntry { constructor(entry?: QuickOpenEntry, groupLabel?: string, withBorder?: boolean); getGroupLabel(): string | undefined; - setGroupLabel(groupLabel: string): void; + setGroupLabel(groupLabel: string | undefined): void; showBorder(): boolean; setShowBorder(showBorder: boolean): void; getEntry(): QuickOpenEntry | undefined; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/tree/browser/tree.ts#L571 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/tree/browser/tree.ts#L571 export interface IActionProvider { hasActions(element: any, item: any): boolean; getActions(element: any, item: any): ReadonlyArray | null; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/parts/quickopen/browser/quickOpenModel.ts#L489 - export class QuickOpenModel implements IModel, IDataSource, IFilter, IRunner, + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/parts/quickopen/browser/quickOpenModel.ts#L489 + export class QuickOpenModel implements + IModel, + IDataSource, + IFilter, + IRunner, IAccessiblityProvider { + constructor(entries?: QuickOpenEntry[], actionProvider?: IActionProvider); addEntries(entries: QuickOpenEntry[]): void; entries: QuickOpenEntry[]; @@ -1135,61 +1193,63 @@ declare module monaco.quickOpen { run(entry: QuickOpenEntry, mode: Mode, context: IEntryRunContext): boolean; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts#L19 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts#L19 export interface IQuickOpenControllerOpts { readonly inputAriaLabel: string; getModel(lookFor: string): QuickOpenModel; getAutoFocus(lookFor: string): IAutoFocus; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts#L25 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts#L25 export interface QuickOpenController extends IDisposable { static readonly ID: string; dispose(): void; run(opts: IQuickOpenControllerOpts): void; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts#L169 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts#L169 clearDecorations(): void; } } declare module monaco.filters { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/filters.ts#L15 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/filters.ts#L15 export interface IMatch { start: number; end: number; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/filters.ts#L337 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/filters.ts#L337 export function matchesFuzzy(word: string, wordToMatchAgainst: string, enableSeparateSubstringMatching?: boolean): IMatch[] | undefined; } declare module monaco.editorExtensions { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/browser/editorExtensions.ts#L141 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/editorExtensions.ts#L141 export abstract class EditorCommand { } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/browser/editorExtensions.ts#L205 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/editorExtensions.ts#L205 export abstract class EditorAction extends EditorCommand { id: string; label: string; } export module EditorExtensionsRegistry { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/browser/editorExtensions.ts#L341 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/editorExtensions.ts#L395 export function getEditorActions(): EditorAction[]; + + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/browser/editorExtensions.ts#L391 export function getEditorCommand(commandId: string): EditorCommand | undefined; } } declare module monaco.modes { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes.ts#L201 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes.ts#L209 export interface ITokenizationSupport { tokenize(line: string, state: monaco.languages.IState, offsetDelta: number): any; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes.ts#L1613 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes.ts#L1692 export interface TokenizationRegistry { get(language: string): ITokenizationSupport | null; getColorMap(): monaco.color.Color[] | null; @@ -1197,7 +1257,7 @@ declare module monaco.modes { } export const TokenizationRegistry: TokenizationRegistry; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes.ts#L140 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes.ts#L148 export class TokenMetadata { public static getLanguageId(metadata: number): number; @@ -1213,13 +1273,13 @@ declare module monaco.modes { public static getInlineStyleFromMetadata(metadata: number, colorMap: string[]): string; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/glob.ts#L18 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/glob.ts#L18 export interface IRelativePattern { base: string; pattern: string; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes/languageSelector.ts#L9 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes/languageSelector.ts#L9 export interface LanguageFilter { language?: string; scheme?: string; @@ -1231,10 +1291,10 @@ declare module monaco.modes { exclusive?: boolean; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes/languageSelector.ts#L20 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes/languageSelector.ts#L20 export type LanguageSelector = string | LanguageFilter | Array; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes/languageFeatureRegistry.ts#L29 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes/languageFeatureRegistry.ts#L29 export interface LanguageFeatureRegistry { has(model: monaco.editor.ITextModel): boolean; all(model: monaco.editor.ITextModel): T[]; @@ -1242,42 +1302,46 @@ declare module monaco.modes { readonly onDidChange: monaco.IEvent; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes.ts#L1525 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes.ts#L1599 export const DocumentSymbolProviderRegistry: LanguageFeatureRegistry; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes.ts#L1510 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes.ts#L1584 export const CompletionProviderRegistry: LanguageFeatureRegistry; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes.ts#L1560 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/modes.ts#L1634 export const CodeActionProviderRegistry: LanguageFeatureRegistry; } declare module monaco.suggest { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/contrib/suggest/suggest.ts#L106 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/suggest/suggest.ts#L115 export const enum SnippetSortOrder { Top, Inline, Bottom } - // https://github.com/theia-ide/vscode/blob/d24b5f70c69b3e75cd10c6b5247a071265ccdd38/src/vs/editor/contrib/suggest/suggestController.ts#L97 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/suggest/suggestController.ts#L97 export interface SuggestController { readonly widget: { getValue(): SuggestWidget } } + + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/suggest/suggestWidget.ts#L462 export interface SuggestWidget { getFocusedItem(): ISelectedSuggestion | undefined; } + + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/suggest/suggestWidget.ts#L456 export interface ISelectedSuggestion { item: CompletionItem; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/contrib/suggest/suggest.ts#L28 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/suggest/suggest.ts#L28 export interface CompletionItem { completion: monaco.languages.CompletionItem; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/contrib/suggest/suggest.ts#L110 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/suggest/suggest.ts#L119 export class CompletionOptions { constructor( @@ -1288,7 +1352,7 @@ declare module monaco.suggest { } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/contrib/suggest/suggest.ts#L133 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/suggest/suggest.ts#L142 export function provideSuggestionItems( model: monaco.editor.ITextModel, position: Position, @@ -1297,13 +1361,12 @@ declare module monaco.suggest { token?: monaco.CancellationToken ): Promise; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/contrib/suggest/suggest.ts#L127 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/suggest/suggest.ts#L136 export function setSnippetSuggestSupport(support: monaco.languages.CompletionItemProvider): monaco.languages.CompletionItemProvider; - } declare module monaco.snippetParser { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/contrib/snippet/snippetParser.ts#L583 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/contrib/snippet/snippetParser.ts#L583 export class SnippetParser { parse(value: string): TextmateSnippet; } @@ -1313,16 +1376,16 @@ declare module monaco.snippetParser { declare module monaco.contextKeyService { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/contextkey/common/contextkey.ts#L805 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/contextkey/common/contextkey.ts#L803 export interface IContextKey { set(value: T): void; reset(): void; get(): T | undefined; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/contextkey/common/contextkey.ts#L829 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/contextkey/common/contextkey.ts#L827 export interface IContextKeyService { - // vs code has another object as argument https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/contextkey/common/contextkey.ts#L811 + // vs code has another object as argument https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/contextkey/common/contextkey.ts#L809 // which contains restcicted number of HTMLElement methods createScoped(target?: HTMLElement): IContextKeyService; getContext(target?: HTMLElement): IContext; @@ -1331,17 +1394,17 @@ declare module monaco.contextKeyService { onDidChangeContext: monaco.IEvent; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/contextkey/common/contextkey.ts#L801 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/contextkey/common/contextkey.ts#L799 export interface IContext { getValue(key: string): T | undefined; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/contextkey/common/contextkey.ts#L825 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/contextkey/common/contextkey.ts#L823 export interface IContextKeyChangeEvent { affectsSome(keys: Set): boolean; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/contextkey/browser/contextKeyService.ts#L321 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/contextkey/browser/contextKeyService.ts#L321 export class ContextKeyService implements IContextKeyService { constructor(configurationService: monaco.services.IConfigurationService); createScoped(target?: HTMLElement): IContextKeyService; @@ -1354,10 +1417,10 @@ declare module monaco.contextKeyService { declare module monaco.contextkey { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/contextkey/common/contextkey.ts#L819 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/contextkey/common/contextkey.ts#L817 export const IContextKeyService: any; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/platform/contextkey/common/contextkey.ts#L29 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/contextkey/common/contextkey.ts#L29 export class ContextKeyExpr { keys(): string[]; static deserialize(when: string): ContextKeyExpr; @@ -1367,7 +1430,7 @@ declare module monaco.contextkey { declare module monaco.mime { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/mime.ts#L18 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/mime.ts#L18 export interface ITextMimeAssociation { readonly id: string; readonly mime: string; @@ -1378,15 +1441,15 @@ declare module monaco.mime { readonly userConfigured?: boolean; } - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/mime.ts#L42 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/mime.ts#L42 export function registerTextMime(association: monaco.mime.ITextMimeAssociation, warnOnOverwrite: boolean): void; - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/mime.ts#L98 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/mime.ts#L98 export function clearTextMimes(onlyUserConfigured?: boolean): void; } declare module monaco.error { - // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/errors.ts#L77 + // https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/base/common/errors.ts#L77 export function onUnexpectedError(e: any): undefined; } @@ -1403,7 +1466,7 @@ declare module monaco.wordHelper { /** * overloading languages register functions to accept LanguageSelector, * check that all register functions passing a selector to registries: - * https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/browser/standaloneLanguages.ts#L338-L495 + * https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/standalone/browser/standaloneLanguages.ts#L338-L511 */ declare module monaco.languages { export function registerReferenceProvider(selector: monaco.modes.LanguageSelector, provider: ReferenceProvider): IDisposable; @@ -1426,4 +1489,6 @@ declare module monaco.languages { export function registerFoldingRangeProvider(selector: monaco.modes.LanguageSelector, provider: FoldingRangeProvider): IDisposable; export function registerDeclarationProvider(selector: monaco.modes.LanguageSelector, provider: DeclarationProvider): IDisposable; export function registerSelectionRangeProvider(selector: monaco.modes.LanguageSelector, provider: SelectionRangeProvider): IDisposable; + export function registerDocumentSemanticTokensProvider(selector: monaco.modes.LanguageSelector, provider: DocumentSemanticTokensProvider): IDisposable; + export function registerDocumentRangeSemanticTokensProvider(selector: monaco.modes.LanguageSelector, provider: DocumentRangeSemanticTokensProvider): IDisposable; } diff --git a/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts b/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts index 57ed1b954f5c0..75927e485fa28 100755 --- a/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts +++ b/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts @@ -392,13 +392,8 @@ export class PluginVscodeCommandsContribution implements CommandContribution { id: 'vscode.executeDefinitionProvider' }, { - execute: ((resource: URI, position: Position) => { - const args = { - resource: monaco.Uri.from(resource), - position: position - }; - return commands.executeCommand('_executeDefinitionProvider', args); - }) + execute: ((resource: URI, position: Position) => + commands.executeCommand('_executeDefinitionProvider', monaco.Uri.from(resource), position)) } ); commands.registerCommand( @@ -406,13 +401,8 @@ export class PluginVscodeCommandsContribution implements CommandContribution { id: 'vscode.executeDeclarationProvider' }, { - execute: ((resource: URI, position: Position) => { - const args = { - resource: monaco.Uri.from(resource), - position: position - }; - return commands.executeCommand('_executeDeclarationProvider', args); - }) + execute: ((resource: URI, position: Position) => + commands.executeCommand('_executeDeclarationProvider', monaco.Uri.from(resource), position)) } ); commands.registerCommand( @@ -420,13 +410,8 @@ export class PluginVscodeCommandsContribution implements CommandContribution { id: 'vscode.executeTypeDefinitionProvider' }, { - execute: ((resource: URI, position: Position) => { - const args = { - resource: monaco.Uri.from(resource), - position: position - }; - return commands.executeCommand('_executeTypeDefinitionProvider', args); - }) + execute: ((resource: URI, position: Position) => + commands.executeCommand('_executeTypeDefinitionProvider', monaco.Uri.from(resource), position)) } ); commands.registerCommand( @@ -434,13 +419,8 @@ export class PluginVscodeCommandsContribution implements CommandContribution { id: 'vscode.executeImplementationProvider' }, { - execute: ((resource: URI, position: Position) => { - const args = { - resource: monaco.Uri.from(resource), - position: position - }; - return commands.executeCommand('_executeImplementationProvider', args); - }) + execute: ((resource: URI, position: Position) => + commands.executeCommand('_executeImplementationProvider', monaco.Uri.from(resource), position)) } ); commands.registerCommand( @@ -448,13 +428,8 @@ export class PluginVscodeCommandsContribution implements CommandContribution { id: 'vscode.executeHoverProvider' }, { - execute: ((resource: URI, position: Position) => { - const args = { - resource: monaco.Uri.from(resource), - position: position - }; - return commands.executeCommand('_executeHoverProvider', args); - }) + execute: ((resource: URI, position: Position) => + commands.executeCommand('_executeHoverProvider', monaco.Uri.from(resource), position)) } ); commands.registerCommand( @@ -462,13 +437,8 @@ export class PluginVscodeCommandsContribution implements CommandContribution { id: 'vscode.executeDocumentHighlights' }, { - execute: ((resource: URI, position: Position) => { - const args = { - resource: monaco.Uri.from(resource), - position: position - }; - return commands.executeCommand('_executeDocumentHighlights', args); - }) + execute: ((resource: URI, position: Position) => + commands.executeCommand('_executeDocumentHighlights', monaco.Uri.from(resource), position)) } ); commands.registerCommand( @@ -476,13 +446,7 @@ export class PluginVscodeCommandsContribution implements CommandContribution { id: 'vscode.executeReferenceProvider' }, { - execute: ((resource: URI, position: Position) => { - const args = { - resource: monaco.Uri.from(resource), - position: position - }; - return commands.executeCommand('_executeReferenceProvider', args); - }) + execute: ((resource: URI, position: Position) => commands.executeCommand('_executeReferenceProvider', monaco.Uri.from(resource), position)) } ); commands.registerCommand( @@ -491,7 +455,7 @@ export class PluginVscodeCommandsContribution implements CommandContribution { }, { execute: (resource: URI) => commands.executeCommand('_executeDocumentSymbolProvider', - { resource: monaco.Uri.parse(resource.toString()) } + monaco.Uri.parse(resource.toString()) ).then((value: any) => { // eslint-disable-line @typescript-eslint/no-explicit-any if (!Array.isArray(value) || value === undefined) { return undefined; @@ -505,13 +469,8 @@ export class PluginVscodeCommandsContribution implements CommandContribution { id: 'vscode.executeFormatDocumentProvider' }, { - execute: ((resource: URI, options: FormattingOptions) => { - const args = { - resource: monaco.Uri.from(resource), - options: options - }; - return commands.executeCommand('_executeFormatDocumentProvider', args); - }) + execute: ((resource: URI, options: FormattingOptions) => + commands.executeCommand('_executeFormatDocumentProvider', monaco.Uri.from(resource), options)) } ); commands.registerCommand( @@ -519,14 +478,8 @@ export class PluginVscodeCommandsContribution implements CommandContribution { id: 'vscode.executeFormatRangeProvider' }, { - execute: ((resource: URI, range: Range, options: FormattingOptions) => { - const args = { - resource: monaco.Uri.from(resource), - range: range, - options: options - }; - return commands.executeCommand('_executeFormatRangeProvider', args); - }) + execute: ((resource: URI, range: Range, options: FormattingOptions) => + commands.executeCommand('_executeFormatRangeProvider', monaco.Uri.from(resource), range, options)) } ); commands.registerCommand( @@ -534,15 +487,8 @@ export class PluginVscodeCommandsContribution implements CommandContribution { id: 'vscode.executeFormatOnTypeProvider' }, { - execute: ((resource: URI, position: Position, ch: string, options: FormattingOptions) => { - const args = { - resource: monaco.Uri.from(resource), - position: position, - ch: ch, - options: options - }; - return commands.executeCommand('_executeFormatOnTypeProvider', args); - }) + execute: ((resource: URI, position: Position, ch: string, options: FormattingOptions) => + commands.executeCommand('_executeFormatOnTypeProvider', monaco.Uri.from(resource), position, ch, options)) } ); commands.registerCommand( @@ -550,13 +496,8 @@ export class PluginVscodeCommandsContribution implements CommandContribution { id: 'vscode.prepareCallHierarchy' }, { - execute: ((resource: URI, position: Position) => { - const args = { - resource: monaco.Uri.from(resource), - position: position - }; - return commands.executeCommand('_executePrepareCallHierarchy', args); - }) + execute: ((resource: URI, position: Position) => + commands.executeCommand('_executePrepareCallHierarchy', monaco.Uri.from(resource), position)) } ); commands.registerCommand( diff --git a/packages/plugin-ext/package.json b/packages/plugin-ext/package.json index 2a6ceb39f7e86..1741fba541104 100644 --- a/packages/plugin-ext/package.json +++ b/packages/plugin-ext/package.json @@ -30,7 +30,7 @@ "decompress": "^4.2.1", "escape-html": "^1.0.3", "filenamify": "^4.1.0", - "jsonc-parser": "^2.0.2", + "jsonc-parser": "^2.2.0", "lodash.clonedeep": "^4.5.0", "macaddress": "^0.2.9", "mime": "^2.4.4", diff --git a/packages/plugin-ext/src/common/plugin-api-rpc-model.ts b/packages/plugin-ext/src/common/plugin-api-rpc-model.ts index edcc42e3653e5..a3ae9663f6f03 100644 --- a/packages/plugin-ext/src/common/plugin-api-rpc-model.ts +++ b/packages/plugin-ext/src/common/plugin-api-rpc-model.ts @@ -346,21 +346,20 @@ export interface CodeActionProvider { providedCodeActionKinds?: string[]; } -export interface ResourceFileEdit { - oldUri: UriComponents; - newUri: UriComponents; - options: { overwrite?: boolean, ignoreIfNotExists?: boolean, ignoreIfExists?: boolean, recursive?: boolean }; +export interface WorkspaceFileEdit { + oldUri?: UriComponents; + newUri?: UriComponents; + options?: { overwrite?: boolean, ignoreIfNotExists?: boolean, ignoreIfExists?: boolean, recursive?: boolean }; } -export interface ResourceTextEdit { +export interface WorkspaceTextEdit { resource: UriComponents; modelVersionId?: number; - edits: TextEdit[]; + edit: TextEdit; } export interface WorkspaceEdit { - edits: Array; - rejectReason?: string; + edits: Array; } export enum SymbolKind { diff --git a/packages/plugin-ext/src/common/plugin-api-rpc.ts b/packages/plugin-ext/src/common/plugin-api-rpc.ts index 9c562ce27fc35..ba309dd400fc7 100644 --- a/packages/plugin-ext/src/common/plugin-api-rpc.ts +++ b/packages/plugin-ext/src/common/plugin-api-rpc.ts @@ -1127,28 +1127,33 @@ export interface CodeActionDto { diagnostics?: MarkerData[]; command?: Command; kind?: string; + isPreferred?: boolean; + disabled?: string; } -export interface ResourceFileEditDto { - oldUri: UriComponents; - newUri: UriComponents; - options: FileOperationOptions; +export interface WorkspaceFileEditDto { + oldUri?: UriComponents; + newUri?: UriComponents; + options?: FileOperationOptions; } -export interface ResourceTextEditDto { +export interface WorkspaceTextEditDto { resource: UriComponents; modelVersionId?: number; - edits: TextEdit[]; -} -export namespace ResourceTextEditDto { - export function is(arg: Object): arg is ResourceTextEditDto { - return !!arg && typeof arg === 'object' && 'resource' in arg && 'edits' in arg; + edit: TextEdit; +} +export namespace WorkspaceTextEditDto { + export function is(arg: WorkspaceTextEditDto | WorkspaceFileEditDto): arg is WorkspaceTextEditDto { + return !!arg + && 'resource' in arg + && 'edit' in arg + && arg.edit !== null + && typeof arg.edit === 'object'; } } export interface WorkspaceEditDto { - edits: (ResourceFileEditDto | ResourceTextEditDto)[]; - rejectReason?: string; + edits: Array; } export interface CommandProperties { diff --git a/packages/plugin-ext/src/main/browser/languages-main.ts b/packages/plugin-ext/src/main/browser/languages-main.ts index 524719387b4cd..1d502986b0da6 100644 --- a/packages/plugin-ext/src/main/browser/languages-main.ts +++ b/packages/plugin-ext/src/main/browser/languages-main.ts @@ -31,7 +31,7 @@ import { MAIN_RPC_CONTEXT, LanguagesExt, WorkspaceEditDto, - ResourceTextEditDto, + WorkspaceTextEditDto, PluginInfo } from '../../common/plugin-api-rpc'; import { injectable, inject } from 'inversify'; @@ -916,8 +916,8 @@ function toMonacoRelatedInformation(relatedInfo: RelatedInformation): monaco.edi export function toMonacoWorkspaceEdit(data: WorkspaceEditDto | undefined): monaco.languages.WorkspaceEdit { return { edits: (data && data.edits || []).map(edit => { - if (ResourceTextEditDto.is(edit)) { - return { resource: monaco.Uri.revive(edit.resource), edits: edit.edits }; + if (WorkspaceTextEditDto.is(edit)) { + return { resource: monaco.Uri.revive(edit.resource), edit: edit.edit }; } else { return { newUri: monaco.Uri.revive(edit.newUri), oldUri: monaco.Uri.revive(edit.oldUri), options: edit.options }; } diff --git a/packages/plugin-ext/src/plugin/file-system-event-service-ext-impl.ts b/packages/plugin-ext/src/plugin/file-system-event-service-ext-impl.ts index 27eadbb36275b..681caefb6aec7 100644 --- a/packages/plugin-ext/src/plugin/file-system-event-service-ext-impl.ts +++ b/packages/plugin-ext/src/plugin/file-system-event-service-ext-impl.ts @@ -40,7 +40,7 @@ import { flatten } from '../common/arrays'; import { CancellationToken } from '@theia/core/lib/common/cancellation'; import { Plugin, TextEditorsMain as MainThreadTextEditorsShape, PLUGIN_RPC_CONTEXT, FileSystemEvents, ExtHostFileSystemEventServiceShape, - ResourceFileEditDto as IWorkspaceFileEditDto, ResourceTextEditDto as IWorkspaceTextEditDto + WorkspaceFileEditDto, WorkspaceTextEditDto } from '../common/plugin-api-rpc'; import { RPCProtocol } from '../common/rpc-protocol'; @@ -245,7 +245,7 @@ export class ExtHostFileSystemEventService implements ExtHostFileSystemEventServ if (edits.length > 0) { // flatten all WorkspaceEdits collected via waitUntil-call // and apply them in one go. - const allEdits = new Array>(); + const allEdits = new Array>(); for (const edit of edits) { const { edits } = typeConverter.fromWorkspaceEdit(edit, this._extHostDocumentsAndEditors); allEdits.push(edits); diff --git a/packages/plugin-ext/src/plugin/type-converters.ts b/packages/plugin-ext/src/plugin/type-converters.ts index 2d0c6bdae3737..33c900c94c2e3 100644 --- a/packages/plugin-ext/src/plugin/type-converters.ts +++ b/packages/plugin-ext/src/plugin/type-converters.ts @@ -19,8 +19,7 @@ import { Position as P, Range as R, SymbolInformation, SymbolKind as S } from 'v import { URI } from 'vscode-uri'; import * as rpc from '../common/plugin-api-rpc'; import { - DecorationOptions, EditorPosition, PickOpenItem, Plugin, Position, ResourceFileEditDto, - ResourceTextEditDto, Selection, TaskDto, WorkspaceEditDto + DecorationOptions, EditorPosition, PickOpenItem, Plugin, Position, WorkspaceTextEditDto, WorkspaceFileEditDto, Selection, TaskDto, WorkspaceEditDto } from '../common/plugin-api-rpc'; import * as model from '../common/plugin-api-rpc-model'; import { LanguageFilter, LanguageSelector, RelativePattern } from '@theia/callhierarchy/lib/common/language-selector'; @@ -507,10 +506,10 @@ export function fromWorkspaceEdit(value: theia.WorkspaceEdit, documents?: any): if (Array.isArray(uriOrEdits)) { // text edits const doc = documents ? documents.getDocument(uri.toString()) : undefined; - result.edits.push({ resource: uri, modelVersionId: doc && doc.version, edits: uriOrEdits.map(fromTextEdit) }); + result.edits.push({ resource: uri, modelVersionId: doc && doc.version, edit: uriOrEdits.map(fromTextEdit)[0] }); // todo } else { // resource edits - result.edits.push({ oldUri: uri, newUri: uriOrEdits, options: entry[2] }); + result.edits.push({ oldUri: uri, newUri: uriOrEdits, options: entry[2] }); } } return result; diff --git a/packages/plugin-metrics/package.json b/packages/plugin-metrics/package.json index 8ae51b0ce6a6d..1cca98ddd576b 100644 --- a/packages/plugin-metrics/package.json +++ b/packages/plugin-metrics/package.json @@ -7,7 +7,7 @@ "@theia/metrics": "^1.4.0", "@theia/plugin": "^1.4.0", "@theia/plugin-ext": "^1.4.0", - "vscode-languageserver-protocol": "^3.15.0-next.8" + "vscode-languageserver-protocol": "^3.15.3" }, "publishConfig": { "access": "public" diff --git a/packages/preferences/package.json b/packages/preferences/package.json index f4500b3d84320..363fec47de2ba 100644 --- a/packages/preferences/package.json +++ b/packages/preferences/package.json @@ -9,7 +9,7 @@ "@theia/monaco": "^1.4.0", "@theia/userstorage": "^1.4.0", "@theia/workspace": "^1.4.0", - "jsonc-parser": "^2.0.2" + "jsonc-parser": "^2.2.0" }, "publishConfig": { "access": "public" diff --git a/packages/task/package.json b/packages/task/package.json index 9afc5211de4a2..f991e5e181f3b 100644 --- a/packages/task/package.json +++ b/packages/task/package.json @@ -14,7 +14,7 @@ "@theia/variable-resolver": "^1.4.0", "@theia/workspace": "^1.4.0", "ajv": "^6.5.3", - "jsonc-parser": "^2.0.2", + "jsonc-parser": "^2.2.0", "p-debounce": "^2.1.0" }, "publishConfig": { diff --git a/packages/workspace/package.json b/packages/workspace/package.json index 7f08372a151ef..985ee330f097a 100644 --- a/packages/workspace/package.json +++ b/packages/workspace/package.json @@ -7,7 +7,7 @@ "@theia/filesystem": "^1.4.0", "@theia/variable-resolver": "^1.4.0", "ajv": "^6.5.3", - "jsonc-parser": "^2.0.2", + "jsonc-parser": "^2.2.0", "moment": "2.24.0", "valid-filename": "^2.0.1" }, diff --git a/yarn.lock b/yarn.lock index 07bcac15e30fb..622a7eb089acf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1174,10 +1174,10 @@ serialize-javascript "^1.4.0" webpack-sources "^1.0.1" -"@theia/monaco-editor-core@^0.19.3": - version "0.19.3" - resolved "https://registry.yarnpkg.com/@theia/monaco-editor-core/-/monaco-editor-core-0.19.3.tgz#8456aaa52f4cdc87c78697a0edfcccb9696a374d" - integrity sha512-+2I5pvbK9qxWs+bLFUwto8nYubyI759/p0z86r2w0HnFdcMQ6rcqvcTupO/Cd/YAJ1/IU38PBWS7hwIoVnvCsQ== +"@theia/monaco-editor-core@^0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@theia/monaco-editor-core/-/monaco-editor-core-0.20.0.tgz#0f3cdfd6d1278bbcc3df0224471fc967a4d901c5" + integrity sha512-6QDOrZRW3dE0RgyD/hXMlVla49ACNjwIX+u9+i/qY+OqaZ1u/QdgdnHy4QO6g4J0lQCyr7nXgqF1BAc+Xbxx2g== "@theia/node-pty@0.9.0-theia.6": version "0.9.0-theia.6" @@ -8097,10 +8097,10 @@ json5@^2.1.2: dependencies: minimist "^1.2.5" -jsonc-parser@^2.0.2: - version "2.2.0" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.2.0.tgz#f206f87f9d49d644b7502052c04e82dd6392e9ef" - integrity sha512-4fLQxW1j/5fWj6p78vAlAafoCKtuBm6ghv+Ij5W2DrDx0qE+ZdEl2c6Ko1mgJNF5ftX1iEWQQ4Ap7+3GlhjkOA== +jsonc-parser@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.3.0.tgz#7c7fc988ee1486d35734faaaa866fadb00fa91ee" + integrity sha512-b0EBt8SWFNnixVdvoR2ZtEGa9ZqLhbJnOjezn+WP+8kspFm+PFYDN8Z4Bc7pRlDjvuVcADSUkroIuTWWn/YiIA== jsonfile@^4.0.0: version "4.0.0" @@ -13416,28 +13416,28 @@ vscode-debugprotocol@^1.32.0: resolved "https://registry.yarnpkg.com/vscode-debugprotocol/-/vscode-debugprotocol-1.37.0.tgz#e8c4694a078d18ea1a639553a7a241b35c1e6f6d" integrity sha512-ppZLEBbFRVNsK0YpfgFi/x2CDyihx0F+UpdKmgeJcvi05UgSXYdO0n9sDVYwoGvvYQPvlpDQeWuY0nloOC4mPA== -vscode-jsonrpc@^5.0.0, vscode-jsonrpc@^5.0.0-next.7: +vscode-jsonrpc@^5.0.0, vscode-jsonrpc@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz#9bab9c330d89f43fc8c1e8702b5c36e058a01794" integrity sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A== -vscode-languageserver-protocol@^3.15.0-next.8: - version "3.15.0-next.15" - resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.15.tgz#c67454b83c5f0a1b3f54d29226ab6ea19103e3fe" - integrity sha512-c1f47pxAtUE+gYTGLoySVA+nBUbPtz8NMOLOB69RiTBQobSJBO1XXKB8TXz8BSxpG5T8qRXeEm2vXrM/eepYKg== +vscode-languageserver-protocol@^3.15.3: + version "3.15.3" + resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.3.tgz#3fa9a0702d742cf7883cb6182a6212fcd0a1d8bb" + integrity sha512-zrMuwHOAQRhjDSnflWdJG+O2ztMWss8GqUUB8dXLR/FPenwkiBNkMIJJYfSN6sgskvsF0rHAoBowNQfbyZnnvw== dependencies: - vscode-jsonrpc "^5.0.0-next.7" - vscode-languageserver-types "^3.15.0-next.10" + vscode-jsonrpc "^5.0.1" + vscode-languageserver-types "3.15.1" vscode-languageserver-textdocument@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz#178168e87efad6171b372add1dea34f53e5d330f" integrity sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA== -vscode-languageserver-types@^3.15.0-next, vscode-languageserver-types@^3.15.0-next.10: - version "3.15.0-next.10" - resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.10.tgz#fcd22bb5e8415f52134cf9eb1a5d90778558bc5c" - integrity sha512-s9Psd+0sQVkH4o1U7hwTNJRuXQQgFvGVZIim7Wb44tcq54rZou3kJKCtdFEm0aHUuYxIrMPYrzuh1jlqCbRegw== +vscode-languageserver-types@3.15.1, vscode-languageserver-types@^3.15.1: + version "3.15.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz#17be71d78d2f6236d414f0001ce1ef4d23e6b6de" + integrity sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ== vscode-ripgrep@^1.2.4: version "1.8.0" @@ -13447,7 +13447,7 @@ vscode-ripgrep@^1.2.4: https-proxy-agent "^4.0.0" proxy-from-env "^1.1.0" -vscode-textmate@^4.0.1: +vscode-textmate@^4.0.1, vscode-textmate@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.4.0.tgz#14032afeb50152e8f53258c95643e555f2948305" integrity sha512-dFpm2eK0HwEjeFSD1DDh3j0q47bDSVuZt20RiJWxGqjtm73Wu2jip3C2KaZI3dQx/fSeeXCr/uEN4LNaNj7Ytw==