@theia/core 1.77.0-next.57 → 1.77.0-next.63

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 (65) hide show
  1. package/lib/browser/keybinding.spec.js +15 -0
  2. package/lib/browser/keybinding.spec.js.map +1 -1
  3. package/lib/browser/keyboard/keyboard-layout-service.d.ts.map +1 -1
  4. package/lib/browser/keyboard/keyboard-layout-service.js +4 -0
  5. package/lib/browser/keyboard/keyboard-layout-service.js.map +1 -1
  6. package/lib/browser/keyboard/keyboard-layout-service.spec.js +29 -0
  7. package/lib/browser/keyboard/keyboard-layout-service.spec.js.map +1 -1
  8. package/lib/browser/tree/tree-compression/compressed-tree-model.d.ts +2 -0
  9. package/lib/browser/tree/tree-compression/compressed-tree-model.d.ts.map +1 -1
  10. package/lib/browser/tree/tree-compression/compressed-tree-model.js +6 -2
  11. package/lib/browser/tree/tree-compression/compressed-tree-model.js.map +1 -1
  12. package/lib/browser/tree/tree-compression/compressed-tree-model.spec.d.ts +2 -0
  13. package/lib/browser/tree/tree-compression/compressed-tree-model.spec.d.ts.map +1 -0
  14. package/lib/browser/tree/tree-compression/compressed-tree-model.spec.js +52 -0
  15. package/lib/browser/tree/tree-compression/compressed-tree-model.spec.js.map +1 -0
  16. package/lib/browser/tree/tree-widget.d.ts.map +1 -1
  17. package/lib/browser/tree/tree-widget.js +2 -3
  18. package/lib/browser/tree/tree-widget.js.map +1 -1
  19. package/lib/browser/tree/tree-widget.spec.js +18 -0
  20. package/lib/browser/tree/tree-widget.spec.js.map +1 -1
  21. package/lib/browser/view-container.d.ts.map +1 -1
  22. package/lib/browser/view-container.js +2 -1
  23. package/lib/browser/view-container.js.map +1 -1
  24. package/lib/common/promise-util.d.ts.map +1 -1
  25. package/lib/common/promise-util.js +5 -2
  26. package/lib/common/promise-util.js.map +1 -1
  27. package/lib/common/promise-util.spec.js +15 -0
  28. package/lib/common/promise-util.spec.js.map +1 -1
  29. package/lib/node/backend-application.d.ts +10 -4
  30. package/lib/node/backend-application.d.ts.map +1 -1
  31. package/lib/node/backend-application.js +27 -5
  32. package/lib/node/backend-application.js.map +1 -1
  33. package/lib/node/backend-application.spec.js +51 -2
  34. package/lib/node/backend-application.spec.js.map +1 -1
  35. package/lib/node/process-utils.d.ts +61 -0
  36. package/lib/node/process-utils.d.ts.map +1 -1
  37. package/lib/node/process-utils.js +156 -3
  38. package/lib/node/process-utils.js.map +1 -1
  39. package/lib/node/process-utils.slow-spec.d.ts +2 -0
  40. package/lib/node/process-utils.slow-spec.d.ts.map +1 -0
  41. package/lib/node/process-utils.slow-spec.js +106 -0
  42. package/lib/node/process-utils.slow-spec.js.map +1 -0
  43. package/lib/node/process-utils.spec.js +137 -0
  44. package/lib/node/process-utils.spec.js.map +1 -1
  45. package/lib/node/test/exiting-backend.d.ts +18 -0
  46. package/lib/node/test/exiting-backend.d.ts.map +1 -0
  47. package/lib/node/test/exiting-backend.js +71 -0
  48. package/lib/node/test/exiting-backend.js.map +1 -0
  49. package/package.json +4 -4
  50. package/src/browser/keybinding.spec.ts +17 -0
  51. package/src/browser/keyboard/keyboard-layout-service.spec.ts +33 -0
  52. package/src/browser/keyboard/keyboard-layout-service.ts +4 -0
  53. package/src/browser/tree/tree-compression/compressed-tree-model.spec.ts +57 -0
  54. package/src/browser/tree/tree-compression/compressed-tree-model.ts +11 -2
  55. package/src/browser/tree/tree-widget.spec.tsx +20 -0
  56. package/src/browser/tree/tree-widget.tsx +2 -3
  57. package/src/browser/view-container.ts +2 -1
  58. package/src/common/promise-util.spec.ts +18 -2
  59. package/src/common/promise-util.ts +5 -2
  60. package/src/node/backend-application.spec.ts +68 -2
  61. package/src/node/backend-application.ts +27 -5
  62. package/src/node/process-utils.slow-spec.ts +122 -0
  63. package/src/node/process-utils.spec.ts +162 -0
  64. package/src/node/process-utils.ts +166 -3
  65. package/src/node/test/exiting-backend.ts +75 -0
