@theia/core 1.54.0 → 1.55.0-next.25

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 (37) hide show
  1. package/README.md +9 -9
  2. package/lib/browser/catalog.json +158 -49
  3. package/lib/browser/frontend-application-module.d.ts.map +1 -1
  4. package/lib/browser/frontend-application-module.js +4 -0
  5. package/lib/browser/frontend-application-module.js.map +1 -1
  6. package/lib/browser/index.d.ts +1 -0
  7. package/lib/browser/index.d.ts.map +1 -1
  8. package/lib/browser/index.js +1 -0
  9. package/lib/browser/index.js.map +1 -1
  10. package/lib/browser/open-with-service.d.ts.map +1 -1
  11. package/lib/browser/open-with-service.js +4 -0
  12. package/lib/browser/open-with-service.js.map +1 -1
  13. package/lib/browser/widget-status-bar-service.d.ts +29 -0
  14. package/lib/browser/widget-status-bar-service.d.ts.map +1 -0
  15. package/lib/browser/widget-status-bar-service.js +81 -0
  16. package/lib/browser/widget-status-bar-service.js.map +1 -0
  17. package/lib/browser/widgets/split-widget.d.ts +2 -3
  18. package/lib/browser/widgets/split-widget.d.ts.map +1 -1
  19. package/lib/browser/widgets/split-widget.js +2 -2
  20. package/lib/browser/widgets/split-widget.js.map +1 -1
  21. package/lib/electron-browser/preload.js +2 -2
  22. package/lib/node/logger-cli-contribution.d.ts.map +1 -1
  23. package/lib/node/logger-cli-contribution.js +10 -8
  24. package/lib/node/logger-cli-contribution.js.map +1 -1
  25. package/package.json +6 -6
  26. package/shared/@parcel/watcher/index.d.ts +2 -0
  27. package/shared/@parcel/watcher/index.js +1 -0
  28. package/src/browser/frontend-application-module.ts +5 -0
  29. package/src/browser/index.ts +1 -0
  30. package/src/browser/open-with-service.ts +4 -0
  31. package/src/browser/style/tabs.css +55 -138
  32. package/src/browser/widget-status-bar-service.ts +84 -0
  33. package/src/browser/widgets/split-widget.ts +1 -2
  34. package/src/electron-browser/preload.ts +2 -2
  35. package/src/node/logger-cli-contribution.ts +10 -8
  36. package/shared/nsfw/index.d.ts +0 -2
  37. package/shared/nsfw/index.js +0 -1
