@theia/core 1.43.0 → 1.44.0

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 (88) hide show
  1. package/README.md +6 -6
  2. package/lib/browser/common-frontend-contribution.d.ts +4 -0
  3. package/lib/browser/common-frontend-contribution.d.ts.map +1 -1
  4. package/lib/browser/common-frontend-contribution.js +16 -1
  5. package/lib/browser/common-frontend-contribution.js.map +1 -1
  6. package/lib/browser/frontend-application-module.d.ts.map +1 -1
  7. package/lib/browser/frontend-application-module.js +3 -0
  8. package/lib/browser/frontend-application-module.js.map +1 -1
  9. package/lib/browser/icon-theme-contribution.d.ts +1 -0
  10. package/lib/browser/icon-theme-contribution.d.ts.map +1 -1
  11. package/lib/browser/icon-theme-contribution.js +1 -0
  12. package/lib/browser/icon-theme-contribution.js.map +1 -1
  13. package/lib/browser/icon-theme-service.d.ts +1 -0
  14. package/lib/browser/icon-theme-service.d.ts.map +1 -1
  15. package/lib/browser/icon-theme-service.js.map +1 -1
  16. package/lib/browser/language-icon-provider.d.ts +15 -0
  17. package/lib/browser/language-icon-provider.d.ts.map +1 -0
  18. package/lib/browser/language-icon-provider.js +74 -0
  19. package/lib/browser/language-icon-provider.js.map +1 -0
  20. package/lib/browser/language-service.d.ts +22 -0
  21. package/lib/browser/language-service.d.ts.map +1 -1
  22. package/lib/browser/language-service.js +28 -0
  23. package/lib/browser/language-service.js.map +1 -1
  24. package/lib/browser/messaging/ws-connection-provider.js +1 -1
  25. package/lib/browser/messaging/ws-connection-provider.js.map +1 -1
  26. package/lib/common/contribution-filter/contribution-filter.d.ts +9 -0
  27. package/lib/common/contribution-filter/contribution-filter.d.ts.map +1 -1
  28. package/lib/common/event.js +1 -1
  29. package/lib/common/event.js.map +1 -1
  30. package/lib/common/nls.js +12 -1
  31. package/lib/common/nls.js.map +1 -1
  32. package/lib/electron-browser/preload.d.ts.map +1 -1
  33. package/lib/electron-browser/preload.js +1 -0
  34. package/lib/electron-browser/preload.js.map +1 -1
  35. package/lib/electron-browser/window/electron-secondary-window-service.d.ts +1 -1
  36. package/lib/electron-browser/window/electron-secondary-window-service.d.ts.map +1 -1
  37. package/lib/electron-browser/window/electron-window-preferences.js +1 -1
  38. package/lib/electron-browser/window/electron-window-preferences.js.map +1 -1
  39. package/lib/electron-common/electron-api.d.ts +1 -0
  40. package/lib/electron-common/electron-api.d.ts.map +1 -1
  41. package/lib/electron-common/electron-api.js.map +1 -1
  42. package/lib/electron-main/electron-main-application.d.ts +2 -0
  43. package/lib/electron-main/electron-main-application.d.ts.map +1 -1
  44. package/lib/electron-main/electron-main-application.js +26 -4
  45. package/lib/electron-main/electron-main-application.js.map +1 -1
  46. package/lib/node/backend-application.d.ts +2 -0
  47. package/lib/node/backend-application.d.ts.map +1 -1
  48. package/lib/node/backend-application.js +11 -9
  49. package/lib/node/backend-application.js.map +1 -1
  50. package/lib/node/cli.d.ts +1 -1
  51. package/lib/node/cli.d.ts.map +1 -1
  52. package/lib/node/cli.js +9 -5
  53. package/lib/node/cli.js.map +1 -1
  54. package/lib/node/cli.spec.js +3 -3
  55. package/lib/node/cli.spec.js.map +1 -1
  56. package/lib/node/env-variables/env-variables-server.d.ts +3 -0
  57. package/lib/node/env-variables/env-variables-server.d.ts.map +1 -1
  58. package/lib/node/env-variables/env-variables-server.js +25 -1
  59. package/lib/node/env-variables/env-variables-server.js.map +1 -1
  60. package/lib/node/i18n/localization-server.d.ts +1 -1
  61. package/lib/node/i18n/localization-server.d.ts.map +1 -1
  62. package/lib/node/messaging/ipc-protocol.js +1 -1
  63. package/lib/node/messaging/ipc-protocol.js.map +1 -1
  64. package/package.json +6 -6
  65. package/src/browser/common-frontend-contribution.ts +15 -0
  66. package/src/browser/frontend-application-module.ts +3 -0
  67. package/src/browser/icon-theme-contribution.ts +1 -0
  68. package/src/browser/icon-theme-service.ts +1 -0
  69. package/src/browser/language-icon-provider.ts +55 -0
  70. package/src/browser/language-service.ts +34 -0
  71. package/src/browser/messaging/ws-connection-provider.ts +1 -1
  72. package/src/browser/style/index.css +1 -0
  73. package/src/browser/style/os.css +87 -0
  74. package/src/common/contribution-filter/contribution-filter.ts +9 -0
  75. package/src/common/event.ts +1 -1
  76. package/src/common/i18n/nls.metadata.json +7143 -6953
  77. package/src/common/nls.ts +12 -1
  78. package/src/electron-browser/preload.ts +1 -0
  79. package/src/electron-browser/window/electron-secondary-window-service.ts +1 -1
  80. package/src/electron-browser/window/electron-window-preferences.ts +1 -1
  81. package/src/electron-common/electron-api.ts +1 -0
  82. package/src/electron-main/electron-main-application.ts +28 -5
  83. package/src/node/backend-application.ts +14 -11
  84. package/src/node/cli.spec.ts +3 -3
  85. package/src/node/cli.ts +9 -5
  86. package/src/node/env-variables/env-variables-server.ts +21 -1
  87. package/src/node/i18n/localization-server.ts +1 -1
  88. package/src/node/messaging/ipc-protocol.ts +1 -1
