@theia/monaco 1.74.0 → 1.74.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import { MonacoTextModelService } from './monaco-text-model-service';
5
5
  import { MonacoThemingService } from './monaco-theming-service';
6
6
  import { PreferenceSchemaService } from '@theia/core';
7
7
  import { WorkspaceFileService } from '@theia/workspace/lib/common/workspace-file-service';
8
- import { SecondaryWindowHandler } from '@theia/core/lib/browser/secondary-window-handler';
8
+ import { MonacoStandaloneThemeService } from './monaco-standalone-theme-service';
9
9
  import { SecondaryWindowService } from '@theia/core/lib/browser/window/secondary-window-service';
10
10
  export declare class MonacoFrontendApplicationContribution implements FrontendApplicationContribution, StylingParticipant {
11
11
  protected readonly windowsById: Map<number, monaco.IDisposable>;
@@ -16,11 +16,18 @@ export declare class MonacoFrontendApplicationContribution implements FrontendAp
16
16
  protected readonly quickAccessRegistry: QuickAccessRegistry;
17
17
  protected readonly monacoThemingService: MonacoThemingService;
18
18
  protected readonly workspaceFileService: WorkspaceFileService;
19
- protected readonly secondaryWindowHandler: SecondaryWindowHandler;
20
19
  protected readonly secondaryWindowService: SecondaryWindowService;
21
20
  protected init(): void;
22
21
  initialize(): void;
23
22
  onStart(): void;
23
+ /**
24
+ * Theia's {@link MonacoStandaloneThemeService} override, which creates the `monaco-colors`
25
+ * stylesheet in the target node's own document. The upstream `StandaloneThemeService` would
26
+ * only ever create a single global stylesheet in the main document and silently no-op for
27
+ * nodes in other documents, so this contribution depends on the Theia override being bound
28
+ * (see `monaco-init.ts`).
29
+ */
30
+ protected get standaloneThemeService(): MonacoStandaloneThemeService;
24
31
  registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void;
25
32
  /**
26
33
  * For reasons that are unclear, while most preferences that apply in editors are validated, a few are not.
@@ -1 +1 @@
1
- {"version":3,"file":"monaco-frontend-application-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/monaco-frontend-application-contribution.ts"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,OAAO,IAAI,IAAI;IA2Bf,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,GAAG,IAAI;IA2CzE;;;;OAIG;IACH,SAAS,CAAC,kCAAkC,IAAI,IAAI;CA8BvD"}
1
+ {"version":3,"file":"monaco-frontend-application-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/monaco-frontend-application-contribution.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,+BAA+B,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClJ,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAGpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,OAAO,EAA0C,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAG1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,yDAAyD,CAAC;AAOjG,qBACa,qCAAsC,YAAW,+BAA+B,EAAE,kBAAkB;IAC7G,SAAS,CAAC,QAAQ,CAAC,WAAW,kCAAyC;IACvE,SAAS,CAAC,YAAY,SAAK;IAG3B,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,sBAAsB,CAAC;IAG5D,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,4BAA4B,CAAC;IAGxE,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;IAG7D,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAE9B,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAE9D,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAG5F,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IAGlE,SAAS,CAAC,IAAI,IAAI,IAAI;IAwBtB,UAAU,IAAI,IAAI;IAUlB,OAAO,IAAI,IAAI;IA+Bf;;;;;;OAMG;IACH,SAAS,KAAK,sBAAsB,IAAI,4BAA4B,CAEnE;IAED,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,GAAG,IAAI;IA2CzE;;;;OAIG;IACH,SAAS,CAAC,kCAAkC,IAAI,IAAI;CA8BvD"}
@@ -29,9 +29,6 @@ const editorOptions_1 = require("@theia/monaco-editor-core/esm/vs/editor/common/
29
29
  const core_1 = require("@theia/core");
30
30
  const editor_generated_preference_schema_1 = require("@theia/editor/lib/common/editor-generated-preference-schema");
31
31
  const workspace_file_service_1 = require("@theia/workspace/lib/common/workspace-file-service");
32
- const secondary_window_handler_1 = require("@theia/core/lib/browser/secondary-window-handler");
33
- const browser_2 = require("@theia/editor/lib/browser");
34
- const monaco_editor_1 = require("./monaco-editor");
35
32
  const standaloneServices_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices");
36
33
  const standaloneTheme_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme");
37
34
  const secondary_window_service_1 = require("@theia/core/lib/browser/window/secondary-window-service");
@@ -77,23 +74,37 @@ let MonacoFrontendApplicationContribution = class MonacoFrontendApplicationContr
77
74
  // when the first standalone editor is opened, so popups that rely on those variables (e.g. the chat
78
75
  // input's suggest widget) are unstyled until then. Register the main window up front so the variables
79
76
  // are available document-wide from launch; `_updateCSS` keeps the stylesheet in sync on theme changes.
80
- standaloneServices_1.StandaloneServices.get(standaloneTheme_1.IStandaloneThemeService).registerEditorContainer(document.body);
81
- this.secondaryWindowHandler.onDidAddWidget(([widget, window]) => {
82
- if (widget instanceof browser_2.EditorWidget && widget.editor instanceof monaco_editor_1.MonacoEditor) {
83
- const themeService = standaloneServices_1.StandaloneServices.get(standaloneTheme_1.IStandaloneThemeService);
84
- themeService.registerEditorContainer(widget.node);
85
- }
86
- });
87
- this.secondaryWindowService.onWindowOpened(window => {
77
+ this.standaloneThemeService.registerEditorContainer(document.body);
78
+ this.secondaryWindowService.onWindowLoaded(window => {
88
79
  const codeWindow = window;
89
80
  codeWindow.vscodeWindowId = this.nextWindowId++;
90
- this.windowsById.set(codeWindow.vscodeWindowId, (0, dom_1.registerWindow)(codeWindow));
81
+ const toDispose = new core_1.DisposableCollection();
82
+ toDispose.push((0, dom_1.registerWindow)(codeWindow));
83
+ // Inject Monaco's theme stylesheet (`monaco-colors`, defining the `--vscode-*`
84
+ // variables and token colors) into the new window's document. Without it, Monaco
85
+ // editors in secondary windows have no theme colors: invisible cursor and
86
+ // selection, unstyled suggest widget. Registering the document body covers all
87
+ // widgets moved to this window, e.g. the AI chat view with its input editor.
88
+ // See https://github.com/eclipse-theia/theia/issues/15164
89
+ toDispose.push(this.standaloneThemeService.registerEditorContainer(codeWindow.document.body));
90
+ this.windowsById.set(codeWindow.vscodeWindowId, toDispose);
91
91
  });
92
92
  this.secondaryWindowService.onWindowClosed(window => {
93
93
  const codeWindow = window;
94
94
  this.windowsById.get(codeWindow.vscodeWindowId)?.dispose();
95
+ this.windowsById.delete(codeWindow.vscodeWindowId);
95
96
  });
96
97
  }
98
+ /**
99
+ * Theia's {@link MonacoStandaloneThemeService} override, which creates the `monaco-colors`
100
+ * stylesheet in the target node's own document. The upstream `StandaloneThemeService` would
101
+ * only ever create a single global stylesheet in the main document and silently no-op for
102
+ * nodes in other documents, so this contribution depends on the Theia override being bound
103
+ * (see `monaco-init.ts`).
104
+ */
105
+ get standaloneThemeService() {
106
+ return standaloneServices_1.StandaloneServices.get(standaloneTheme_1.IStandaloneThemeService);
107
+ }
97
108
  registerThemeStyle(theme, collector) {
98
109
  if ((0, theme_1.isHighContrast)(theme.type)) {
99
110
  const focusBorder = theme.getColor('focusBorder');
@@ -193,10 +204,6 @@ tslib_1.__decorate([
193
204
  (0, inversify_1.inject)(workspace_file_service_1.WorkspaceFileService),
194
205
  tslib_1.__metadata("design:type", workspace_file_service_1.WorkspaceFileService)
195
206
  ], MonacoFrontendApplicationContribution.prototype, "workspaceFileService", void 0);
196
- tslib_1.__decorate([
197
- (0, inversify_1.inject)(secondary_window_handler_1.SecondaryWindowHandler),
198
- tslib_1.__metadata("design:type", secondary_window_handler_1.SecondaryWindowHandler)
199
- ], MonacoFrontendApplicationContribution.prototype, "secondaryWindowHandler", void 0);
200
207
  tslib_1.__decorate([
201
208
  (0, inversify_1.inject)(secondary_window_service_1.SecondaryWindowService),
202
209
  tslib_1.__metadata("design:type", Object)
@@ -1 +1 @@
1
- {"version":3,"file":"monaco-frontend-application-contribution.js","sourceRoot":"","sources":["../../src/browser/monaco-frontend-application-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAAiF;AACjF,qDAAkJ;AAClJ,uFAAiF;AACjF,oDAAoD;AACpD,qGAAmH;AAEnH,2EAAqE;AACrE,qEAAgE;AAChE,wDAA8D;AAC9D,uGAA2H;AAC3H,sCAAwE;AACxE,oHAAkH;AAClH,+FAA0F;AAC1F,+FAA0F;AAC1F,uDAAyD;AACzD,mDAA+C;AAC/C,sHAAmH;AAEnH,+GAAoH;AACpH,sGAAiG;AACjG,2EAAmF;AAO5E,IAAM,qCAAqC,GAA3C,MAAM,qCAAqC;IAA3C;QACgB,gBAAW,GAAG,IAAI,GAAG,EAA8B,CAAC;QAC7D,iBAAY,GAAG,CAAC,CAAC,CAAC,iCAAiC;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CAAoB,CAAC;sCAA0C,6CAAoB;mFAAC;AAGzE;IADlB,IAAA,kBAAM,EAAC,iDAAsB,CAAC;sCACY,iDAAsB;qFAAC;AAG/C;IADlB,IAAA,kBAAM,EAAC,iDAAsB,CAAC;;qFACmC;AAGxD;IADT,IAAA,yBAAa,GAAE;;;;iEAuBf;gDAjDQ,qCAAqC;IADjD,IAAA,sBAAU,GAAE;GACA,qCAAqC,CAsKjD"}
1
+ {"version":3,"file":"monaco-frontend-application-contribution.js","sourceRoot":"","sources":["../../src/browser/monaco-frontend-application-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAAiF;AACjF,qDAAkJ;AAClJ,uFAAiF;AACjF,oDAAoD;AACpD,qGAAmH;AAEnH,2EAAqE;AACrE,qEAAgE;AAChE,wDAA8D;AAC9D,uGAA2H;AAC3H,sCAA8F;AAC9F,oHAAkH;AAClH,+FAA0F;AAC1F,sHAAmH;AACnH,+GAAoH;AAEpH,sGAAiG;AACjG,2EAAmF;AAO5E,IAAM,qCAAqC,GAA3C,MAAM,qCAAqC;IAA3C;QACgB,gBAAW,GAAG,IAAI,GAAG,EAA8B,CAAC;QAC7D,iBAAY,GAAG,CAAC,CAAC,CAAC,iCAAiC;IAgLjE,CAAC;IA1Ja,IAAI;QACV,IAAI,CAAC,kCAAkC,EAAE,CAAC;QAC1C,wHAAwH;QACxH,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QAEjC;;;WAGG;QACH,IAAA,kCAAwB,EAAC,IAAI,CAAC,sBAA2D,CAAC,CAAC;QAE3F,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,YAA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DA9CQ,qCAAqC;IADjD,IAAA,sBAAU,GAAE;GACA,qCAAqC,CAkLjD"}
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@theia/monaco",
3
- "version": "1.74.0",
3
+ "version": "1.74.1",
4
4
  "description": "Theia - Monaco Extension",
5
5
  "dependencies": {
6
- "@theia/core": "1.74.0",
7
- "@theia/editor": "1.74.0",
8
- "@theia/filesystem": "1.74.0",
9
- "@theia/markers": "1.74.0",
6
+ "@theia/core": "1.74.1",
7
+ "@theia/editor": "1.74.1",
8
+ "@theia/filesystem": "1.74.1",
9
+ "@theia/markers": "1.74.1",
10
10
  "@theia/monaco-editor-core": "1.108.201",
11
- "@theia/outline-view": "1.74.0",
12
- "@theia/workspace": "1.74.0",
11
+ "@theia/outline-view": "1.74.1",
12
+ "@theia/workspace": "1.74.1",
13
13
  "fast-plist": "^0.1.3",
14
14
  "idb": "^4.0.5",
15
15
  "jsonc-parser": "^3.3.1",
@@ -52,10 +52,10 @@
52
52
  "watch": "theiaext watch"
53
53
  },
54
54
  "devDependencies": {
55
- "@theia/ext-scripts": "1.74.0"
55
+ "@theia/ext-scripts": "1.74.1"
56
56
  },
57
57
  "nyc": {
58
58
  "extends": "../../configs/nyc.json"
59
59
  },
60
- "gitHead": "7b7376225f0825b4f13d296d686cc13db95fdb69"
60
+ "gitHead": "eb2ffacbac2d76cfb8c0d2dd682d340db746a1b2"
61
61
  }
@@ -24,15 +24,12 @@ import { MonacoTextModelService } from './monaco-text-model-service';
24
24
  import { MonacoThemingService } from './monaco-theming-service';
25
25
  import { isHighContrast } from '@theia/core/lib/common/theme';
26
26
  import { editorOptionsRegistry, IEditorOption } from '@theia/monaco-editor-core/esm/vs/editor/common/config/editorOptions';
27
- import { MAX_SAFE_INTEGER, PreferenceSchemaService } from '@theia/core';
27
+ import { DisposableCollection, MAX_SAFE_INTEGER, PreferenceSchemaService } from '@theia/core';
28
28
  import { editorGeneratedPreferenceProperties } from '@theia/editor/lib/common/editor-generated-preference-schema';
29
29
  import { WorkspaceFileService } from '@theia/workspace/lib/common/workspace-file-service';
30
- import { SecondaryWindowHandler } from '@theia/core/lib/browser/secondary-window-handler';
31
- import { EditorWidget } from '@theia/editor/lib/browser';
32
- import { MonacoEditor } from './monaco-editor';
33
30
  import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
34
- import { StandaloneThemeService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneThemeService';
35
31
  import { IStandaloneThemeService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
32
+ import { MonacoStandaloneThemeService } from './monaco-standalone-theme-service';
36
33
  import { SecondaryWindowService } from '@theia/core/lib/browser/window/secondary-window-service';
37
34
  import { registerWindow } from '@theia/monaco-editor-core/esm/vs/base/browser/dom';
38
35
 
@@ -61,9 +58,6 @@ export class MonacoFrontendApplicationContribution implements FrontendApplicatio
61
58
 
62
59
  @inject(WorkspaceFileService) protected readonly workspaceFileService: WorkspaceFileService;
63
60
 
64
- @inject(SecondaryWindowHandler)
65
- protected readonly secondaryWindowHandler: SecondaryWindowHandler;
66
-
67
61
  @inject(SecondaryWindowService)
68
62
  protected readonly secondaryWindowService: SecondaryWindowService;
69
63
 
@@ -108,27 +102,42 @@ export class MonacoFrontendApplicationContribution implements FrontendApplicatio
108
102
  // when the first standalone editor is opened, so popups that rely on those variables (e.g. the chat
109
103
  // input's suggest widget) are unstyled until then. Register the main window up front so the variables
110
104
  // are available document-wide from launch; `_updateCSS` keeps the stylesheet in sync on theme changes.
111
- (StandaloneServices.get(IStandaloneThemeService) as StandaloneThemeService).registerEditorContainer(document.body);
105
+ this.standaloneThemeService.registerEditorContainer(document.body);
112
106
 
113
- this.secondaryWindowHandler.onDidAddWidget(([widget, window]) => {
114
- if (widget instanceof EditorWidget && widget.editor instanceof MonacoEditor) {
115
- const themeService = StandaloneServices.get(IStandaloneThemeService) as StandaloneThemeService;
116
- themeService.registerEditorContainer(widget.node);
117
- }
118
- });
119
- this.secondaryWindowService.onWindowOpened(window => {
107
+ this.secondaryWindowService.onWindowLoaded(window => {
120
108
  const codeWindow: CodeWindow = window as CodeWindow;
121
109
  codeWindow.vscodeWindowId = this.nextWindowId++;
122
110
 
123
- this.windowsById.set(codeWindow.vscodeWindowId, registerWindow(codeWindow));
111
+ const toDispose = new DisposableCollection();
112
+ toDispose.push(registerWindow(codeWindow));
113
+ // Inject Monaco's theme stylesheet (`monaco-colors`, defining the `--vscode-*`
114
+ // variables and token colors) into the new window's document. Without it, Monaco
115
+ // editors in secondary windows have no theme colors: invisible cursor and
116
+ // selection, unstyled suggest widget. Registering the document body covers all
117
+ // widgets moved to this window, e.g. the AI chat view with its input editor.
118
+ // See https://github.com/eclipse-theia/theia/issues/15164
119
+ toDispose.push(this.standaloneThemeService.registerEditorContainer(codeWindow.document.body));
120
+ this.windowsById.set(codeWindow.vscodeWindowId, toDispose);
124
121
  });
125
122
 
126
123
  this.secondaryWindowService.onWindowClosed(window => {
127
124
  const codeWindow: CodeWindow = window as CodeWindow;
128
125
  this.windowsById.get(codeWindow.vscodeWindowId)?.dispose();
126
+ this.windowsById.delete(codeWindow.vscodeWindowId);
129
127
  });
130
128
  }
131
129
 
130
+ /**
131
+ * Theia's {@link MonacoStandaloneThemeService} override, which creates the `monaco-colors`
132
+ * stylesheet in the target node's own document. The upstream `StandaloneThemeService` would
133
+ * only ever create a single global stylesheet in the main document and silently no-op for
134
+ * nodes in other documents, so this contribution depends on the Theia override being bound
135
+ * (see `monaco-init.ts`).
136
+ */
137
+ protected get standaloneThemeService(): MonacoStandaloneThemeService {
138
+ return StandaloneServices.get(IStandaloneThemeService) as MonacoStandaloneThemeService;
139
+ }
140
+
132
141
  registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void {
133
142
  if (isHighContrast(theme.type)) {
134
143
  const focusBorder = theme.getColor('focusBorder');