@@ -46,6 +46,28 @@ describe('ProcessUtils', () => {
46
46
  const pids = coreProcessManager['unixGetChildrenRecursive'](2);
47
47
  (0, chai_1.expect)(Array.from(pids)).members([40, 5, 6, 7]);
48
48
  });
49
+ describe('#unixTerminateChildProcessTrees', () => {
50
+ let killStub;
51
+ beforeEach(() => {
52
+ coreProcessManager['execFile'] = async () => ({ stdout: mockPsOutput, stderr: '' });
53
+ killStub = sinon.stub();
54
+ coreProcessManager['unixKill'] = killStub;
55
+ });
56
+ afterEach(() => {
57
+ sinon.restore();
58
+ });
59
+ it('kills all descendants but not the process itself', async () => {
60
+ await coreProcessManager['unixTerminateChildProcessTrees'](2);
61
+ (0, chai_1.expect)(killStub.args.map(([pid]) => pid)).members([40, 5, 6, 7]);
62
+ });
63
+ it('rejects when the processes cannot be listed', async () => {
64
+ coreProcessManager['execFile'] = async () => { throw new Error('ps not found'); };
65
+ let error;
66
+ await coreProcessManager['unixTerminateChildProcessTrees'](2).catch(e => error = e);
67
+ (0, chai_1.expect)(error).to.be.instanceOf(Error);
68
+ (0, chai_1.expect)(killStub.called).to.be.false;
69
+ });
70
+ });
49
71
  describe('#unixTerminateProcessTree', () => {
50
72
  let originalKill;
51
73
  let errorStub;
@@ -85,5 +107,120 @@ describe('ProcessUtils', () => {
85
107
  (0, chai_1.expect)(errorStub.called).to.be.true;
86
108
  });
87
109
  });
