@theia/core 1.56.0 → 1.57.0-next.112

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.
Files changed (117) hide show
  1. package/README.md +43 -39
  2. package/i18n/nls.cs.json +23 -17
  3. package/i18n/nls.de.json +23 -17
  4. package/i18n/nls.es.json +23 -17
  5. package/i18n/nls.fr.json +23 -17
  6. package/i18n/nls.hu.json +23 -17
  7. package/i18n/nls.it.json +23 -17
  8. package/i18n/nls.ja.json +23 -17
  9. package/i18n/nls.json +24 -18
  10. package/i18n/nls.ko.json +23 -17
  11. package/i18n/nls.pl.json +23 -17
  12. package/i18n/nls.pt-br.json +23 -17
  13. package/i18n/nls.ru.json +23 -17
  14. package/i18n/nls.tr.json +23 -17
  15. package/i18n/nls.zh-cn.json +23 -17
  16. package/i18n/nls.zh-tw.json +23 -17
  17. package/lib/browser/catalog.json +347 -46
  18. package/lib/browser/common-frontend-contribution.d.ts +1 -1
  19. package/lib/browser/common-frontend-contribution.d.ts.map +1 -1
  20. package/lib/browser/common-frontend-contribution.js +23 -8
  21. package/lib/browser/common-frontend-contribution.js.map +1 -1
  22. package/lib/browser/dialogs.d.ts +1 -0
  23. package/lib/browser/dialogs.d.ts.map +1 -1
  24. package/lib/browser/dialogs.js +6 -0
  25. package/lib/browser/dialogs.js.map +1 -1
  26. package/lib/browser/frontend-application-module.d.ts.map +1 -1
  27. package/lib/browser/frontend-application-module.js +1 -0
  28. package/lib/browser/frontend-application-module.js.map +1 -1
  29. package/lib/browser/hover-service.d.ts.map +1 -1
  30. package/lib/browser/hover-service.js +12 -4
  31. package/lib/browser/hover-service.js.map +1 -1
  32. package/lib/browser/json-schema-store.d.ts +12 -1
  33. package/lib/browser/json-schema-store.d.ts.map +1 -1
  34. package/lib/browser/json-schema-store.js +31 -1
  35. package/lib/browser/json-schema-store.js.map +1 -1
  36. package/lib/browser/keybinding.js +3 -3
  37. package/lib/browser/keybinding.js.map +1 -1
  38. package/lib/browser/progress-status-bar-item.d.ts +1 -1
  39. package/lib/browser/progress-status-bar-item.d.ts.map +1 -1
  40. package/lib/browser/saveable.d.ts +1 -0
  41. package/lib/browser/saveable.d.ts.map +1 -1
  42. package/lib/browser/saveable.js +3 -0
  43. package/lib/browser/saveable.js.map +1 -1
  44. package/lib/browser/secondary-window-handler.d.ts.map +1 -1
  45. package/lib/browser/secondary-window-handler.js +1 -0
  46. package/lib/browser/secondary-window-handler.js.map +1 -1
  47. package/lib/browser/shell/application-shell.d.ts +2 -1
  48. package/lib/browser/shell/application-shell.d.ts.map +1 -1
  49. package/lib/browser/shell/application-shell.js +24 -10
  50. package/lib/browser/shell/application-shell.js.map +1 -1
  51. package/lib/browser/test/jsdom.d.ts.map +1 -1
  52. package/lib/browser/test/jsdom.js +6 -1
  53. package/lib/browser/test/jsdom.js.map +1 -1
  54. package/lib/browser/tree/tree-widget.d.ts +6 -2
  55. package/lib/browser/tree/tree-widget.d.ts.map +1 -1
  56. package/lib/browser/tree/tree-widget.js +4 -4
  57. package/lib/browser/tree/tree-widget.js.map +1 -1
  58. package/lib/browser/window/browser-window-module.d.ts.map +1 -1
  59. package/lib/browser/window/browser-window-module.js +3 -0
  60. package/lib/browser/window/browser-window-module.js.map +1 -1
  61. package/lib/browser/window/default-secondary-window-service.d.ts +5 -0
  62. package/lib/browser/window/default-secondary-window-service.d.ts.map +1 -1
  63. package/lib/browser/window/default-secondary-window-service.js +6 -0
  64. package/lib/browser/window/default-secondary-window-service.js.map +1 -1
  65. package/lib/browser/window/secondary-window-service.d.ts +3 -0
  66. package/lib/browser/window/secondary-window-service.d.ts.map +1 -1
  67. package/lib/browser/window/secondary-window-service.js.map +1 -1
  68. package/lib/browser/window/window-title-service.d.ts +6 -0
  69. package/lib/browser/window/window-title-service.d.ts.map +1 -1
  70. package/lib/browser/window/window-title-service.js +12 -1
  71. package/lib/browser/window/window-title-service.js.map +1 -1
  72. package/lib/common/encoding-service.d.ts +1 -0
  73. package/lib/common/encoding-service.d.ts.map +1 -1
  74. package/lib/common/resource.d.ts +2 -0
  75. package/lib/common/resource.d.ts.map +1 -1
  76. package/lib/common/resource.js +1 -0
  77. package/lib/common/resource.js.map +1 -1
  78. package/lib/electron-browser/messaging/electron-local-ws-connection-source.d.ts +1 -0
  79. package/lib/electron-browser/messaging/electron-local-ws-connection-source.d.ts.map +1 -1
  80. package/lib/electron-browser/messaging/electron-local-ws-connection-source.js +7 -1
  81. package/lib/electron-browser/messaging/electron-local-ws-connection-source.js.map +1 -1
  82. package/lib/electron-browser/window/electron-window-module.d.ts.map +1 -1
  83. package/lib/electron-browser/window/electron-window-module.js +3 -0
  84. package/lib/electron-browser/window/electron-window-module.js.map +1 -1
  85. package/lib/electron-main/electron-main-application.js +12 -13
  86. package/lib/electron-main/electron-main-application.js.map +1 -1
  87. package/lib/electron-main/theia-electron-window.d.ts.map +1 -1
  88. package/lib/electron-main/theia-electron-window.js +11 -3
  89. package/lib/electron-main/theia-electron-window.js.map +1 -1
  90. package/lib/node/messaging/test/test-web-socket-channel.d.ts.map +1 -1
  91. package/lib/node/messaging/test/test-web-socket-channel.js +7 -1
  92. package/lib/node/messaging/test/test-web-socket-channel.js.map +1 -1
  93. package/lib/node/messaging/websocket-endpoint.d.ts +1 -1
  94. package/lib/node/messaging/websocket-endpoint.d.ts.map +1 -1
  95. package/package.json +12 -12
  96. package/src/browser/common-frontend-contribution.ts +23 -8
  97. package/src/browser/dialogs.ts +7 -0
  98. package/src/browser/frontend-application-module.ts +2 -1
  99. package/src/browser/hover-service.ts +12 -5
  100. package/src/browser/json-schema-store.ts +35 -1
  101. package/src/browser/keybinding.ts +3 -3
  102. package/src/browser/saveable.ts +3 -0
  103. package/src/browser/secondary-window-handler.ts +1 -0
  104. package/src/browser/shell/application-shell.ts +27 -11
  105. package/src/browser/style/dockpanel.css +10 -0
  106. package/src/browser/test/jsdom.ts +6 -1
  107. package/src/browser/tree/tree-widget.tsx +10 -4
  108. package/src/browser/window/browser-window-module.ts +3 -0
  109. package/src/browser/window/default-secondary-window-service.ts +7 -1
  110. package/src/browser/window/secondary-window-service.ts +3 -0
  111. package/src/browser/window/window-title-service.ts +14 -1
  112. package/src/common/resource.ts +4 -0
  113. package/src/electron-browser/messaging/electron-local-ws-connection-source.ts +5 -0
  114. package/src/electron-browser/window/electron-window-module.ts +3 -0
  115. package/src/electron-main/electron-main-application.ts +10 -10
  116. package/src/electron-main/theia-electron-window.ts +11 -3
  117. package/src/node/messaging/test/test-web-socket-channel.ts +6 -1
