From 562bd7e7a7a0ebeeb1918c7882d8fd8d64e5485c Mon Sep 17 00:00:00 2001 From: vince-fugnitto Date: Wed, 19 Oct 2022 16:04:17 -0400 Subject: [PATCH] monaco: upgrade to `1.72.x` The commit upgrades monaco to `v1.72.3`. Signed-off-by: vince-fugnitto --- examples/api-samples/package.json | 2 +- examples/api-tests/src/typescript.spec.js | 27 +- examples/playwright/src/theia-text-editor.ts | 7 +- packages/bulk-edit/package.json | 2 +- packages/console/package.json | 2 +- .../core/src/browser/context-key-service.ts | 10 +- .../core/src/browser/resource-context-key.ts | 12 +- .../src/browser/shell/application-shell.ts | 4 +- packages/debug/package.json | 2 +- .../disassembly-view-instruction-renderer.ts | 6 +- .../editor/debug-breakpoint-widget.tsx | 3 +- .../src/browser/editor/debug-editor-model.ts | 4 +- .../editor/debug-inline-value-decorator.ts | 3 +- .../editor-generated-preference-schema.ts | 282 ++++++++++++------ packages/git/package.json | 2 +- packages/keymaps/package.json | 2 +- packages/monaco/package.json | 2 +- .../src/browser/monaco-bulk-edit-service.ts | 7 +- .../src/browser/monaco-context-key-service.ts | 4 +- .../browser/monaco-gotoline-quick-access.ts | 2 +- .../browser/monaco-gotosymbol-quick-access.ts | 2 +- packages/monaco/src/browser/monaco-menu.ts | 27 +- .../src/browser/monaco-quick-input-service.ts | 6 +- .../monaco/src/browser/monaco-workspace.ts | 16 +- packages/monaco/src/browser/style/index.css | 7 - packages/output/package.json | 2 +- packages/plugin-ext-vscode/package.json | 2 +- packages/plugin-ext/package.json | 2 +- .../src/common/plugin-api-rpc-model.ts | 6 +- .../plugin-ext/src/common/plugin-api-rpc.ts | 12 +- .../src/main/browser/languages-main.ts | 74 +++-- .../menus/plugin-menu-command-adapter.ts | 4 +- .../src/main/browser/text-editor-main.ts | 5 +- .../src/main/browser/theme-icon-override.ts | 31 ++ packages/plugin-ext/src/plugin/languages.ts | 3 +- .../src/plugin/preference-registry.ts | 10 +- .../plugin-ext/src/plugin/type-converters.ts | 16 +- packages/plugin-metrics/package.json | 2 +- packages/preferences/package.json | 2 +- packages/task/package.json | 2 +- packages/toolbar/package.json | 2 +- .../browser/common-variable-contribution.ts | 5 +- yarn.lock | 8 +- 43 files changed, 403 insertions(+), 228 deletions(-) diff --git a/examples/api-samples/package.json b/examples/api-samples/package.json index afeee0727e453..3ffc280a4c136 100644 --- a/examples/api-samples/package.json +++ b/examples/api-samples/package.json @@ -8,7 +8,7 @@ "@theia/file-search": "1.31.0", "@theia/filesystem": "1.31.0", "@theia/monaco": "1.31.0", - "@theia/monaco-editor-core": "1.67.2", + "@theia/monaco-editor-core": "1.72.3-alpha0", "@theia/output": "1.31.0", "@theia/search-in-workspace": "1.31.0", "@theia/toolbar": "1.31.0", diff --git a/examples/api-tests/src/typescript.spec.js b/examples/api-tests/src/typescript.spec.js index 3b0083d80b5dd..4b2ffa869d8a7 100644 --- a/examples/api-tests/src/typescript.spec.js +++ b/examples/api-tests/src/typescript.spec.js @@ -644,10 +644,10 @@ SPAN { editor.getControl().revealPosition({ lineNumber, column }); assert.equal(currentChar(), ';'); - /** @type {import('@theia/monaco-editor-core/src/vs/editor/contrib/codeAction/browser/codeActionCommands').QuickFixController} */ - const quickFixController = editor.getControl().getContribution('editor.contrib.quickFixController'); + /** @type {import('@theia/monaco-editor-core/src/vs/editor/contrib/codeAction/browser/codeActionCommands').CodeActionController} */ + const codeActionController = editor.getControl().getContribution('editor.contrib.codeActionController'); const lightBulbNode = () => { - const ui = quickFixController['_ui'].rawValue; + const ui = codeActionController['_ui'].rawValue; const lightBulb = ui && ui['_lightBulbWidget'].rawValue; return lightBulb && lightBulb['_domNode']; }; @@ -660,10 +660,12 @@ SPAN { await waitForAnimation(() => lightBulbVisible()); await commands.executeCommand('editor.action.quickFix'); - await waitForAnimation(() => !!document.querySelector('.p-Widget.p-Menu'), 5000); + const codeActionSelector = '.codeActionWidget'; + assert.isFalse(!!document.querySelector(codeActionSelector), 'codeActionWidget should not be visible'); + + await waitForAnimation(() => !!document.querySelector(codeActionSelector), 5000); await animationFrame(); - keybindings.dispatchKeyDown('ArrowDown'); keybindings.dispatchKeyDown('Enter'); await waitForAnimation(() => currentChar() === 'd', 5000); @@ -737,10 +739,10 @@ SPAN { it('Can execute code actions', async function () { const editor = await openEditor(demoFileUri); - /** @type {import('@theia/monaco-editor-core/src/vs/editor/contrib/codeAction/browser/codeActionCommands').QuickFixController} */ - const quickFixController = editor.getControl().getContribution('editor.contrib.quickFixController'); + /** @type {import('@theia/monaco-editor-core/src/vs/editor/contrib/codeAction/browser/codeActionCommands').CodeActionController} */ + const codeActionController = editor.getControl().getContribution('editor.contrib.codeActionController'); const isActionAvailable = () => { - const lightbulbVisibility = quickFixController['_ui'].rawValue?.['_lightBulbWidget'].rawValue?.['_domNode'].style.visibility; + const lightbulbVisibility = codeActionController['_ui'].rawValue?.['_lightBulbWidget'].rawValue?.['_domNode'].style.visibility; return lightbulbVisibility !== undefined && lightbulbVisibility !== 'hidden'; } assert.isFalse(isActionAvailable()); @@ -752,12 +754,14 @@ SPAN { assert.isTrue(isActionAvailable()); await commands.executeCommand('editor.action.quickFix'); - await waitForAnimation(() => Boolean(document.querySelector('.p-Widget.p-Menu')), 5000, 'No context menu appeared. (1)'); + await waitForAnimation(() => Boolean(document.querySelector('.context-view-pointerBlock')), 5000, 'No context menu appeared. (1)'); await animationFrame(); - keybindings.dispatchKeyDown('ArrowDown'); keybindings.dispatchKeyDown('Enter'); + assert.isNotNull(editor.getControl()); + assert.isNotNull(editor.getControl().getModel()); + console.log(`content: ${editor.getControl().getModel().getLineContent(30)}`); await waitForAnimation(() => editor.getControl().getModel().getLineContent(30) === 'import * as demoDefinitionsFile from "./demo-definitions-file";', 5000, 'The namespace import did not take effect.'); editor.getControl().setSelection(new Selection(30, 1, 30, 64)); @@ -765,10 +769,9 @@ SPAN { // Change it back: https://github.com/eclipse-theia/theia/issues/11059 await commands.executeCommand('editor.action.quickFix'); - await waitForAnimation(() => Boolean(document.querySelector('.p-Widget.p-Menu')), 5000, 'No context menu appeared. (2)'); + await waitForAnimation(() => Boolean(document.querySelector('.context-view-pointerBlock')), 5000, 'No context menu appeared. (2)'); await animationFrame(); - keybindings.dispatchKeyDown('ArrowDown'); keybindings.dispatchKeyDown('Enter'); await waitForAnimation(() => editor.getControl().getModel().getLineContent(30) === 'import { DefinedInterface } from "./demo-definitions-file";', 5000, 'The named import did not take effect.'); diff --git a/examples/playwright/src/theia-text-editor.ts b/examples/playwright/src/theia-text-editor.ts index ba79021cb1b18..08ae9b7ab0e80 100644 --- a/examples/playwright/src/theia-text-editor.ts +++ b/examples/playwright/src/theia-text-editor.ts @@ -152,9 +152,10 @@ export class TheiaTextEditor extends TheiaEditor { } protected replaceEditorSymbolsWithSpace(content: string): string | Promise { - // [ ]   => \u00a0 - // [·] · => \u00b7 - return content.replace(/[\u00a0\u00b7]/g, ' '); + // [ ]   => \u00a0 -- NO-BREAK SPACE + // [·] · => \u00b7 -- MIDDLE DOT + // [] ‌ => \u200c -- ZERO WIDTH NON-JOINER + return content.replace(/[\u00a0\u00b7]/g, ' ').replace(/[\u200c]/g, ''); } protected async selectedSuggestion(): Promise> { diff --git a/packages/bulk-edit/package.json b/packages/bulk-edit/package.json index ed9edd4722159..cbecd584826ca 100644 --- a/packages/bulk-edit/package.json +++ b/packages/bulk-edit/package.json @@ -7,7 +7,7 @@ "@theia/editor": "1.31.0", "@theia/filesystem": "1.31.0", "@theia/monaco": "1.31.0", - "@theia/monaco-editor-core": "1.67.2", + "@theia/monaco-editor-core": "1.72.3-alpha0", "@theia/workspace": "1.31.0" }, "publishConfig": { diff --git a/packages/console/package.json b/packages/console/package.json index 72076e6a58118..664fa4bcf3a17 100644 --- a/packages/console/package.json +++ b/packages/console/package.json @@ -5,7 +5,7 @@ "dependencies": { "@theia/core": "1.31.0", "@theia/monaco": "1.31.0", - "@theia/monaco-editor-core": "1.67.2", + "@theia/monaco-editor-core": "1.72.3-alpha0", "anser": "^2.0.1" }, "publishConfig": { diff --git a/packages/core/src/browser/context-key-service.ts b/packages/core/src/browser/context-key-service.ts index 801c2afb40311..8a7a2993f7ffc 100644 --- a/packages/core/src/browser/context-key-service.ts +++ b/packages/core/src/browser/context-key-service.ts @@ -18,7 +18,11 @@ import { injectable } from 'inversify'; import { Disposable } from '../common'; import { Emitter, Event } from '../common/event'; -export interface ContextKey { +export type ContextKeyValue = null | undefined | boolean | number | string + | Array + | Record; + +export interface ContextKey { set(value: T | undefined): void; reset(): void; get(): T | undefined; @@ -41,7 +45,7 @@ export const ContextKeyService = Symbol('ContextKeyService'); export interface ContextKeyService extends Disposable { readonly onDidChange: Event; - createKey(key: string, defaultValue: T | undefined): ContextKey; + createKey(key: string, defaultValue: T | undefined): ContextKey; /** * Whether the expression is satisfied. If `context` provided, the service will attempt to retrieve a context object associated with that element. @@ -82,7 +86,7 @@ export class ContextKeyServiceDummyImpl implements ContextKeyService { this.onDidChangeEmitter.fire(event); } - createKey(key: string, defaultValue: T | undefined): ContextKey { + createKey(key: string, defaultValue: T | undefined): ContextKey { return ContextKey.None; } /** diff --git a/packages/core/src/browser/resource-context-key.ts b/packages/core/src/browser/resource-context-key.ts index 3882323b61727..45cbd5ff47ad4 100644 --- a/packages/core/src/browser/resource-context-key.ts +++ b/packages/core/src/browser/resource-context-key.ts @@ -16,7 +16,6 @@ import { injectable, inject, postConstruct } from 'inversify'; import URI from '../common/uri'; -import { URI as Uri } from 'vscode-uri'; import { ContextKeyService, ContextKey } from './context-key-service'; import { LanguageService } from './language-service'; @@ -29,7 +28,7 @@ export class ResourceContextKey { @inject(ContextKeyService) protected readonly contextKeyService: ContextKeyService; - protected resource: ContextKey; + protected resource: ContextKey; protected resourceSchemeKey: ContextKey; protected resourceFileName: ContextKey; protected resourceExtname: ContextKey; @@ -40,7 +39,7 @@ export class ResourceContextKey { @postConstruct() protected init(): void { - this.resource = this.contextKeyService.createKey('resource', undefined); + this.resource = this.contextKeyService.createKey('resource', undefined); this.resourceSchemeKey = this.contextKeyService.createKey('resourceScheme', undefined); this.resourceFileName = this.contextKeyService.createKey('resourceFilename', undefined); this.resourceExtname = this.contextKeyService.createKey('resourceExtname', undefined); @@ -50,13 +49,12 @@ export class ResourceContextKey { this.resourceSet = this.contextKeyService.createKey('resourceSet', false); } - get(): URI | undefined { - const codeUri = this.resource.get(); - return codeUri && new URI(codeUri); + get(): string | undefined { + return this.resource.get(); } set(resourceUri: URI | undefined): void { - this.resource.set(resourceUri?.['codeUri']); + this.resource.set(resourceUri?.toString()); this.resourceSchemeKey.set(resourceUri?.scheme); this.resourceFileName.set(resourceUri?.path.base); this.resourceExtname.set(resourceUri?.path.ext); diff --git a/packages/core/src/browser/shell/application-shell.ts b/packages/core/src/browser/shell/application-shell.ts index 272a06bfde5f8..f9a95b678969c 100644 --- a/packages/core/src/browser/shell/application-shell.ts +++ b/packages/core/src/browser/shell/application-shell.ts @@ -309,8 +309,8 @@ export class ApplicationShell extends Widget { } protected initFocusKeyContexts(): void { - const sideBarFocus = this.contextKeyService.createKey('sideBarFocus', false); - const panelFocus = this.contextKeyService.createKey('panelFocus', false); + const sideBarFocus = this.contextKeyService.createKey('sideBarFocus', false); + const panelFocus = this.contextKeyService.createKey('panelFocus', false); const updateFocusContextKeys = () => { const area = this.activeWidget && this.getAreaFor(this.activeWidget); sideBarFocus.set(area === 'left'); diff --git a/packages/debug/package.json b/packages/debug/package.json index 3a6775b7b8f6f..04a5f3f63ec3a 100644 --- a/packages/debug/package.json +++ b/packages/debug/package.json @@ -9,7 +9,7 @@ "@theia/filesystem": "1.31.0", "@theia/markers": "1.31.0", "@theia/monaco": "1.31.0", - "@theia/monaco-editor-core": "1.67.2", + "@theia/monaco-editor-core": "1.72.3-alpha0", "@theia/output": "1.31.0", "@theia/process": "1.31.0", "@theia/task": "1.31.0", diff --git a/packages/debug/src/browser/disassembly-view/disassembly-view-instruction-renderer.ts b/packages/debug/src/browser/disassembly-view/disassembly-view-instruction-renderer.ts index 62436a0f03eb5..6e6bac9d15ba6 100644 --- a/packages/debug/src/browser/disassembly-view/disassembly-view-instruction-renderer.ts +++ b/packages/debug/src/browser/disassembly-view/disassembly-view-instruction-renderer.ts @@ -25,7 +25,7 @@ import { Disposable, dispose } from '@theia/monaco-editor-core/esm/vs/base/commo import { isAbsolute } from '@theia/monaco-editor-core/esm/vs/base/common/path'; import { Constants } from '@theia/monaco-editor-core/esm/vs/base/common/uint'; import { applyFontInfo } from '@theia/monaco-editor-core/esm/vs/editor/browser/config/domFontInfo'; -import { createStringBuilder } from '@theia/monaco-editor-core/esm/vs/editor/common/core/stringBuilder'; +import { StringBuilder } from '@theia/monaco-editor-core/esm/vs/editor/common/core/stringBuilder'; import { ITextModel } from '@theia/monaco-editor-core/esm/vs/editor/common/model'; import { ITextModelService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/resolverService'; import { IThemeService } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService'; @@ -92,14 +92,14 @@ export class InstructionRenderer extends Disposable implements ITableRenderer