110
+ describe('#winTerminateProcessTree', () => {
111
+ let taskkillStub;
112
+ let warnStub;
113
+ beforeEach(() => {
114
+ const mockLogger = coreProcessManager.logger;
115
+ warnStub = sinon.stub(mockLogger, 'warn');
116
+ taskkillStub = sinon.stub();
117
+ coreProcessManager['winTaskkillTrees'] = taskkillStub;
118
+ });
119
+ afterEach(() => {
120
+ sinon.restore();
121
+ });
122
+ it('kills the tree of another process including its root', () => {
123
+ coreProcessManager['winGetChildPids'] = () => chai_1.expect.fail('children should not be listed');
124
+ coreProcessManager['winTerminateProcessTree'](424243);
125
+ (0, chai_1.expect)(taskkillStub.calledOnceWithExactly([424243])).to.be.true;
126
+ });
127
+ it('kills only the trees of the children of the current process', () => {
128
+ coreProcessManager['winGetChildPids'] = () => [424244, 424245];
129
+ coreProcessManager['winTerminateProcessTree'](process.pid);
130
+ (0, chai_1.expect)(taskkillStub.calledOnceWithExactly([424244, 424245])).to.be.true;
131
+ });
132
+ it('does not run taskkill when the current process has no children', () => {
133
+ coreProcessManager['winGetChildPids'] = () => [];
134
+ coreProcessManager['winTerminateProcessTree'](process.pid);
135
+ (0, chai_1.expect)(taskkillStub.called).to.be.false;
136
+ });
137
+ it('falls back to killing the whole tree when the children of the current process cannot be listed', () => {
138
+ coreProcessManager['winGetChildPids'] = () => { throw new Error('powershell.exe not found'); };
139
+ (0, chai_1.expect)(() => coreProcessManager['winTerminateProcessTree'](process.pid)).to.not.throw();
140
+ (0, chai_1.expect)(taskkillStub.calledOnceWithExactly([process.pid])).to.be.true;
141
+ (0, chai_1.expect)(warnStub.called).to.be.true;
142
+ });
143
+ });
144
+ describe('#winTerminateChildProcessTrees', () => {
145
+ let taskkillStub;
146
+ beforeEach(() => {
147
+ taskkillStub = sinon.stub();
148
+ coreProcessManager['winTaskkillTrees'] = taskkillStub;
149
+ });
150
+ afterEach(() => {
151
+ sinon.restore();
152
+ });
153
+ it('kills the trees of the children of the process', async () => {
154
+ coreProcessManager['winGetChildPidsAsync'] = async () => [424244, 424245];
155
+ await coreProcessManager['winTerminateChildProcessTrees'](process.pid);
156
+ (0, chai_1.expect)(taskkillStub.calledOnceWithExactly([424244, 424245])).to.be.true;
157
+ });
158
+ it('does not run taskkill when the process has no children', async () => {
159
+ coreProcessManager['winGetChildPidsAsync'] = async () => [];
160
+ await coreProcessManager['winTerminateChildProcessTrees'](process.pid);
161
+ (0, chai_1.expect)(taskkillStub.called).to.be.false;
162
+ });
163
+ it('rejects when the children cannot be listed', async () => {
164
+ coreProcessManager['winGetChildPidsAsync'] = async () => { throw new Error('powershell.exe not found'); };
165
+ let error;
166
+ await coreProcessManager['winTerminateChildProcessTrees'](process.pid).catch(e => error = e);
167
+ (0, chai_1.expect)(error).to.be.instanceOf(Error);
168
+ (0, chai_1.expect)(taskkillStub.called).to.be.false;
169
+ });
170
+ });
171
+ describe('#winGetChildPids', () => {
172
+ let originalSystemRoot;
173
+ let spawnSyncStub;
174
+ let execFileStub;
175
+ beforeEach(() => {
176
+ originalSystemRoot = process.env.SystemRoot;
177
+ spawnSyncStub = sinon.stub().returns({ stdout: '1234\r\n5678\r\n\r\n' });
178
+ coreProcessManager['spawnSync'] = spawnSyncStub;
179
+ execFileStub = sinon.stub().resolves({ stdout: '1234\r\n5678\r\n\r\n', stderr: '' });
180
+ coreProcessManager['execFile'] = execFileStub;
181
+ });
182
+ afterEach(() => {
183
+ if (originalSystemRoot === undefined) {
184
+ delete process.env.SystemRoot;
185
+ }
186
+ else {
187
+ process.env.SystemRoot = originalSystemRoot;
188
+ }
189
+ });
190
+ it('parses the PowerShell output', () => {
191
+ (0, chai_1.expect)(coreProcessManager['winGetChildPids'](42)).to.deep.equal([1234, 5678]);
192
+ });
193
+ it('parses the PowerShell output asynchronously', async () => {
194
+ (0, chai_1.expect)(await coreProcessManager['winGetChildPidsAsync'](42)).to.deep.equal([1234, 5678]);
195
+ (0, chai_1.expect)(spawnSyncStub.called).to.be.false;
196
+ });
197
+ it('runs PowerShell from the Windows directory with a timeout', async () => {
198
+ process.env.SystemRoot = 'C:\\Windows';
199
+ coreProcessManager['winGetChildPids'](42);
200
+ await coreProcessManager['winGetChildPidsAsync'](42);
201
+ for (const stub of [spawnSyncStub, execFileStub]) {
202
+ const [file, , options] = stub.firstCall.args;
203
+ (0, chai_1.expect)(file).to.equal('C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe');
204
+ (0, chai_1.expect)(options.timeout).to.be.greaterThan(0);
205
+ }
206
+ });
207
+ it('excludes the PowerShell process itself, the console host and the children of a previous process with the same PID', async () => {
208
+ coreProcessManager['winGetChildPids'](42);
209
+ await coreProcessManager['winGetChildPidsAsync'](42);
210
+ for (const stub of [spawnSyncStub, execFileStub]) {
211
+ const command = stub.firstCall.args[1].at(-1);
212
+ (0, chai_1.expect)(command).to.contain("Get-CimInstance -ClassName Win32_Process -Filter 'ProcessId=42'");
213
+ (0, chai_1.expect)(command).to.contain('ParentProcessId=42');
214
+ (0, chai_1.expect)(command).to.contain('$_.ProcessId -ne $PID');
215
+ (0, chai_1.expect)(command).to.contain("$_.Name -ne 'conhost.exe'");
216
+ (0, chai_1.expect)(command).to.contain('$_.CreationDate -ge $parent.CreationDate');
217
+ }
218
+ });
219
+ it('runs PowerShell from the PATH when the Windows directory is unknown', () => {
220
+ delete process.env.SystemRoot;
221
+ coreProcessManager['winGetChildPids'](42);
222
+ (0, chai_1.expect)(spawnSyncStub.firstCall.args[0]).to.equal('powershell.exe');
223
+ });
224
+ });
88
225
  });