@@ -0,0 +1,84 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2024 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
+ import { inject, injectable, named } from 'inversify';
18
+ import { Widget } from './widgets';
19
+ import { StatusBar } from './status-bar';
20
+ import { FrontendApplicationContribution } from './frontend-application-contribution';
21
+ import { ContributionProvider } from '../common';
22
+ import { FrontendApplication } from './frontend-application';
23
+
24
+ export const WidgetStatusBarContribution = Symbol('WidgetStatusBarContribution');
25
+
26
+ export interface WidgetStatusBarContribution<T extends Widget> {
27
+ canHandle(widget: Widget): widget is T;
28
+ activate(statusBar: StatusBar, widget: T): void;
29
+ deactivate(statusBar: StatusBar): void;
30
+ }
31
+
32
+ /**
33
+ * Creates an empty {@link WidgetStatusBarContribution} that does nothing.
34
+ * Useful for widgets that are not handled by any other contribution, for example:
35
+ * * Settings widget
36
+ * * Welcome widget
37
+ * * Webview widget
38
+ *
39
+ * @param prototype Prototype to identify the kind of the widget.
40
+ * @returns An empty {@link WidgetStatusBarContribution}.
41
+ */
42
+ export function noopWidgetStatusBarContribution(prototype: Function): WidgetStatusBarContribution<Widget> {
43
+ return {
44
+ canHandle(widget: Widget): widget is Widget {
45
+ return widget instanceof prototype;
46
+ },
47
+ activate: () => { },
48
+ deactivate: () => { }
49
+ };
50
+ }
51
+
52
+ @injectable()
53
+ export class WidgetStatusBarService implements FrontendApplicationContribution {
54
+
55
+ @inject(ContributionProvider) @named(WidgetStatusBarContribution)
56
+ protected readonly contributionProvider: ContributionProvider<WidgetStatusBarContribution<Widget>>;
57
+
58
+ @inject(StatusBar)
59
+ protected readonly statusBar: StatusBar;
60
+
61
+ onStart(app: FrontendApplication): void {
62
+ app.shell.onDidChangeCurrentWidget(event => {
63
+ if (event.newValue) {
64
+ this.show(event.newValue);
65
+ }
66
+ });
67
+ }
68
+
69
+ protected show(widget: Widget): void {
70
+ const contributions = this.contributionProvider.getContributions();
71
+ // If any contribution can handle the widget, activate it
72
+ // If none can, keep everything as is
73
+ if (contributions.some(contribution => contribution.canHandle(widget))) {
74
+ for (const contribution of contributions) {
75
+ // Deactivate all contributions
76
+ contribution.deactivate(this.statusBar);
77
+ if (contribution.canHandle(widget)) {
78
+ // Selectively re-activate them
79
+ contribution.activate(this.statusBar, widget);
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
@@ -14,12 +14,11 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { Emitter } from 'vscode-languageserver-protocol';
18
17
  import { ApplicationShell, StatefulWidget } from '../shell';
19
18
  import { BaseWidget, Message, PanelLayout, SplitPanel, Widget } from './widget';
20
19
  import { CompositeSaveable, Saveable, SaveableSource } from '../saveable';
21
20
  import { Navigatable } from '../navigatable-types';
22
- import { URI } from '../../common';
21
+ import { Emitter, URI } from '../../common';
23
22
 
24
23
  /**
25
24
  * A widget containing a number of panes in a split layout.
@@ -35,8 +35,8 @@ const { ipcRenderer, contextBridge } = require('electron');
35
35
 
36
36
  // a map of menuId => map<handler id => handler>
37
37
  const commandHandlers = new Map<number, Map<number, () => void>>();
38
- let nextHandlerId = 0;
39
- const mainMenuId = 0;
38
+ let nextHandlerId = 1;
39
+ const mainMenuId = 1;
40
40
  let nextMenuId = mainMenuId + 1;
41
41
 
42
42
  let openUrlHandler: ((url: string) => Promise<boolean>) | undefined;
@@ -19,7 +19,7 @@ import { injectable } from 'inversify';
19
19
  import { LogLevel } from '../common/logger';
20
20
  import { CliContribution } from './cli';
21
21
  import * as fs from 'fs-extra';
22
- import * as nsfw from 'nsfw';
22
+ import { subscribe } from '@parcel/watcher';
23
23
  import { Event, Emitter } from '../common/event';
24
24
  import * as path from 'path';
25
25
 
@@ -89,13 +89,17 @@ export class LogLevelCliContribution implements CliContribution {
89
89
  }
90
90
  }
91
91
 
92
- protected watchLogConfigFile(filename: string): Promise<void> {
93
- return nsfw(filename, async (events: nsfw.FileChangeEvent[]) => {
92
+ protected async watchLogConfigFile(filename: string): Promise<void> {
93
+ await subscribe(filename, async (err, events) => {
94
+ if (err) {
95
+ console.log(`Error during log file watching ${filename}: ${err}`);
96
+ return;
97
+ }
94
98
  try {
95
99
  for (const event of events) {
96
- switch (event.action) {
97
- case nsfw.actions.CREATED:
98
- case nsfw.actions.MODIFIED:
100
+ switch (event.type) {
101
+ case 'create':
102
+ case 'update':
99
103
  await this.slurpLogConfigFile(filename);
100
104
  this.logConfigChangedEvent.fire(undefined);
101
105
  break;
@@ -104,8 +108,6 @@ export class LogLevelCliContribution implements CliContribution {
104
108
  } catch (e) {
105
109
  console.error(`Error reading log config file ${filename}: ${e}`);
106
110
  }
107
- }).then((watcher: nsfw.NSFW) => {
108
- watcher.start();
109
111
  });
110
112
  }
111
113
 
@@ -1,2 +0,0 @@
1
- import nsfw = require('nsfw');
2
- export = nsfw;
@@ -1 +0,0 @@
1
- module.exports = require('nsfw');