@@ -17,8 +17,9 @@
17
17
  import { injectable, inject, named } from 'inversify';
18
18
  import { ContributionProvider } from '../common/contribution-provider';
19
19
  import { FrontendApplicationContribution } from './frontend-application-contribution';
20
- import { MaybePromise } from '../common';
20
+ import { Emitter, MaybePromise, URI } from '../common';
21
21
  import { timeout, Deferred } from '../common/promise-util';
22
+ import { IJSONSchema } from '../common/json-schema';
22
23
 
23
24
  export interface JsonSchemaConfiguration {
24
25
  fileMatch: string | string[];
@@ -91,6 +92,39 @@ export class JsonSchemaStore implements FrontendApplicationContribution {
91
92
 
92
93
  }
93
94
 
95
+ @injectable()
96
+ export class JsonSchemaDataStore {
97
+
98
+ protected readonly _schemas = new Map<string, string>();
99
+
100
+ protected readonly onDidSchemaUpdateEmitter = new Emitter<URI>();
101
+ readonly onDidSchemaUpdate = this.onDidSchemaUpdateEmitter.event;
102
+
103
+ hasSchema(uri: URI): boolean {
104
+ return this._schemas.has(uri.toString());
105
+ }
106
+
107
+ getSchema(uri: URI): string | undefined {
108
+ return this._schemas.get(uri.toString());
109
+ }
110
+
111
+ setSchema(uri: URI, schema: IJSONSchema | string): void {
112
+ this._schemas.set(uri.toString(), typeof schema === 'string' ? schema : JSON.stringify(schema));
113
+ this.notifySchemaUpdate(uri);
114
+ }
115
+
116
+ deleteSchema(uri: URI): void {
117
+ if (this._schemas.delete(uri.toString())) {
118
+ this.notifySchemaUpdate(uri);
119
+ }
120
+ }
121
+
122
+ notifySchemaUpdate(uri: URI): void {
123
+ this.onDidSchemaUpdateEmitter.fire(uri);
124
+ }
125
+
126
+ }
127
+
94
128
  @injectable()
95
129
  export class DefaultJsonSchemaContribution implements JsonSchemaContribution {
96
130
  async registerSchemas(context: JsonSchemaRegisterContext): Promise<void> {
@@ -622,15 +622,15 @@ export class KeybindingRegistry {
622
622
  matchKeybinding(keySequence: KeySequence, event?: KeyboardEvent): KeybindingRegistry.Match {
623
623
  let disabled: Set<string> | undefined;
624
624
  const isEnabled = (binding: ScopedKeybinding) => {
625
- if (event && !this.isEnabled(binding, event)) {
626
- return false;
627
- }
628
625
  const { command, context, when, keybinding } = binding;
629
626
  if (!this.isUsable(binding)) {
630
627
  disabled = disabled || new Set<string>();
631
628
  disabled.add(JSON.stringify({ command: command.substring(1), context, when, keybinding }));
632
629
  return false;
633
630
  }
631
+ if (event && !this.isEnabled(binding, event)) {
632
+ return false;
633
+ }
634
634
  return !disabled?.has(JSON.stringify({ command, context, when, keybinding }));
635
635
  };
636
636
 
@@ -392,4 +392,7 @@ export class ShouldSaveDialog extends AbstractDialog<boolean> {
392
392
  return this.shouldSave;
393
393
  }
394
394
 
395
+ override async open(disposeOnResolve?: boolean): Promise<boolean | undefined> {
396
+ return super.open(disposeOnResolve);
397
+ }
395
398
  }
@@ -140,6 +140,7 @@ export class SecondaryWindowHandler {
140
140
  widget.secondaryWindow = newWindow;
141
141
  const rootWidget = new SecondaryWindowRootWidget();
142
142
  rootWidget.addClass('secondary-widget-root');
143
+ rootWidget.addClass('monaco-workbench'); // needed for compatility with VSCode styles
143
144
  Widget.attach(rootWidget, element);
144
145
  rootWidget.addWidget(widget);
145
146
  widget.show();
@@ -22,7 +22,7 @@ import {
22
22
  } from '@phosphor/widgets';
23
23
  import { Message } from '@phosphor/messaging';
24
24
  import { IDragEvent } from '@phosphor/dragdrop';
25
- import { RecursivePartial, Event as CommonEvent, DisposableCollection, Disposable, environment, isObject } from '../../common';
25
+ import { RecursivePartial, Event as CommonEvent, DisposableCollection, Disposable, environment, isObject, UntitledResourceResolver, UNTITLED_SCHEME } from '../../common';
26
26
  import { animationFrame } from '../browser';
27
27
  import { Saveable, SaveableWidget, SaveOptions } from '../saveable';
28
28
  import { StatusBarImpl, StatusBarEntry, StatusBarAlignment } from '../status-bar/status-bar';
@@ -232,6 +232,9 @@ export class ApplicationShell extends Widget {
232
232
  @inject(OpenerService)
233
233
  protected readonly openerService: OpenerService;
234
234
 
235
+ @inject(UntitledResourceResolver)
236
+ protected readonly untitledResourceResolver: UntitledResourceResolver;
237
+
235
238
  protected readonly onDidAddWidgetEmitter = new Emitter<Widget>();
236
239
  readonly onDidAddWidget = this.onDidAddWidgetEmitter.event;
237
240
  protected fireDidAddWidget(widget: Widget): void {
@@ -323,6 +326,7 @@ export class ApplicationShell extends Widget {
323
326
 
324
327
  protected initializeShell(): void {
325
328
  this.addClass(APPLICATION_SHELL_CLASS);
329
+ this.addClass('monaco-workbench'); // needed for compatility with VSCode styles
326
330
  this.id = 'theia-app-shell';
327
331
 
328
332
  this.mainPanel = this.createMainPanel();
@@ -572,16 +576,28 @@ export class ApplicationShell extends Widget {
572
576
  uris.forEach(openUri);
573
577
  } else if (event.dataTransfer.files?.length > 0) {
574
578
  // the files were dragged from the outside the workspace
575
- Array.from(event.dataTransfer.files).forEach(file => {
576
- if (file.path) {
577
- const fileUri = URI.fromComponents({
578
- scheme: 'file',
579
- path: file.path,
580
- authority: '',
581
- query: '',
582
- fragment: ''
583
- });
584
- openUri(fileUri);
579
+ Array.from(event.dataTransfer.files).forEach(async file => {
580
+ if (environment.electron.is()) {
581
+ if (file.path) {
582
+ const fileUri = URI.fromFilePath(file.path);
583
+ openUri(fileUri);
584
+ }
585
+ } else {
586
+ const fileContent = await file.text();
587
+ const fileName = file.name;
588
+ const uri = new URI(`${UNTITLED_SCHEME}:/${fileName}`);
589
+ // Only create a new untitled resource if it doesn't already exist.
590
+ // VS Code does the same thing, and there's not really a better solution,
591
+ // since we want to keep the original name of the file,
592
+ // but also to prevent duplicates of the same file.
593
+ if (!this.untitledResourceResolver.has(uri)) {
594
+ const untitledResource = await this.untitledResourceResolver.createUntitledResource(
595
+ fileContent,
596
+ undefined,
597
+ new URI(`${UNTITLED_SCHEME}:/${fileName}`)
598
+ );
599
+ openUri(untitledResource.uri);
600
+ }
585
601
  }
586
602
  });
587
603
  }
@@ -14,6 +14,16 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
+ /*
18
+ * phosphor.js sets the z-index of its panels to 0, which causes overlay issues
19
+ * See also https://github.com/eclipse-theia/theia/issues/14290
20
+ */
21
+ .p-SplitPanel-child,
22
+ .p-DockPanel,
23
+ .p-DockPanel-widget {
24
+ z-index: initial;
25
+ }
26
+
17
27
  .p-DockPanel.p-SplitPanel-child {
18
28
  padding: 0px;
19
29
  }
@@ -43,7 +43,12 @@ export function enableJSDOM(): () => void {
43
43
  });
44
44
  (global as any)['document'] = dom.window.document;
45
45
  (global as any)['window'] = dom.window;
46
- (global as any)['navigator'] = { userAgent: 'node.js', platform: 'Mac' };
46
+ try {
47
+ (global as any)['navigator'] = { userAgent: 'node.js', platform: 'Mac' };
48
+
49
+ } catch (e) {
50
+ // node 21+ already has a navigator object
51
+ }
47
52
 
48
53
  const toCleanup: string[] = [];
49
54
  Object.getOwnPropertyNames((dom.window as any)).forEach(property => {
@@ -32,7 +32,7 @@ import { notEmpty } from '../../common/objects';
32
32
  import { isOSX } from '../../common/os';
33
33
  import { ReactWidget } from '../widgets/react-widget';
34
34
  import * as React from 'react';
35
- import { Virtuoso, VirtuosoHandle } from 'react-virtuoso';
35
+ import { Virtuoso, VirtuosoHandle, VirtuosoProps } from 'react-virtuoso';
36
36
  import { TopDownTreeIterator } from './tree-iterator';
37
37
  import { SearchBox, SearchBoxFactory, SearchBoxProps } from './search-box';
38
38
  import { TreeSearch } from './tree-search';
@@ -111,6 +111,10 @@ export interface TreeProps {
111
111
  */
112
112
  readonly expandOnlyOnExpansionToggleClick?: boolean;
113
113
 
114
+ /**
115
+ * Props that are forwarded to the virtuoso list rendered. Defaults to `{}`.
116
+ */
117
+ readonly viewProps?: VirtuosoProps<unknown, unknown>;
114
118
  }
115
119
 
116
120
  /**
@@ -498,6 +502,7 @@ export class TreeWidget extends ReactWidget implements StatefulWidget {
498
502
  rows={rows}
499
503
  renderNodeRow={this.renderNodeRow}
500
504
  scrollToRow={this.scrollToRow}
505
+ {...this.props.viewProps}
501
506
  />;
502
507
  }
503
508
  // eslint-disable-next-line no-null/no-null
@@ -1546,7 +1551,7 @@ export namespace TreeWidget {
1546
1551
  /**
1547
1552
  * Representation of the tree view properties.
1548
1553
  */
1549
- export interface ViewProps {
1554
+ export interface ViewProps extends VirtuosoProps<unknown, unknown> {
1550
1555
  /**
1551
1556
  * The width property.
1552
1557
  */
@@ -1568,7 +1573,7 @@ export namespace TreeWidget {
1568
1573
  export class View extends React.Component<ViewProps> {
1569
1574
  list: VirtuosoHandle | undefined;
1570
1575
  override render(): React.ReactNode {
1571
- const { rows, width, height, scrollToRow } = this.props;
1576
+ const { rows, width, height, scrollToRow, renderNodeRow, ...other } = this.props;
1572
1577
  return <Virtuoso
1573
1578
  ref={list => {
1574
1579
  this.list = (list || undefined);
@@ -1580,11 +1585,12 @@ export namespace TreeWidget {
1580
1585
  }
1581
1586
  }}
1582
1587
  totalCount={rows.length}
1583
- itemContent={index => this.props.renderNodeRow(rows[index])}
1588
+ itemContent={index => renderNodeRow(rows[index])}
1584
1589
  width={width}
1585
1590
  height={height}
1586
1591
  // This is a pixel value, it will scan 200px to the top and bottom of the current view
1587
1592
  overscan={500}
1593
+ {...other}
1588
1594
  />;
1589
1595
  }
1590
1596
  }
@@ -22,6 +22,8 @@ import { ClipboardService } from '../clipboard-service';
22
22
  import { BrowserClipboardService } from '../browser-clipboard-service';
23
23
  import { SecondaryWindowService } from './secondary-window-service';
24
24
  import { DefaultSecondaryWindowService } from './default-secondary-window-service';
25
+ import { bindContributionProvider } from '../../common';
26
+ import { WindowTitleContribution } from './window-title-service';
25
27
 
26
28
  export default new ContainerModule(bind => {
27
29
  bind(DefaultWindowService).toSelf().inSingletonScope();
@@ -29,4 +31,5 @@ export default new ContainerModule(bind => {
29
31
  bind(FrontendApplicationContribution).toService(DefaultWindowService);
30
32
  bind(ClipboardService).to(BrowserClipboardService).inSingletonScope();
31
33
  bind(SecondaryWindowService).to(DefaultSecondaryWindowService).inSingletonScope();
34
+ bindContributionProvider(bind, WindowTitleContribution);
32
35
  });
@@ -20,11 +20,15 @@ import { ExtractableWidget } from '../widgets';
20
20
  import { ApplicationShell } from '../shell';
21
21
  import { Saveable } from '../saveable';
22
22
  import { PreferenceService } from '../preferences';
23
- import { environment } from '../../common';
23
+ import { Emitter, environment, Event } from '../../common';
24
24
  import { SaveableService } from '../saveable-service';
25
25
 
26
26
  @injectable()
27
27
  export class DefaultSecondaryWindowService implements SecondaryWindowService {
28
+ protected readonly onWindowOpenedEmitter = new Emitter<Window>;
29
+ readonly onWindowOpened: Event<Window> = this.onWindowOpenedEmitter.event;
30
+ protected readonly onWindowClosedEmitter = new Emitter<Window>;
31
+ readonly onWindowClosed: Event<Window> = this.onWindowClosedEmitter.event;
28
32
  // secondary-window.html is part of Theia's generated code. It is generated by dev-packages/application-manager/src/generator/frontend-generator.ts
29
33
  protected static SECONDARY_WINDOW_URL = 'secondary-window.html';
30
34
 
@@ -94,6 +98,7 @@ export class DefaultSecondaryWindowService implements SecondaryWindowService {
94
98
  const newWindow = window.open(DefaultSecondaryWindowService.SECONDARY_WINDOW_URL, this.nextWindowId(), options) ?? undefined;
95
99
  if (newWindow) {
96
100
  this.secondaryWindows.push(newWindow);
101
+ this.onWindowOpenedEmitter.fire(newWindow);
97
102
  newWindow.addEventListener('DOMContentLoaded', () => {
98
103
  newWindow.addEventListener('beforeunload', evt => {
99
104
  const saveable = Saveable.get(widget);
@@ -113,6 +118,7 @@ export class DefaultSecondaryWindowService implements SecondaryWindowService {
113
118
 
114
119
  const extIndex = this.secondaryWindows.indexOf(newWindow);
115
120
  if (extIndex > -1) {
121
+ this.onWindowClosedEmitter.fire(newWindow);
116
122
  this.secondaryWindows.splice(extIndex, 1);
117
123
  };
118
124
  });
@@ -14,6 +14,7 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
+ import { Event } from '../../common';
17
18
  import { ApplicationShell } from '../shell';
18
19
  import { ExtractableWidget } from '../widgets';
19
20
 
@@ -33,6 +34,8 @@ export interface SecondaryWindowService {
33
34
  * @returns the created window or `undefined` if it could not be created
34
35
  */
35
36
  createSecondaryWindow(widget: ExtractableWidget, shell: ApplicationShell): Window | undefined;
37
+ readonly onWindowOpened: Event<Window>;
38
+ readonly onWindowClosed: Event<Window>;
36
39
 
37
40
  /** Handles focussing the given secondary window in the browser and on Electron. */
38
41
  focus(win: Window): void;
@@ -14,11 +14,17 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { inject, injectable, postConstruct } from 'inversify';
17
+ import { inject, injectable, named, postConstruct } from 'inversify';
18
18
  import { escapeRegExpCharacters } from '../../common/strings';
19
19
  import { Emitter, Event } from '../../common/event';
20
20
  import { CorePreferences } from '../core-preferences';
21
21
  import { FrontendApplicationConfigProvider } from '../frontend-application-config-provider';
22
+ import { ContributionProvider } from '../../common';
23
+
24
+ export const WindowTitleContribution = Symbol('WindowTitleAddOnContribution');
25
+ export interface WindowTitleContribution {
26
+ enhanceTitle(title: string, parts: Map<string, string | undefined>): string;
27
+ }
22
28
 
23
29
  export const InitialWindowTitleParts = {
24
30
  activeEditorShort: undefined,
@@ -43,6 +49,9 @@ export class WindowTitleService {
43
49
  @inject(CorePreferences)
44
50
  protected readonly preferences: CorePreferences;
45
51
 
52
+ @inject(ContributionProvider) @named(WindowTitleContribution)
53
+ protected readonly titleContributions: ContributionProvider<WindowTitleContribution>;
54
+
46
55
  protected _title = '';
47
56
  protected titleTemplate?: string;
48
57
 
@@ -95,6 +104,10 @@ export class WindowTitleService {
95
104
  }
96
105
  const separatedTitle = title.split('${separator}').filter(e => e.trim().length > 0);
97
106
  this._title = separatedTitle.join(this.separator);
107
+ const contributions = this.titleContributions.getContributions();
108
+ for (const contribution of contributions) {
109
+ this._title = contribution.enhanceTitle(this.title, this.titleParts);
110
+ }
98
111
  }
99
112
  const developmentHost = this.titleParts.get('developmentHost');
100
113
  if (developmentHost) {
@@ -60,6 +60,8 @@ export interface Resource extends Disposable {
60
60
  readonly onDidChangeReadOnly?: Event<boolean | MarkdownString>;
61
61
 
62
62
  readonly readOnly?: boolean | MarkdownString;
63
+
64
+ readonly initiallyDirty?: boolean;
63
65
  /**
64
66
  * Reads latest content of this resource.
65
67
  *
@@ -378,11 +380,13 @@ export class UntitledResourceResolver implements ResourceResolver {
378
380
  export class UntitledResource implements Resource {
379
381
 
380
382
  protected readonly onDidChangeContentsEmitter = new Emitter<void>();
383
+ initiallyDirty: boolean;
381
384
  get onDidChangeContents(): Event<void> {
382
385
  return this.onDidChangeContentsEmitter.event;
383
386
  }
384
387
 
385
388
  constructor(private resources: Map<string, UntitledResource>, public uri: URI, private content?: string) {
389
+ this.initiallyDirty = (content !== undefined && content.length > 0);
386
390
  this.resources.set(this.uri.toString(), this);
387
391
  }
388
392
 
@@ -23,6 +23,11 @@ export function getLocalPort(): string | undefined {
23
23
  return params.get('localPort') ?? undefined;
24
24
  }
25
25
 
26
+ export function getCurrentPort(): string | undefined {
27
+ const params = new URLSearchParams(location.search);
28
+ return params.get('port') ?? undefined;
29
+ }
30
+
26
31
  @injectable()
27
32
  export class ElectronLocalWebSocketConnectionSource extends WebSocketConnectionSource {
28
33
 
@@ -30,6 +30,8 @@ import { bindWindowPreferences } from './electron-window-preferences';
30
30
  import { ElectronWindowService } from './electron-window-service';
31
31
  import { ExternalAppOpenHandler } from './external-app-open-handler';
32
32
  import { ElectronUriHandlerContribution } from '../electron-uri-handler';
33
+ import { bindContributionProvider } from '../../common';
34
+ import { WindowTitleContribution } from '../../browser/window/window-title-service';
33
35
 
34
36
  export default new ContainerModule((bind, unbind, isBound, rebind) => {
35
37
  bind(ElectronMainWindowService).toDynamicValue(context =>
@@ -45,4 +47,5 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
45
47
  bind(SecondaryWindowService).to(ElectronSecondaryWindowService).inSingletonScope();
46
48
  bind(ExternalAppOpenHandler).toSelf().inSingletonScope();
47
49
  bind(OpenHandler).toService(ExternalAppOpenHandler);
50
+ bindContributionProvider(bind, WindowTitleContribution);
48
51
  });
@@ -396,7 +396,7 @@ export class ElectronMainApplication {
396
396
  }
397
397
 
398
398
  protected isShowSplashScreen(): boolean {
399
- return typeof this.config.electron.splashScreenOptions === 'object' && !!this.config.electron.splashScreenOptions.content;
399
+ return !process.env.THEIA_NO_SPLASH && typeof this.config.electron.splashScreenOptions === 'object' && !!this.config.electron.splashScreenOptions.content;
400
400
  }
401
401
 
402
402
  protected getSplashScreenOptions(): ElectronFrontendApplicationConfig.SplashScreenOptions | undefined {
@@ -522,21 +522,21 @@ export class ElectronMainApplication {
522
522
  }
523
523
 
524
524
  protected async handleMainCommand(options: ElectronMainCommandOptions): Promise<void> {
525
- if (options.secondInstance === false) {
526
- await this.openWindowWithWorkspace(''); // restore previous workspace.
527
- } else if (options.file === undefined) {
528
- await this.openDefaultWindow();
529
- } else {
530
- let workspacePath: string | undefined;
525
+ let workspacePath: string | undefined;
526
+ if (options.file) {
531
527
  try {
532
528
  workspacePath = await fs.realpath(path.resolve(options.cwd, options.file));
533
529
  } catch {
534
530
  console.error(`Could not resolve the workspace path. "${options.file}" is not a valid 'file' option. Falling back to the default workspace location.`);
535
531
  }
536
- if (workspacePath === undefined) {
532
+ }
533
+ if (workspacePath !== undefined) {
534
+ await this.openWindowWithWorkspace(workspacePath);
535
+ } else {
536
+ if (options.secondInstance === false) {
537
+ await this.openWindowWithWorkspace(''); // restore previous workspace.
538
+ } else if (options.file === undefined) {
537
539
  await this.openDefaultWindow();
538
- } else {
539
- await this.openWindowWithWorkspace(workspacePath);
540
540
  }
541
541
  }
542
542
  }
@@ -186,10 +186,18 @@ export class TheiaElectronWindow {
186
186
  }
187
187
 
188
188
  protected restoreMaximizedState(): void {
189
- if (this.options.isMaximized) {
190
- this._window.maximize();
189
+ const restore = () => {
190
+ if (this.options.isMaximized) {
191
+ this._window.maximize();
192
+ } else {
193
+ this._window.unmaximize();
194
+ }
195
+ };
196
+
197
+ if (this._window.isVisible()) {
198
+ restore();
191
199
  } else {
192
- this._window.unmaximize();
200
+ this._window.once('show', () => restore());
193
201
  }
194
202
  }
195
203
 
@@ -47,7 +47,12 @@ export class TestWebSocketChannelSetup {
47
47
  path: string
48
48
  }) {
49
49
  const address = (server.address() as AddressInfo);
50
- const url = `ws://${address.address}:${address.port}${servicesPath}`;
50
+ let url;
51
+ if (address.family === 'IPv6') {
52
+ url = `ws://[${address.address}]:${address.port}${servicesPath}`;
53
+ } else {
54
+ url = `ws://${address.address}:${address.port}${servicesPath}`;
55
+ }
51
56
  this.connectionProvider = this.createConnectionProvider(url);
52
57
  }
53
58