89
226
  //# sourceMappingURL=process-utils.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"process-utils.spec.js","sourceRoot":"","sources":["../../src/node/process-utils.spec.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,+BAA8B;AAC9B,qDAA+B;AAC/B,yCAAsC;AACtC,mDAA+C;AAC/C,sCAAoC;AACpC,4DAAwD;AAExD,gBAAgB;AAChB,MAAM,YAAY,GAAG;;;;;;;;CAQpB,CAAC;AAEF,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAE1B,IAAI,kBAAgC,CAAC;IAErC,UAAU,CAAC,GAAG,EAAE;QACZ,MAAM,SAAS,GAAG,IAAI,qBAAS,EAAE,CAAC;QAClC,SAAS,CAAC,IAAI,CAAC,4BAAY,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACzD,SAAS,CAAC,IAAI,CAAC,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AC,EAAE,CAAC,OAAO,CAAC,iEAAiE,CAAC,CAAC;gBAC9F,IAAA,aAAM,EAAC,OAAO,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;gBACjD,IAAA,aAAM,EAAC,OAAO,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;gBACpD,IAAA,aAAM,EAAC,OAAO,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;gBACxD,IAAA,aAAM,EAAC,OAAO,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,0CAA0C,CAAC,CAAC;YAC3E,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qEAAqE,EAAE,GAAG,EAAE;YAC3E,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;YAC9B,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC;YAC1C,IAAA,aAAM,EAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Script for tests: creates a `BackendApplication`, which installs its process handlers, starts a