@@ -138,6 +138,7 @@ import { StylingParticipant, StylingService } from './styling-service';
138
138
  import { bindCommonStylingParticipants } from './common-styling-participants';
139
139
  import { HoverService } from './hover-service';
140
140
  import { AdditionalViewsMenuWidget, AdditionalViewsMenuWidgetFactory } from './shell/additional-views-menu-widget';
141
+ import { LanguageIconLabelProvider } from './language-icon-provider';
141
142
 
142
143
  export { bindResourceProvider, bindMessageService, bindPreferenceService };
143
144
 
@@ -150,6 +151,8 @@ export const frontendApplicationModule = new ContainerModule((bind, _unbind, _is
150
151
  bind(IconThemeContribution).toService(DefaultFileIconThemeContribution);
151
152
  bind(IconThemeApplicationContribution).toSelf().inSingletonScope();
152
153
  bind(FrontendApplicationContribution).toService(IconThemeApplicationContribution);
154
+ bind(LanguageIconLabelProvider).toSelf().inSingletonScope();
155
+ bind(LabelProviderContribution).toService(LanguageIconLabelProvider);
153
156
 
154
157
  bind(ColorRegistry).toSelf().inSingletonScope();
155
158
  bindContributionProvider(bind, ColorContribution);
@@ -50,6 +50,7 @@ export class DefaultFileIconThemeContribution implements IconTheme, IconThemeCon
50
50
  readonly label = 'File Icons (Theia)';
51
51
  readonly hasFileIcons = true;
52
52
  readonly hasFolderIcons = true;
53
+ readonly showLanguageModeIcons = true;
53
54
 
54
55
  registerIconThemes(iconThemes: IconThemeService): MaybePromise<void> {
55
56
  iconThemes.register(this);
@@ -31,6 +31,7 @@ export interface IconThemeDefinition {
31
31
  readonly hasFileIcons?: boolean;
32
32
  readonly hasFolderIcons?: boolean;
33
33
  readonly hidesExplorerArrows?: boolean;
34
+ readonly showLanguageModeIcons?: boolean;
34
35
  }
35
36
 
36
37
  export interface IconTheme extends IconThemeDefinition {
@@ -0,0 +1,55 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 EclipseSource and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { inject, injectable, postConstruct } from 'inversify';
18
+ import { Emitter, Event } from '../common';
19
+ import { IconThemeService } from './icon-theme-service';
20
+ import { DidChangeLabelEvent, LabelProviderContribution } from './label-provider';
21
+ import { LanguageService } from './language-service';
22
+
23
+ @injectable()
24
+ export class LanguageIconLabelProvider implements LabelProviderContribution {
25
+ @inject(IconThemeService) protected readonly iconThemeService: IconThemeService;
26
+ @inject(LanguageService) protected readonly languageService: LanguageService;
27
+
28
+ protected readonly onDidChangeEmitter = new Emitter<DidChangeLabelEvent>();
29
+
30
+ @postConstruct()
31
+ protected init(): void {
32
+ this.languageService.onDidChangeIcon(() => this.fireDidChange());
33
+ }
34
+
35
+ canHandle(element: object): number {
36
+ const current = this.iconThemeService.getDefinition(this.iconThemeService.current);
37
+ return current?.showLanguageModeIcons === true && this.languageService.getIcon(element) ? Number.MAX_SAFE_INTEGER : 0;
38
+ }
39
+
40
+ getIcon(element: object): string | undefined {
41
+ const language = this.languageService.detectLanguage(element);
42
+ return this.languageService.getIcon(language!.id);
43
+ }
44
+
45
+ get onDidChange(): Event<DidChangeLabelEvent> {
46
+ return this.onDidChangeEmitter.event;
47
+ }
48
+
49
+ protected fireDidChange(): void {
50
+ this.onDidChangeEmitter.fire({
51
+ affects: element => this.canHandle(element) > 0
52
+ });
53
+ }
54
+
55
+ }
@@ -15,16 +15,19 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { injectable } from 'inversify';
18
+ import { Disposable, Emitter, Event } from '../common';
18
19
 
19
20
  export interface Language {
20
21
  readonly id: string;
21
22
  readonly name: string;
22
23
  readonly extensions: Set<string>;
23
24
  readonly filenames: Set<string>;
25
+ readonly iconClass?: string;
24
26
  }
25
27
 
26
28
  @injectable()
27
29
  export class LanguageService {
30
+ protected readonly onDidChangeIconEmitter = new Emitter<DidChangeIconEvent>();
28
31
 
29
32
  /**
30
33
  * It should be implemented by an extension, e.g. by the monaco extension.
@@ -40,4 +43,35 @@ export class LanguageService {
40
43
  return undefined;
41
44
  }
42
45
 
46
+ /**
47
+ * It should be implemented by an extension, e.g. by the monaco extension.
48
+ */
49
+ detectLanguage(obj: unknown): Language | undefined {
50
+ return undefined;
51
+ }
52
+
53
+ /**
54
+ * It should be implemented by an extension, e.g. by the monaco extension.
55
+ */
56
+ registerIcon(languageId: string, iconClass: string): Disposable {
57
+ return Disposable.NULL;
58
+ }
59
+
60
+ /**
61
+ * It should be implemented by an extension, e.g. by the monaco extension.
62
+ */
63
+ getIcon(obj: unknown): string | undefined {
64
+ return undefined;
65
+ }
66
+
67
+ /**
68
+ * Emit when the icon of a particular language was changed.
69
+ */
70
+ get onDidChangeIcon(): Event<DidChangeIconEvent> {
71
+ return this.onDidChangeIconEmitter.event;
72
+ }
73
+ }
74
+
75
+ export interface DidChangeIconEvent {
76
+ languageId: string;
43
77
  }
@@ -119,7 +119,7 @@ export class WebSocketConnectionProvider extends AbstractConnectionProvider<WebS
119
119
  protected createWebSocketUrl(path: string): string {
120
120
  // Since we are using Socket.io, the path should look like the following:
121
121
  // proto://domain.com/{path}
122
- return this.createEndpoint(path).getWebSocketUrl().toString();
122
+ return this.createEndpoint(path).getWebSocketUrl().withPath(path).toString();
123
123
  }
124
124
 
125
125
  protected createHttpWebSocketUrl(path: string): string {
@@ -322,6 +322,7 @@ button.secondary[disabled],
322
322
  | Import children style files
323
323
  |----------------------------------------------------------------------------*/
324
324
 
325
+ @import "./os.css";
325
326
  @import "./dockpanel.css";
326
327
  @import "./dialog.css";
327
328
  @import "./menus.css";
@@ -0,0 +1,87 @@
1
+ /********************************************************************************
2
+ * Copyright (C) 2019 TypeFox and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ .mac {
18
+ --theia-ui-font-family: -apple-system,BlinkMacSystemFont,sans-serif
19
+ }
20
+
21
+ .mac:lang(zh-Hans) {
22
+ --theia-ui-font-family: -apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,sans-serif
23
+ }
24
+
25
+ .mac:lang(zh-Hant) {
26
+ --theia-ui-font-family: -apple-system,BlinkMacSystemFont,PingFang TC,sans-serif
27
+ }
28
+
29
+ .mac:lang(ja) {
30
+ --theia-ui-font-family: -apple-system,BlinkMacSystemFont,Hiragino Kaku Gothic Pro,sans-serif
31
+ }
32
+
33
+ .mac:lang(ko) {
34
+ --theia-ui-font-family: -apple-system,BlinkMacSystemFont,Nanum Gothic,Apple SD Gothic Neo,AppleGothic,sans-serif
35
+ }
36
+
37
+ .windows {
38
+ --theia-ui-font-family: Segoe WPC,Segoe UI,sans-serif
39
+ }
40
+
41
+ .windows:lang(zh-Hans) {
42
+ --theia-ui-font-family: Segoe WPC,Segoe UI,Microsoft YaHei,sans-serif
43
+ }
44
+
45
+ .windows:lang(zh-Hant) {
46
+ --theia-ui-font-family: Segoe WPC,Segoe UI,Microsoft Jhenghei,sans-serif
47
+ }
48
+
49
+ .windows:lang(ja) {
50
+ --theia-ui-font-family: Segoe WPC,Segoe UI,Yu Gothic UI,Meiryo UI,sans-serif
51
+ }
52
+
53
+ .windows:lang(ko) {
54
+ --theia-ui-font-family: Segoe WPC,Segoe UI,Malgun Gothic,Dotom,sans-serif
55
+ }
56
+
57
+ .linux {
58
+ --theia-ui-font-family: system-ui,Ubuntu,Droid Sans,sans-serif
59
+ }
60
+
61
+ .linux:lang(zh-Hans) {
62
+ --theia-ui-font-family: system-ui,Ubuntu,Droid Sans,Source Han Sans SC,Source Han Sans CN,Source Han Sans,sans-serif
63
+ }
64
+
65
+ .linux:lang(zh-Hant) {
66
+ --theia-ui-font-family: system-ui,Ubuntu,Droid Sans,Source Han Sans TC,Source Han Sans TW,Source Han Sans,sans-serif
67
+ }
68
+
69
+ .linux:lang(ja) {
70
+ --theia-ui-font-family: system-ui,Ubuntu,Droid Sans,Source Han Sans J,Source Han Sans JP,Source Han Sans,sans-serif
71
+ }
72
+
73
+ .linux:lang(ko) {
74
+ --theia-ui-font-family: system-ui,Ubuntu,Droid Sans,Source Han Sans K,Source Han Sans JR,Source Han Sans,UnDotum,FBaekmuk Gulim,sans-serif
75
+ }
76
+
77
+ .mac {
78
+ --monaco-monospace-font: "SF Mono",Monaco,Menlo,Courier,monospace
79
+ }
80
+
81
+ .windows {
82
+ --monaco-monospace-font: Consolas,"Courier New",monospace
83
+ }
84
+
85
+ .linux {
86
+ --monaco-monospace-font: "Ubuntu Mono","Liberation Mono","DejaVu Sans Mono","Courier New",monospace
87
+ }
@@ -50,6 +50,15 @@ export const FilterContribution = Symbol('FilterContribution');
50
50
  export interface FilterContribution {
51
51
  /**
52
52
  * Use the registry to register your contribution filters.
53
+ * * Note that filtering contributions based on their class (constructor) name is discouraged.
54
+ * Class names are minified in production builds and therefore not reliable.
55
+ * Use instance of checks or direct constructor comparison instead:
56
+ *
57
+ * ```ts
58
+ * registry.addFilters('*', [
59
+ * contrib => !(contrib instanceof SampleFilteredCommandContribution)
60
+ * ]);
61
+ * ```
53
62
  */
54
63
  registerContributionFilters(registry: ContributionFilterRegistry): void;
55
64
  }
@@ -456,7 +456,7 @@ export class AsyncEmitter<T extends WaitUntilEvent> extends Emitter<T> {
456
456
  delete (asyncEvent as any)['waitUntil'];
457
457
  }
458
458
  if (!waitables.length) {
459
- return;
459
+ continue;
460
460
  }
461
461
  try {
462
462
  await Promise.all(waitables);