3
+ * child process, prints the PID of the child and exits with code {@link EXITING_BACKEND_EXIT_CODE}.
4
+ * The `exit` handler of the `BackendApplication` then terminates the process tree.
5
+ * Set {@link EXITING_BACKEND_NO_POWERSHELL} to make the listing of the children of the process fail.
6
+ * Set {@link EXITING_BACKEND_GRACEFUL} to shut down as on `SIGTERM` instead, which exits with code 1.
7
+ */
8
+ import 'reflect-metadata';
9
+ export declare const EXITING_BACKEND_EXIT_CODE = 3;
10
+ /**
11
+ * Environment variable that makes PowerShell unrunnable for the {@link ProcessUtils} of the script.
12
+ */
13
+ export declare const EXITING_BACKEND_NO_POWERSHELL = "THEIA_TEST_EXITING_BACKEND_NO_POWERSHELL";
14
+ /**
15
+ * Environment variable that makes the script shut down gracefully, as on `SIGTERM`, rather than exit abruptly.
16
+ */
17
+ export declare const EXITING_BACKEND_GRACEFUL = "THEIA_TEST_EXITING_BACKEND_GRACEFUL";
18
+ //# sourceMappingURL=exiting-backend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exiting-backend.d.ts","sourceRoot":"","sources":["../../../src/node/test/exiting-backend.ts"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AAEH,OAAO,kBAAkB,CAAC;AAW1B,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,6BAA6B,6CAA6C,CAAC;AAExF;;GAEG;AACH,eAAO,MAAM,wBAAwB,wCAAwC,CAAC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 EclipseSource and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.EXITING_BACKEND_GRACEFUL = exports.EXITING_BACKEND_NO_POWERSHELL = exports.EXITING_BACKEND_EXIT_CODE = void 0;
19
+ const tslib_1 = require("tslib");
20
+ /**
21
+ * Script for tests: creates a `BackendApplication`, which installs its process handlers, starts a
22
+ * child process, prints the PID of the child and exits with code {@link EXITING_BACKEND_EXIT_CODE}.
23
+ * The `exit` handler of the `BackendApplication` then terminates the process tree.
24
+ * Set {@link EXITING_BACKEND_NO_POWERSHELL} to make the listing of the children of the process fail.
25
+ * Set {@link EXITING_BACKEND_GRACEFUL} to shut down as on `SIGTERM` instead, which exits with code 1.
26
+ */
27
+ require("reflect-metadata");
28
+ const cp = tslib_1.__importStar(require("child_process"));
29
+ const inversify_1 = require("inversify");
30
+ const common_1 = require("../../common");
31
+ const mock_logger_1 = require("../../common/test/mock-logger");
32
+ const backend_application_1 = require("../backend-application");
33
+ const node_stopwatch_1 = require("../performance/node-stopwatch");
34
+ const process_utils_1 = require("../process-utils");
35
+ exports.EXITING_BACKEND_EXIT_CODE = 3;
36
+ /**
37
+ * Environment variable that makes PowerShell unrunnable for the {@link ProcessUtils} of the script.
38
+ */
39
+ exports.EXITING_BACKEND_NO_POWERSHELL = 'THEIA_TEST_EXITING_BACKEND_NO_POWERSHELL';
40
+ /**
41
+ * Environment variable that makes the script shut down gracefully, as on `SIGTERM`, rather than exit abruptly.
42
+ */
43
+ exports.EXITING_BACKEND_GRACEFUL = 'THEIA_TEST_EXITING_BACKEND_GRACEFUL';
44
+ class NoPowerShellProcessUtils extends process_utils_1.ProcessUtils {
45
+ winGetPowerShellPath() {
46
+ return 'C:\\does-not-exist\\powershell.exe';
47
+ }
48
+ }
49
+ if (require.main === module) {
50
+ const container = new inversify_1.Container();
51
+ container.bind(backend_application_1.RootContainer).toConstantValue(container);
52
+ container.bind(common_1.ILogger).to(mock_logger_1.MockLogger).inSingletonScope();
53
+ container.bind(common_1.Stopwatch).to(node_stopwatch_1.NodeStopwatch).inSingletonScope();
54
+ container.bind(process_utils_1.ProcessUtils).to(process.env[exports.EXITING_BACKEND_NO_POWERSHELL] ? NoPowerShellProcessUtils : process_utils_1.ProcessUtils).inSingletonScope();
55
+ container.bind(backend_application_1.BackendApplicationCliContribution).toSelf().inSingletonScope();
56
+ container.bind(backend_application_1.EarlyExpressMiddleware).toSelf().inSingletonScope();
57
+ (0, common_1.bindContributionProvider)(container, backend_application_1.BackendApplicationContribution);
58
+ container.bind(backend_application_1.BackendApplication).toSelf().inSingletonScope();
59
+ container.get(backend_application_1.BackendApplication);
60
+ const child = cp.spawn(process.execPath, ['-e', 'setInterval(() => {}, 1000)'], { stdio: 'ignore' });
61
+ child.on('spawn', () => process.stdout.write(`${child.pid}\n`, () => {
62
+ if (process.env[exports.EXITING_BACKEND_GRACEFUL]) {
63
+ // Signals cannot be sent to a process on Windows, so invoke the handler of the `BackendApplication` directly.
64
+ process.emit('SIGTERM', 'SIGTERM');
65
+ }
66
+ else {
67
+ process.exit(exports.EXITING_BACKEND_EXIT_CODE);
68
+ }
69
+ }));
70
+ }
71
+ //# sourceMappingURL=exiting-backend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exiting-backend.js","sourceRoot":"","sources":["../../../src/node/test/exiting-backend.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,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;;;;;;GAMG;AAEH,4BAA0B;AAC1B,0DAAoC;AACpC,yCAAsC;AACtC,yCAA4E;AAC5E,+DAA2D;AAC3D,gEAEgC;AAChC,kEAA8D;AAC9D,oDAAgD;AAEnC,QAAA,yBAAyB,GAAG,CAAC,CAAC;AAE3C;;GAEG;AACU,QAAA,6BAA6B,GAAG,0CAA0C,CAAC;AAExF;;GAEG;AACU,QAAA,wBAAwB,GAAG,qCAAqC,CAAC;AAE9E,MAAM,wBAAyB,SAAQ,4BAAY;IAC5B,oBAAoB;QACnC,OAAO,oCAAoC,CAAC;IAChD,CAAC;CACJ;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC1B,MAAM,SAAS,GAAG,IAAI,qBAAS,EAAE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AC9G,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,IAAI,CAAC,iCAAyB,CAAC,CAAC;QAC5C,CAAC;IACL,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/core",
3
- "version": "1.77.0-next.57+81ea5f939",
3
+ "version": "1.77.0-next.63+046af0812",
4
4
  "description": "Theia is a cloud & desktop IDE framework implemented in TypeScript.",
5
5
  "main": "lib/common/index.js",
6
6
  "typings": "lib/common/index.d.ts",
@@ -17,8 +17,8 @@
17
17
  "@lumino/virtualdom": "^2.0.5",
18
18
  "@lumino/widgets": "2.7.5",
19
19
  "@parcel/watcher": "^2.6.0",
20
- "@theia/application-package": "1.77.0-next.57+81ea5f939",
21
- "@theia/request": "1.77.0-next.57+81ea5f939",
20
+ "@theia/application-package": "1.77.0-next.63+046af0812",
21
+ "@theia/request": "1.77.0-next.63+046af0812",
22
22
  "@types/body-parser": "^1.19.6",
23
23
  "@types/express": "^4.17.25",
24
24
  "@types/fs-extra": "^4.0.15",
@@ -233,5 +233,5 @@
233
233
  "nyc": {
234
234
  "extends": "../../configs/nyc.json"
235
235
  },
236
- "gitHead": "81ea5f939c40c905de91083d07e284bfd7437fac"
236
+ "gitHead": "046af0812516f46f2bf7ce3357cca0b672159b20"
237
237
  }
@@ -757,6 +757,23 @@ describe('keybindings', () => {
757
757
  }
758
758
  });
759
759
 
760
+ it('should dispatch a Shift+punctuation binding from input that reports the base character', async () => {
761
+ keybindingRegistry.setKeymap(KeybindingScope.USER, [{ command: TEST_COMMAND_SHADOW.id, keybinding: 'ctrl+shift+`' }]);
762
+ const execute = sinon.spy();
763
+ const handler = commandRegistry.registerHandler(TEST_COMMAND_SHADOW.id, { execute });
764
+
765
+ try {
766
+ keybindingRegistry.dispatchNormalizedKeyDown({
767
+ key: '`', code: 'Backquote', ctrlKey: true, shiftKey: true
768
+ }, new EventTarget());
769
+ await new Promise(resolve => setTimeout(resolve, 0));
770
+
771
+ expect(execute.calledOnce).to.be.true;
772
+ } finally {
773
+ handler.dispose();
774
+ }
775
+ });
776
+
760
777
  it('should keep punctuation bindings inactive on a non-Latin layout', () => {
761
778
  const binding = { command: TEST_COMMAND.id, keybinding: 'ctrl+[' };
762
779
  keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
@@ -475,6 +475,39 @@ describe('keyboard layout service', function (): void {
475
475
  chai.expect(capsShiftOption[0].dispatchString()).to.equal('shift+alt+a');
476
476
  });
477
477
 
478
+ it('attributes Shift to the Shift layer when input reports the base character', async () => {
479
+ // Test automation such as Puppeteer can report the base character while Shift is held.
480
+ const us = require('../../../src/common/keyboard/layouts/en-US-pc.json');
481
+ const service = await setup(us, 'linux');
482
+ const input: NormalizedKeyboardInput = { key: '`', code: 'Backquote', ctrlKey: true, shiftKey: true };
483
+
484
+ chai.expect(service.detectLayoutModifiers(input)).to.equal('shift');
485
+ const interpretations = service.getKeyCodeInterpretations(input, 'code');
486
+ chai.expect(interpretations.map(keyCode => keyCode.interpretation)).to.deep.equal(['commandModifiers', 'layoutModifiers']);
487
+ chai.expect(interpretations.map(keyCode => keyCode.dispatchString())).to.deep.equal(['shift+ctrl+`', 'ctrl+`@shift']);
488
+ chai.expect(interpretations[1].dispatchString()).to.equal(service.resolveKeyCode(KeyCode.parse('ctrl+shift+`')).dispatchString());
489
+ });
490
+
491
+ it('does not attribute base-character input to the Shift layer when AltGraph is active or the Shift layer is dead', async () => {
492
+ const layout: NativeKeyboardLayout = {
493
+ info: { id: 'dead-shift', lang: 'en' },
494
+ mapping: {
495
+ Backquote: {
496
+ value: '`', valueIsDeadKey: false, withShift: '~', withShiftIsDeadKey: false,
497
+ withAltGr: '', withAltGrIsDeadKey: false, withShiftAltGr: '', withShiftAltGrIsDeadKey: false
498
+ },
499
+ Equal: {
500
+ value: '=', valueIsDeadKey: false, withShift: '^', withShiftIsDeadKey: true,
501
+ withAltGr: '', withAltGrIsDeadKey: false, withShiftAltGr: '', withShiftAltGrIsDeadKey: false
502
+ }
503
+ }
504
+ };
505
+ const service = await setup(layout, 'linux');
506
+
507
+ chai.expect(service.detectLayoutModifiers({ key: '`', code: 'Backquote', shiftKey: true, altGraph: true })).to.be.undefined;
508
+ chai.expect(service.detectLayoutModifiers({ key: '=', code: 'Equal', shiftKey: true })).to.be.undefined;
509
+ });
510
+
478
511
  it('normalizes the character to the Linux AltGraph layer when Caps Lock inverts the case', async () => {
479
512
  const layout: NativeKeyboardLayout = {
480
513
  info: { id: 'altgraph-letters', lang: 'pl' },
@@ -173,6 +173,10 @@ export class KeyboardLayoutService {
173
173
  if (input.shiftKey && producedBy(mapping.withShift, mapping.withShiftIsDeadKey)) {
174
174
  return 'shift';
175
175
  }
176
+ // Synthetic input, e.g. from test automation, can report the base character while Shift is held.
177
+ if (input.shiftKey && !altGraphActive && producedBy(mapping.value, mapping.valueIsDeadKey) && !!mapping.withShift && !mapping.withShiftIsDeadKey) {
178
+ return 'shift';
179
+ }
176
180
  return undefined;
177
181
  }
178
182
 
@@ -0,0 +1,57 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2026 STMicroelectronics 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 { expect } from 'chai';
18
+ import { MockTreeModel } from '../test/mock-tree-model';
19
+ import { createTreeTestContainer } from '../test/tree-test-container';
20
+ import { TreeNode } from '../tree';
21
+ import { ExpandableTreeNode } from '../tree-expansion';
22
+ import { TreeModel } from '../tree-model';
23
+ import { TopDownCompressedTreeIterator } from './compressed-tree-model';
24
+ import { CompressionParent, TreeCompressionService } from './tree-compression-service';
25
+
26
+ describe('TopDownCompressedTreeIterator', () => {
27
+
28
+ const model = createTreeTestContainer().get<TreeModel>(TreeModel);
29
+ const findNode = (id: string): TreeNode => model.getNode(id)!;
30
+
31
+ beforeEach(() => {
32
+ model.root = MockTreeModel.Node.toTreeNode({
33
+ id: 'root',
34
+ children: [
35
+ { id: 'a', children: [{ id: 'a.1', children: [{ id: 'a.1.1' }] }] },
36
+ { id: 'b' }
37
+ ]
38
+ });
39
+ (findNode('a') as ExpandableTreeNode).expanded = false;
40
+ });
41
+
42
+ it('descends into a collapsed compression parent', () => {
43
+ const actual = [...new TopDownCompressedTreeIterator(findNode('a'), { pruneCollapsed: true })].map(node => node.id);
44
+ expect(actual).to.deep.equal(['a', 'a.1', 'a.1.1', 'b']);
45
+ });
46
+
47
+ it('prunes a collapsed node that the given compression service does not treat as a compression parent', () => {
48
+ class NoRootCompressionService extends TreeCompressionService {
49
+ override isCompressionParent(node?: unknown): node is CompressionParent {
50
+ return !(ExpandableTreeNode.is(node) && node.parent === model.root) && super.isCompressionParent(node);
51
+ }
52
+ }
53
+ const iterator = new TopDownCompressedTreeIterator(findNode('a'), { pruneCollapsed: true }, new NoRootCompressionService());
54
+ expect([...iterator].map(node => node.id)).to.deep.equal(['a', 'b']);
55
+ });
56
+
57
+ });
@@ -23,8 +23,17 @@ import { ExpandableTreeNode } from '../tree-expansion';
23
23
  import { TopDownTreeIterator, TreeIterator } from '../tree-iterator';
24
24
 
25
25
  export class TopDownCompressedTreeIterator extends TopDownTreeIterator {
26
+
27
+ constructor(
28
+ root: TreeNode,
29
+ options?: Partial<TreeIterator.Options>,
30
+ protected readonly compressionService: TreeCompressionService = new TreeCompressionService()
31
+ ) {
32
+ super(root, options);
33
+ }
34
+
26
35
  protected override isCollapsed(candidate: TreeNode): boolean {
27
- return ExpandableTreeNode.isCollapsed(candidate) && !TreeCompressionService.prototype.isCompressionParent(candidate);
36
+ return ExpandableTreeNode.isCollapsed(candidate) && !this.compressionService.isCompressionParent(candidate);
28
37
  }
29
38
  }
30
39
 
@@ -75,7 +84,7 @@ export class CompressedTreeModel extends TreeModelImpl {
75
84
  }
76
85
 
77
86
  protected override createForwardIteratorForNode(node: TreeNode): TreeIterator {
78
- return new TopDownCompressedTreeIterator(node, { pruneCollapsed: true });
87
+ return new TopDownCompressedTreeIterator(node, { pruneCollapsed: true }, this.compressionService);
79
88
  }
80
89
 
81
90
  protected override selectIfAncestorOfSelected(node: Readonly<ExpandableTreeNode>): void {
@@ -70,6 +70,9 @@ class TestTreeWidget extends TreeWidget {
70
70
  doUpdateRowsNow(): void {
71
71
  this.doUpdateRows();
72
72
  }
73
+ roundTripThroughStorage(node: TreeNode): TreeNode {
74
+ return this.inflateFromStorage(JSON.parse(JSON.stringify(this.deflateForStorage(node))));
75
+ }
73
76
  }
74
77
 
75
78
  function createTreeRoot(...children: TreeNode[]): CompositeTreeNode {
@@ -193,6 +196,23 @@ describe('TreeWidget', () => {
193
196
  });
194
197
  });
195
198
 
199
+ describe('storage', () => {
200
+
201
+ it('restores the root and its children as tree nodes', () => {
202
+ const widget = new TestTreeWidget(defaultTreeProps, {} as TreeModel, {} as ContextMenuRenderer);
203
+ try {
204
+ const restored = widget.roundTripThroughStorage(createTreeRoot(leaf('a'))) as CompositeTreeNode;
205
+
206
+ expect(TreeNode.is(restored)).to.be.true;
207
+ expect(restored.parent).to.be.undefined;
208
+ expect(TreeNode.is(restored.children[0])).to.be.true;
209
+ expect(restored.children[0].parent).to.equal(restored);
210
+ } finally {
211
+ widget.dispose();
212
+ }
213
+ });
214
+ });
215
+
196
216
  describe('View', () => {
197
217
 
198
218
  let container: HTMLElement;
@@ -1508,9 +1508,8 @@ export class TreeWidget extends ReactWidget implements StatefulWidget {
1508
1508
  if (node.selected) {
1509
1509
  node.selected = false;
1510
1510
  }
1511
- if (parent) {
1512
- node.parent = parent;
1513
- }
1511
+ // Also the root, as a node without a `parent` is not a `TreeNode`.
1512
+ node.parent = parent;
1514
1513
  if (Array.isArray(node.children)) {
1515
1514
  for (const child of node.children as TreeNode[]) {
1516
1515
  this.inflateFromStorage(child, node);
@@ -300,13 +300,14 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica
300
300
  return;
301
301
  }
302
302
  const allParts = this.getParts();
303
+ // The title and the menu of the parts in the toolbar show the labels of the parts.
304
+ this.toDisposeOnUpdateTitle.pushAll(allParts.map(part => part.onTitleChanged(() => this.updateTitle())));
303
305
  const visibleParts = allParts.filter(part => !part.isHidden);
304
306
  this.title.label = title.label;
305
307
  // If there's only one visible part - inline it's title into the container title except in case the part
306
308
  // isn't originally belongs to this container but there are other **original** hidden parts.
307
309
  if (visibleParts.length === 1 && (visibleParts[0].originalContainerId === this.id || !this.findOriginalPart())) {
308
310
  const part = visibleParts[0];
309
- this.toDisposeOnUpdateTitle.push(part.onTitleChanged(() => this.updateTitle()));
310
311
  const partLabel = part.wrapped.title.label;
311
312
  // Change the container title if it contains only one part that originally belongs to another container.
312
313
  if (allParts.length === 1 && part.originalContainerId !== this.id && !this.isCurrentTitle(part.originalContainerTitle)) {
@@ -14,9 +14,9 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
  import * as assert from 'assert/strict';
17
- import { Deferred, firstTrue, waitForEvent } from './promise-util';
17
+ import { Deferred, firstTrue, timeout, waitForEvent } from './promise-util';
18
18
  import { Emitter } from './event';
19
- import { CancellationError } from './cancellation';
19
+ import { CancellationError, CancellationToken } from './cancellation';
20
20
 
21
21
  describe('promise-util', () => {
22
22
 
@@ -37,6 +37,22 @@ describe('promise-util', () => {
37
37
 
38
38
  type ExecutionHandler<T> = (resolve: (value: T) => void, reject: (error: unknown) => void) => void;
39
39
 
40
+ describe('timeout', () => {
41
+ it('should release its cancellation listener once it elapsed', async () => {
42
+ let listeners = 0;
43
+ const token: CancellationToken = {
44
+ isCancellationRequested: false,
45
+ onCancellationRequested: () => {
46
+ listeners++;
47
+ return { dispose: () => listeners-- };
48
+ }
49
+ };
50
+ await timeout(1, token);
51
+ await timeout(1, token);
52
+ assert.equal(listeners, 0);
53
+ });
54
+ });
55
+
40
56
  describe('firstTrue', () => {
41
57
  function createSequentialPromises<T>(...executionHandlers: ExecutionHandler<T>[]): Promise<T>[] {
42
58
  const deferreds: Deferred<T>[] = [];
@@ -49,8 +49,11 @@ export class Deferred<T = void> {
49
49
  */
50
50
  export function timeout(ms: number, token = CancellationToken.None): Promise<void> {
51
51
  const deferred = new Deferred<void>();
52
- const handle = setTimeout(() => deferred.resolve(), ms);
53
- token.onCancellationRequested(() => {
52
+ const handle = setTimeout(() => {
53
+ listener.dispose();
54
+ deferred.resolve();
55
+ }, ms);
56
+ const listener = token.onCancellationRequested(() => {
54
57
  clearTimeout(handle);
55
58
  deferred.reject(cancelled());
56
59
  });