@theia/core 1.73.0-next.20 → 1.73.0-next.26
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.
- package/lib/browser/authentication-service.d.ts +2 -0
- package/lib/browser/authentication-service.d.ts.map +1 -1
- package/lib/browser/authentication-service.js +8 -2
- package/lib/browser/authentication-service.js.map +1 -1
- package/lib/browser/catalog.json +36 -8
- package/lib/browser/frontend-application.d.ts +2 -0
- package/lib/browser/frontend-application.d.ts.map +1 -1
- package/lib/browser/frontend-application.js +15 -9
- package/lib/browser/frontend-application.js.map +1 -1
- package/lib/browser/json-schema-store.d.ts +2 -0
- package/lib/browser/json-schema-store.d.ts.map +1 -1
- package/lib/browser/json-schema-store.js +8 -2
- package/lib/browser/json-schema-store.js.map +1 -1
- package/lib/browser/keybinding.js +2 -1
- package/lib/browser/keybinding.js.map +1 -1
- package/lib/browser/preferences/frontend-config-preference-contributions.d.ts +2 -0
- package/lib/browser/preferences/frontend-config-preference-contributions.d.ts.map +1 -1
- package/lib/browser/preferences/frontend-config-preference-contributions.js +7 -1
- package/lib/browser/preferences/frontend-config-preference-contributions.js.map +1 -1
- package/lib/browser/preferences/preference-schema-provider.spec.js +3 -0
- package/lib/browser/preferences/preference-schema-provider.spec.js.map +1 -1
- package/lib/browser/preferences/preference-validation-service.d.ts +2 -0
- package/lib/browser/preferences/preference-validation-service.d.ts.map +1 -1
- package/lib/browser/preferences/preference-validation-service.js +11 -5
- package/lib/browser/preferences/preference-validation-service.js.map +1 -1
- package/lib/browser/preferences/preference-validation-service.spec.js +2 -0
- package/lib/browser/preferences/preference-validation-service.spec.js.map +1 -1
- package/lib/browser/secondary-window-handler.d.ts +2 -0
- package/lib/browser/secondary-window-handler.d.ts.map +1 -1
- package/lib/browser/secondary-window-handler.js +12 -6
- package/lib/browser/secondary-window-handler.js.map +1 -1
- package/lib/browser/shell/application-shell.d.ts +2 -0
- package/lib/browser/shell/application-shell.d.ts.map +1 -1
- package/lib/browser/shell/application-shell.js +9 -3
- package/lib/browser/shell/application-shell.js.map +1 -1
- package/lib/browser/tree/tree-container.spec.js +4 -0
- package/lib/browser/tree/tree-container.spec.js.map +1 -1
- package/lib/browser/tree/tree.d.ts +2 -0
- package/lib/browser/tree/tree.d.ts.map +1 -1
- package/lib/browser/tree/tree.js +7 -1
- package/lib/browser/tree/tree.js.map +1 -1
- package/lib/browser/window/default-window-service.d.ts +2 -1
- package/lib/browser/window/default-window-service.d.ts.map +1 -1
- package/lib/browser/window/default-window-service.js +10 -5
- package/lib/browser/window/default-window-service.js.map +1 -1
- package/lib/browser/window/default-window-service.spec.js +2 -0
- package/lib/browser/window/default-window-service.spec.js.map +1 -1
- package/lib/browser-only/messaging/frontend-only-service-connection-provider.d.ts +2 -0
- package/lib/browser-only/messaging/frontend-only-service-connection-provider.d.ts.map +1 -1
- package/lib/browser-only/messaging/frontend-only-service-connection-provider.js +8 -2
- package/lib/browser-only/messaging/frontend-only-service-connection-provider.js.map +1 -1
- package/lib/common/command.d.ts +2 -0
- package/lib/common/command.d.ts.map +1 -1
- package/lib/common/command.js +10 -4
- package/lib/common/command.js.map +1 -1
- package/lib/electron-main/electron-main-application.d.ts.map +1 -1
- package/lib/electron-main/electron-main-application.js +4 -2
- package/lib/electron-main/electron-main-application.js.map +1 -1
- package/lib/electron-node/request/electron-backend-request-service.d.ts +2 -0
- package/lib/electron-node/request/electron-backend-request-service.d.ts.map +1 -1
- package/lib/electron-node/request/electron-backend-request-service.js +7 -1
- package/lib/electron-node/request/electron-backend-request-service.js.map +1 -1
- package/lib/electron-node/token/electron-token-backend-contribution.d.ts +2 -0
- package/lib/electron-node/token/electron-token-backend-contribution.d.ts.map +1 -1
- package/lib/electron-node/token/electron-token-backend-contribution.js +7 -1
- package/lib/electron-node/token/electron-token-backend-contribution.js.map +1 -1
- package/lib/electron-node/token/electron-token-validator.d.ts +2 -0
- package/lib/electron-node/token/electron-token-validator.d.ts.map +1 -1
- package/lib/electron-node/token/electron-token-validator.js +7 -1
- package/lib/electron-node/token/electron-token-validator.js.map +1 -1
- package/lib/node/backend-application.d.ts +2 -0
- package/lib/node/backend-application.d.ts.map +1 -1
- package/lib/node/backend-application.js +17 -11
- package/lib/node/backend-application.js.map +1 -1
- package/lib/node/backend-application.spec.js +3 -2
- package/lib/node/backend-application.spec.js.map +1 -1
- package/lib/node/messaging/default-messaging-service.d.ts +2 -0
- package/lib/node/messaging/default-messaging-service.d.ts.map +1 -1
- package/lib/node/messaging/default-messaging-service.js +8 -2
- package/lib/node/messaging/default-messaging-service.js.map +1 -1
- package/lib/node/messaging/test/default-messaging-service.spec.js +2 -0
- package/lib/node/messaging/test/default-messaging-service.spec.js.map +1 -1
- package/lib/node/messaging/websocket-endpoint.d.ts +2 -0
- package/lib/node/messaging/websocket-endpoint.d.ts.map +1 -1
- package/lib/node/messaging/websocket-endpoint.js +7 -1
- package/lib/node/messaging/websocket-endpoint.js.map +1 -1
- package/lib/node/process-utils.d.ts +2 -0
- package/lib/node/process-utils.d.ts.map +1 -1
- package/lib/node/process-utils.js +8 -2
- package/lib/node/process-utils.js.map +1 -1
- package/lib/node/process-utils.spec.js +11 -9
- package/lib/node/process-utils.spec.js.map +1 -1
- package/package.json +4 -4
- package/src/browser/authentication-service.ts +6 -3
- package/src/browser/frontend-application.ts +13 -9
- package/src/browser/json-schema-store.ts +6 -2
- package/src/browser/keybinding.ts +2 -2
- package/src/browser/preferences/frontend-config-preference-contributions.ts +7 -2
- package/src/browser/preferences/preference-schema-provider.spec.ts +5 -0
- package/src/browser/preferences/preference-validation-service.spec.ts +3 -1
- package/src/browser/preferences/preference-validation-service.ts +9 -6
- package/src/browser/secondary-window-handler.ts +11 -7
- package/src/browser/shell/application-shell.ts +8 -4
- package/src/browser/tree/tree-container.spec.ts +6 -0
- package/src/browser/tree/tree.ts +6 -2
- package/src/browser/window/default-window-service.spec.ts +3 -1
- package/src/browser/window/default-window-service.ts +9 -6
- package/src/browser-only/messaging/frontend-only-service-connection-provider.ts +8 -3
- package/src/common/command.ts +8 -4
- package/src/electron-main/electron-main-application.ts +4 -2
- package/src/electron-node/request/electron-backend-request-service.ts +6 -2
- package/src/electron-node/token/electron-token-backend-contribution.ts +6 -2
- package/src/electron-node/token/electron-token-validator.ts +6 -2
- package/src/node/backend-application.spec.ts +3 -3
- package/src/node/backend-application.ts +15 -11
- package/src/node/messaging/default-messaging-service.ts +6 -2
- package/src/node/messaging/test/default-messaging-service.spec.ts +3 -1
- package/src/node/messaging/websocket-endpoint.ts +6 -2
- package/src/node/process-utils.spec.ts +12 -9
- package/src/node/process-utils.ts +7 -3
|
@@ -16,8 +16,11 @@
|
|
|
16
16
|
// *****************************************************************************
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const chai_1 = require("chai");
|
|
19
|
+
const sinon = require("sinon");
|
|
19
20
|
const inversify_1 = require("inversify");
|
|
20
21
|
const process_utils_1 = require("./process-utils");
|
|
22
|
+
const common_1 = require("../common");
|
|
23
|
+
const mock_logger_1 = require("../common/test/mock-logger");
|
|
21
24
|
/** PPID, PID */
|
|
22
25
|
const mockPsOutput = `\
|
|
23
26
|
5 6
|
|
@@ -33,6 +36,7 @@ describe('ProcessUtils', () => {
|
|
|
33
36
|
beforeEach(() => {
|
|
34
37
|
const container = new inversify_1.Container();
|
|
35
38
|
container.bind(process_utils_1.ProcessUtils).toSelf().inSingletonScope();
|
|
39
|
+
container.bind(common_1.ILogger).to(mock_logger_1.MockLogger).inSingletonScope();
|
|
36
40
|
coreProcessManager = container.get(process_utils_1.ProcessUtils);
|
|
37
41
|
});
|
|
38
42
|
it('ProcessUtils#unixGetChildrenRecursive', () => {
|
|
@@ -43,8 +47,7 @@ describe('ProcessUtils', () => {
|
|
|
43
47
|
});
|
|
44
48
|
describe('#unixTerminateProcessTree', () => {
|
|
45
49
|
let originalKill;
|
|
46
|
-
let
|
|
47
|
-
let loggedErrors;
|
|
50
|
+
let errorStub;
|
|
48
51
|
function throwingKill(code) {
|
|
49
52
|
return (() => {
|
|
50
53
|
const error = new Error(`kill ${code}`);
|
|
@@ -54,32 +57,31 @@ describe('ProcessUtils', () => {
|
|
|
54
57
|
}
|
|
55
58
|
beforeEach(() => {
|
|
56
59
|
originalKill = process.kill;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
console.error = (...args) => { loggedErrors.push(args); };
|
|
60
|
+
const mockLogger = coreProcessManager.logger;
|
|
61
|
+
errorStub = sinon.stub(mockLogger, 'error');
|
|
60
62
|
// One child plus the parent; report the parent as its own group leader so the `kill(-ppid)` branch runs too.
|
|
61
63
|
coreProcessManager['unixGetChildrenRecursive'] = () => new Set([424242]);
|
|
62
64
|
coreProcessManager['unixGetPGID'] = (pid) => pid;
|
|
63
65
|
});
|
|
64
66
|
afterEach(() => {
|
|
65
67
|
process.kill = originalKill;
|
|
66
|
-
|
|
68
|
+
sinon.restore();
|
|
67
69
|
});
|
|
68
70
|
it('does not throw or log when processes in the tree are already gone (ESRCH)', () => {
|
|
69
71
|
process.kill = throwingKill('ESRCH');
|
|
70
72
|
(0, chai_1.expect)(() => coreProcessManager['unixTerminateProcessTree'](424243)).to.not.throw();
|
|
71
|
-
(0, chai_1.expect)(
|
|
73
|
+
(0, chai_1.expect)(errorStub.called).to.be.false;
|
|
72
74
|
});
|
|
73
75
|
it('logs unexpected kill errors (e.g. EPERM) without throwing', () => {
|
|
74
76
|
process.kill = throwingKill('EPERM');
|
|
75
77
|
(0, chai_1.expect)(() => coreProcessManager['unixTerminateProcessTree'](424243)).to.not.throw();
|
|
76
|
-
(0, chai_1.expect)(
|
|
78
|
+
(0, chai_1.expect)(errorStub.called).to.be.true;
|
|
77
79
|
});
|
|
78
80
|
it('does not throw when a kill rejects with a value that has no code (e.g. undefined)', () => {
|
|
79
81
|
const thrown = undefined;
|
|
80
82
|
process.kill = (() => { throw thrown; });
|
|
81
83
|
(0, chai_1.expect)(() => coreProcessManager['unixTerminateProcessTree'](424243)).to.not.throw();
|
|
82
|
-
(0, chai_1.expect)(
|
|
84
|
+
(0, chai_1.expect)(errorStub.called).to.be.true;
|
|
83
85
|
});
|
|
84
86
|
});
|
|
85
87
|
});
|
|
@@ -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,yCAAsC;AACtC,mDAA+C;
|
|
1
|
+
{"version":3,"file":"process-utils.spec.js","sourceRoot":"","sources":["../../src/node/process-utils.spec.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/core",
|
|
3
|
-
"version": "1.73.0-next.
|
|
3
|
+
"version": "1.73.0-next.26+d6f45631a",
|
|
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.4",
|
|
18
18
|
"@lumino/widgets": "2.7.5",
|
|
19
19
|
"@parcel/watcher": "^2.5.6",
|
|
20
|
-
"@theia/application-package": "1.73.0-next.
|
|
21
|
-
"@theia/request": "1.73.0-next.
|
|
20
|
+
"@theia/application-package": "1.73.0-next.26+d6f45631a",
|
|
21
|
+
"@theia/request": "1.73.0-next.26+d6f45631a",
|
|
22
22
|
"@types/body-parser": "^1.19.6",
|
|
23
23
|
"@types/express": "^4.17.25",
|
|
24
24
|
"@types/fs-extra": "^4.0.15",
|
|
@@ -221,5 +221,5 @@
|
|
|
221
221
|
"nyc": {
|
|
222
222
|
"extends": "../../configs/nyc.json"
|
|
223
223
|
},
|
|
224
|
-
"gitHead": "
|
|
224
|
+
"gitHead": "d6f45631a893ad1944a87db5aaf4bc94c64b1c60"
|
|
225
225
|
}
|
|
@@ -20,13 +20,14 @@
|
|
|
20
20
|
*--------------------------------------------------------------------------------------------*/
|
|
21
21
|
// code copied and modified from https://github.com/microsoft/vscode/blob/1.47.3/src/vs/workbench/services/authentication/browser/authenticationService.ts
|
|
22
22
|
|
|
23
|
-
import { injectable, inject, postConstruct } from 'inversify';
|
|
23
|
+
import { injectable, inject, postConstruct, named } from 'inversify';
|
|
24
24
|
import { Emitter, Event } from '../common/event';
|
|
25
25
|
import { StorageService } from '../browser/storage-service';
|
|
26
26
|
import { Disposable, DisposableCollection } from '../common/disposable';
|
|
27
27
|
import { ACCOUNTS_MENU, ACCOUNTS_SUBMENU, MenuModelRegistry } from '../common/menu';
|
|
28
28
|
import { Command, CommandRegistry } from '../common/command';
|
|
29
29
|
import { nls } from '../common/nls';
|
|
30
|
+
import { ILogger } from '../common/logger';
|
|
30
31
|
|
|
31
32
|
export interface AuthenticationSessionAccountInformation {
|
|
32
33
|
readonly id: string;
|
|
@@ -202,6 +203,8 @@ export class AuthenticationServiceImpl implements AuthenticationService {
|
|
|
202
203
|
@inject(MenuModelRegistry) protected readonly menus: MenuModelRegistry;
|
|
203
204
|
@inject(CommandRegistry) protected readonly commands: CommandRegistry;
|
|
204
205
|
@inject(StorageService) protected readonly storageService: StorageService;
|
|
206
|
+
@inject(ILogger) @named('core:AuthenticationServiceImpl')
|
|
207
|
+
protected readonly logger: ILogger;
|
|
205
208
|
|
|
206
209
|
@postConstruct()
|
|
207
210
|
init(): void {
|
|
@@ -308,7 +311,7 @@ export class AuthenticationServiceImpl implements AuthenticationService {
|
|
|
308
311
|
this.onDidUnregisterAuthenticationProviderEmitter.fire({ id, label: provider.label });
|
|
309
312
|
this.updateAccountsMenuItem();
|
|
310
313
|
} else {
|
|
311
|
-
|
|
314
|
+
this.logger.error(`Failed to unregister an authentication provider. A provider with id '${id}' was not found.`);
|
|
312
315
|
}
|
|
313
316
|
this.authenticationProviderDisposables.get(id)?.dispose();
|
|
314
317
|
this.authenticationProviderDisposables.delete(id);
|
|
@@ -325,7 +328,7 @@ export class AuthenticationServiceImpl implements AuthenticationService {
|
|
|
325
328
|
await this.updateNewSessionRequests(provider);
|
|
326
329
|
}
|
|
327
330
|
} else {
|
|
328
|
-
|
|
331
|
+
this.logger.error(`Failed to update an authentication session. An authentication provider with id '${id}' was not found.`);
|
|
329
332
|
}
|
|
330
333
|
}
|
|
331
334
|
|
|
@@ -27,6 +27,7 @@ import { CorePreferences } from '../common/core-preferences';
|
|
|
27
27
|
import { WindowService } from './window/window-service';
|
|
28
28
|
import { TooltipService } from './tooltip-service';
|
|
29
29
|
import { FrontendApplicationContribution } from './frontend-application-contribution';
|
|
30
|
+
import { ILogger } from '../common/logger';
|
|
30
31
|
|
|
31
32
|
const TIMER_WARNING_THRESHOLD = 100;
|
|
32
33
|
|
|
@@ -48,6 +49,9 @@ export class FrontendApplication {
|
|
|
48
49
|
@inject(BackendStopwatch)
|
|
49
50
|
protected readonly backendStopwatch: BackendStopwatch;
|
|
50
51
|
|
|
52
|
+
@inject(ILogger) @named('core:FrontendApplication')
|
|
53
|
+
protected readonly logger: ILogger;
|
|
54
|
+
|
|
51
55
|
private settlementContext?: MeasurementContext<FrontendApplicationContribution>;
|
|
52
56
|
|
|
53
57
|
constructor(
|
|
@@ -217,10 +221,10 @@ export class FrontendApplication {
|
|
|
217
221
|
return await this.layoutRestorer.restoreLayout(this);
|
|
218
222
|
} catch (error) {
|
|
219
223
|
if (ApplicationShellLayoutMigrationError.is(error)) {
|
|
220
|
-
|
|
221
|
-
|
|
224
|
+
this.logger.warn(error.message);
|
|
225
|
+
this.logger.info('Initializing the default layout instead...');
|
|
222
226
|
} else {
|
|
223
|
-
|
|
227
|
+
this.logger.error('Could not restore layout', error);
|
|
224
228
|
}
|
|
225
229
|
return false;
|
|
226
230
|
}
|
|
@@ -258,7 +262,7 @@ export class FrontendApplication {
|
|
|
258
262
|
await this.measureContribution(contribution, 'initialize',
|
|
259
263
|
() => contribution.initialize!());
|
|
260
264
|
} catch (error) {
|
|
261
|
-
|
|
265
|
+
this.logger.error('Could not initialize contribution', error);
|
|
262
266
|
}
|
|
263
267
|
}
|
|
264
268
|
}
|
|
@@ -269,7 +273,7 @@ export class FrontendApplication {
|
|
|
269
273
|
await this.measureContribution(contribution, 'configure',
|
|
270
274
|
() => contribution.configure!(this));
|
|
271
275
|
} catch (error) {
|
|
272
|
-
|
|
276
|
+
this.logger.error('Could not configure contribution', error);
|
|
273
277
|
}
|
|
274
278
|
}
|
|
275
279
|
}
|
|
@@ -294,7 +298,7 @@ export class FrontendApplication {
|
|
|
294
298
|
await this.measureContribution(contribution, 'onStart',
|
|
295
299
|
() => contribution.onStart!(this));
|
|
296
300
|
} catch (error) {
|
|
297
|
-
|
|
301
|
+
this.logger.error('Could not start contribution', error);
|
|
298
302
|
}
|
|
299
303
|
}
|
|
300
304
|
}
|
|
@@ -304,17 +308,17 @@ export class FrontendApplication {
|
|
|
304
308
|
* Stop the frontend application contributions. This is called when the window is unloaded.
|
|
305
309
|
*/
|
|
306
310
|
protected stopContributions(): void {
|
|
307
|
-
|
|
311
|
+
this.logger.info('>>> Stopping frontend contributions...');
|
|
308
312
|
for (const contribution of this.contributions.getContributions()) {
|
|
309
313
|
if (contribution.onStop) {
|
|
310
314
|
try {
|
|
311
315
|
contribution.onStop(this);
|
|
312
316
|
} catch (error) {
|
|
313
|
-
|
|
317
|
+
this.logger.error('Could not stop contribution', error);
|
|
314
318
|
}
|
|
315
319
|
}
|
|
316
320
|
}
|
|
317
|
-
|
|
321
|
+
this.logger.info('<<< All frontend contributions have been stopped.');
|
|
318
322
|
}
|
|
319
323
|
|
|
320
324
|
protected async measureContribution<T>(contribution: FrontendApplicationContribution, hook: string, fn: () => MaybePromise<T>): Promise<T> {
|
|
@@ -20,6 +20,7 @@ import { FrontendApplicationContribution } from './frontend-application-contribu
|
|
|
20
20
|
import { Emitter, MaybePromise, URI } from '../common';
|
|
21
21
|
import { timeout, Deferred } from '../common/promise-util';
|
|
22
22
|
import { IJSONSchema } from '../common/json-schema';
|
|
23
|
+
import { ILogger } from '../common/logger';
|
|
23
24
|
|
|
24
25
|
export interface JsonSchemaConfiguration {
|
|
25
26
|
fileMatch: string | string[];
|
|
@@ -41,6 +42,9 @@ export class JsonSchemaStore implements FrontendApplicationContribution {
|
|
|
41
42
|
@inject(ContributionProvider) @named(JsonSchemaContribution)
|
|
42
43
|
protected readonly contributions: ContributionProvider<JsonSchemaContribution>;
|
|
43
44
|
|
|
45
|
+
@inject(ILogger) @named('core:JsonSchemaStore')
|
|
46
|
+
protected readonly logger: ILogger;
|
|
47
|
+
|
|
44
48
|
protected readonly _schemas = new Deferred<JsonSchemaConfiguration[]>();
|
|
45
49
|
get schemas(): Promise<JsonSchemaConfiguration[]> {
|
|
46
50
|
return this._schemas.promise;
|
|
@@ -68,9 +72,9 @@ export class JsonSchemaStore implements FrontendApplicationContribution {
|
|
|
68
72
|
if (result) {
|
|
69
73
|
pendingRegistrations.push(result.then(() => { }, e => {
|
|
70
74
|
if (e instanceof Error && e.message === frozenErrorCode) {
|
|
71
|
-
|
|
75
|
+
this.logger.error(`${contribution.constructor.name}.registerSchemas is taking more than ${registerTimeout.toFixed(1)} ms, new schemas are ignored.`);
|
|
72
76
|
} else {
|
|
73
|
-
|
|
77
|
+
this.logger.error(e);
|
|
74
78
|
}
|
|
75
79
|
}));
|
|
76
80
|
}
|
|
@@ -128,7 +128,7 @@ export class KeybindingRegistry {
|
|
|
128
128
|
@inject(StatusBar)
|
|
129
129
|
protected readonly statusBar: StatusBar;
|
|
130
130
|
|
|
131
|
-
@inject(ILogger)
|
|
131
|
+
@inject(ILogger) @named('core:KeybindingRegistry')
|
|
132
132
|
protected readonly logger: ILogger;
|
|
133
133
|
|
|
134
134
|
@inject(ContextKeyService)
|
|
@@ -545,7 +545,7 @@ export class KeybindingRegistry {
|
|
|
545
545
|
if (command) {
|
|
546
546
|
if (this.commandRegistry.isEnabled(binding.command, binding.args)) {
|
|
547
547
|
this.commandRegistry.executeCommand(binding.command, binding.args)
|
|
548
|
-
.catch(e =>
|
|
548
|
+
.catch(e => this.logger.error('Failed to execute command:', e));
|
|
549
549
|
}
|
|
550
550
|
|
|
551
551
|
/* Note that if a keybinding is in context but the command is
|
|
@@ -14,16 +14,21 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { injectable } from 'inversify';
|
|
17
|
+
import { injectable, named, inject } from 'inversify';
|
|
18
18
|
import { PreferenceContribution, PreferenceSchema, PreferenceSchemaService } from '../../common/preferences/preference-schema';
|
|
19
19
|
import { FrontendApplicationConfigProvider } from '../frontend-application-config-provider';
|
|
20
20
|
import { FrontendApplicationPreferenceConfig } from './preference-contribution';
|
|
21
21
|
import { PreferenceLanguageOverrideService } from '../../common/preferences/preference-language-override-service';
|
|
22
22
|
import { PreferenceScope } from '../../common/preferences';
|
|
23
23
|
import { DefaultTheme } from '@theia/application-package/lib/application-props';
|
|
24
|
+
import { ILogger } from '../../common/logger';
|
|
24
25
|
|
|
25
26
|
@injectable()
|
|
26
27
|
export class FrontendConfigPreferenceContribution implements PreferenceContribution {
|
|
28
|
+
|
|
29
|
+
@inject(ILogger) @named('core:FrontendConfigPreferenceContribution')
|
|
30
|
+
protected readonly logger: ILogger;
|
|
31
|
+
|
|
27
32
|
schema: PreferenceSchema = { scope: PreferenceScope.Folder, properties: {} };
|
|
28
33
|
async initSchema(service: PreferenceSchemaService): Promise<void> {
|
|
29
34
|
const config = FrontendApplicationConfigProvider.get();
|
|
@@ -44,7 +49,7 @@ export class FrontendConfigPreferenceContribution implements PreferenceContribut
|
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
51
|
} catch (e) {
|
|
47
|
-
|
|
52
|
+
this.logger.error('Failed to load preferences from frontend configuration.', e);
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
}
|
|
@@ -24,6 +24,8 @@ import { bindPreferenceService } from '../frontend-application-bindings';
|
|
|
24
24
|
import { FrontendApplicationConfigProvider } from '../frontend-application-config-provider';
|
|
25
25
|
import { IndexedAccess, PreferenceDataProperty, PreferenceSchemaService } from '../../common/preferences/preference-schema';
|
|
26
26
|
import { PreferenceProvider, PreferenceProviderProvider, PreferenceScope } from '../../common/preferences';
|
|
27
|
+
import { ILogger } from '../../common';
|
|
28
|
+
import { MockLogger } from '../../common/test/mock-logger';
|
|
27
29
|
|
|
28
30
|
disableJSDOM();
|
|
29
31
|
|
|
@@ -38,6 +40,9 @@ let testContainer: Container;
|
|
|
38
40
|
function createTestContainer(): Container {
|
|
39
41
|
const result = new Container();
|
|
40
42
|
bindPreferenceService(result.bind.bind(result));
|
|
43
|
+
|
|
44
|
+
result.bind(ILogger).to(MockLogger).inSingletonScope();
|
|
45
|
+
|
|
41
46
|
return result;
|
|
42
47
|
}
|
|
43
48
|
|
|
@@ -21,9 +21,10 @@ import { JSONValue } from '@lumino/coreutils';
|
|
|
21
21
|
import { IJSONSchema, JsonType } from '../../common/json-schema';
|
|
22
22
|
import {
|
|
23
23
|
DefaultsPreferenceProvider, Disposable, PreferenceDataProperty, PreferenceProvider,
|
|
24
|
-
PreferenceSchemaService, PreferenceSchemaServiceImpl, PreferenceScope
|
|
24
|
+
PreferenceSchemaService, PreferenceSchemaServiceImpl, PreferenceScope, ILogger
|
|
25
25
|
} from '../../common';
|
|
26
26
|
import { PreferenceLanguageOverrideService } from '../../common/preferences/preference-language-override-service';
|
|
27
|
+
import { MockLogger } from '../../common/test/mock-logger';
|
|
27
28
|
|
|
28
29
|
/* eslint-disable no-null/no-null */
|
|
29
30
|
|
|
@@ -35,6 +36,7 @@ describe('Preference Validation Service', () => {
|
|
|
35
36
|
} as unknown as PreferenceSchemaService);
|
|
36
37
|
container.bind(PreferenceLanguageOverrideService).to(PreferenceLanguageOverrideService).inSingletonScope();
|
|
37
38
|
container.bind(PreferenceProvider).to(DefaultsPreferenceProvider).inSingletonScope().whenTargetNamed(PreferenceScope.Default);
|
|
39
|
+
container.bind(ILogger).to(MockLogger).inSingletonScope();
|
|
38
40
|
|
|
39
41
|
const validator = container.resolve(PreferenceValidationService);
|
|
40
42
|
const validateBySchema: (value: JSONValue, schema: PreferenceDataProperty) => JSONValue = validator.validateBySchema.bind(validator, 'dummy');
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { JSONObject, JSONValue } from '../../../shared/@lumino/coreutils';
|
|
18
|
-
import { inject, injectable } from '../../../shared/inversify';
|
|
18
|
+
import { inject, injectable, named } from '../../../shared/inversify';
|
|
19
19
|
import { IJSONSchema, JsonType } from '../../common/json-schema';
|
|
20
20
|
import { deepClone, unreachable } from '../../common';
|
|
21
21
|
import { PreferenceLanguageOverrideService } from '../../common/preferences/preference-language-override-service';
|
|
22
22
|
import { PreferenceSchemaService, PreferenceScope, PreferenceUtils, PreferenceDataProperty } from '../../common/preferences';
|
|
23
|
+
import { ILogger } from '../../common/logger';
|
|
23
24
|
|
|
24
25
|
export interface PreferenceValidator<T> {
|
|
25
26
|
name: string;
|
|
@@ -40,6 +41,8 @@ type ValidatablePreferenceTuple = IJSONSchema & ({ items: IJSONSchema[] } | { pr
|
|
|
40
41
|
export class PreferenceValidationService {
|
|
41
42
|
@inject(PreferenceSchemaService) protected readonly schemaService: PreferenceSchemaService;
|
|
42
43
|
@inject(PreferenceLanguageOverrideService) protected readonly languageOverrideService: PreferenceLanguageOverrideService;
|
|
44
|
+
@inject(ILogger) @named('core:PreferenceValidationService')
|
|
45
|
+
protected readonly logger: ILogger;
|
|
43
46
|
|
|
44
47
|
validateOptions(options: Record<string, JSONValue>): Record<string, JSONValue> {
|
|
45
48
|
const valid: Record<string, JSONValue> = {};
|
|
@@ -58,7 +61,7 @@ export class PreferenceValidationService {
|
|
|
58
61
|
const validValue = this.doValidateByName(preferenceName, value);
|
|
59
62
|
// If value is undefined, it means the preference wasn't set, not that a bad value was set.
|
|
60
63
|
if (validValue !== value && value !== undefined) {
|
|
61
|
-
|
|
64
|
+
this.logger.warn(`While validating options, found impermissible value for ${preferenceName}. Using valid value`, validValue, 'instead of configured value', value);
|
|
62
65
|
}
|
|
63
66
|
return validValue;
|
|
64
67
|
}
|
|
@@ -71,7 +74,7 @@ export class PreferenceValidationService {
|
|
|
71
74
|
validateBySchema(key: string, value: JSONValue, schema: IJSONSchema | undefined): JSONValue {
|
|
72
75
|
try {
|
|
73
76
|
if (!schema) {
|
|
74
|
-
|
|
77
|
+
this.logger.warn('Request to validate preference with no schema registered:', key);
|
|
75
78
|
return value;
|
|
76
79
|
}
|
|
77
80
|
if (schema.const !== undefined) {
|
|
@@ -87,7 +90,7 @@ export class PreferenceValidationService {
|
|
|
87
90
|
return this.validateOneOf(key, value, schema as IJSONSchema & { oneOf: IJSONSchema[] });
|
|
88
91
|
}
|
|
89
92
|
if (schema.type === undefined) {
|
|
90
|
-
|
|
93
|
+
this.logger.warn('Request to validate preference with no type information:', key);
|
|
91
94
|
return value;
|
|
92
95
|
}
|
|
93
96
|
if (Array.isArray(schema.type)) {
|
|
@@ -112,7 +115,7 @@ export class PreferenceValidationService {
|
|
|
112
115
|
unreachable(schema.type, `Request to validate preference with unknown type in schema: ${key}`);
|
|
113
116
|
}
|
|
114
117
|
} catch (e) {
|
|
115
|
-
|
|
118
|
+
this.logger.error('Encountered an error while validating', key, 'with value', value, 'against schema', schema, e);
|
|
116
119
|
return value;
|
|
117
120
|
}
|
|
118
121
|
}
|
|
@@ -193,7 +196,7 @@ export class PreferenceValidationService {
|
|
|
193
196
|
return [];
|
|
194
197
|
}
|
|
195
198
|
if (!schema.items && !schema.prefixItems) {
|
|
196
|
-
|
|
199
|
+
this.logger.warn('Requested validation of array without item specification:', key);
|
|
197
200
|
return candidate;
|
|
198
201
|
}
|
|
199
202
|
if (Array.isArray(schema.items) || Array.isArray(schema.prefixItems)) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import debounce = require('lodash.debounce');
|
|
18
|
-
import { inject, injectable } from 'inversify';
|
|
18
|
+
import { inject, injectable, named } from 'inversify';
|
|
19
19
|
import { BoxLayout, ExtractableWidget, TabBar, Widget } from './widgets';
|
|
20
20
|
import { MessageService } from '../common/message-service';
|
|
21
21
|
import { ApplicationShell, DockPanelRenderer, MAIN_AREA_CLASS, MAIN_BOTTOM_AREA_CLASS } from './shell/application-shell';
|
|
@@ -23,6 +23,7 @@ import { Emitter } from '../common/event';
|
|
|
23
23
|
import { isSecondaryWindow, SecondaryWindowRootWidget, SecondaryWindowService } from './window/secondary-window-service';
|
|
24
24
|
import { KeybindingRegistry } from './keybinding';
|
|
25
25
|
import { MAIN_AREA_ID, TheiaDockPanel } from './shell/theia-dock-panel';
|
|
26
|
+
import { ILogger } from '../common/logger';
|
|
26
27
|
import { nls } from '../common/nls';
|
|
27
28
|
|
|
28
29
|
/** Widgets to be contained inside a DockPanel in the secondary window. */
|
|
@@ -104,6 +105,9 @@ export class SecondaryWindowHandler {
|
|
|
104
105
|
@inject(TheiaDockPanel.Factory)
|
|
105
106
|
protected dockPanelFactory: TheiaDockPanel.Factory;
|
|
106
107
|
|
|
108
|
+
@inject(ILogger) @named('core:SecondaryWindowHandler')
|
|
109
|
+
protected readonly logger: ILogger;
|
|
110
|
+
|
|
107
111
|
protected readonly onWillAddWidgetEmitter = new Emitter<[Widget, Window]>();
|
|
108
112
|
/** Subscribe to get notified when a widget is added to this handler, i.e. the widget was moved to an secondary window . */
|
|
109
113
|
readonly onWillAddWidget = this.onWillAddWidgetEmitter.event;
|
|
@@ -157,11 +161,11 @@ export class SecondaryWindowHandler {
|
|
|
157
161
|
*/
|
|
158
162
|
moveWidgetToSecondaryWindow(widget: ExtractableWidget): void {
|
|
159
163
|
if (!this.applicationShell) {
|
|
160
|
-
|
|
164
|
+
this.logger.error('Widget cannot be extracted because the WidgetExtractionHandler has not been initialized.');
|
|
161
165
|
return;
|
|
162
166
|
}
|
|
163
167
|
if (!widget.isExtractable) {
|
|
164
|
-
|
|
168
|
+
this.logger.error('Widget is not extractable.', widget.id);
|
|
165
169
|
return;
|
|
166
170
|
}
|
|
167
171
|
|
|
@@ -185,7 +189,7 @@ export class SecondaryWindowHandler {
|
|
|
185
189
|
|
|
186
190
|
const element = newWindow.document.getElementById('widget-host');
|
|
187
191
|
if (!element) {
|
|
188
|
-
|
|
192
|
+
this.logger.error('Could not find dom element to attach to in secondary window');
|
|
189
193
|
return;
|
|
190
194
|
}
|
|
191
195
|
|
|
@@ -240,18 +244,18 @@ export class SecondaryWindowHandler {
|
|
|
240
244
|
addWidgetToSecondaryWindow(widget: Widget, secondaryWindow: Window, options?: TheiaDockPanel.AddOptions): void {
|
|
241
245
|
const rootWidget = isSecondaryWindow(secondaryWindow) ? secondaryWindow.rootWidget : undefined;
|
|
242
246
|
if (!rootWidget) {
|
|
243
|
-
|
|
247
|
+
this.logger.error('Given secondary window no known root.');
|
|
244
248
|
return;
|
|
245
249
|
}
|
|
246
250
|
|
|
247
251
|
// we allow to add any widget to an existing secondary window unless it is marked as not extractable or is already extracted
|
|
248
252
|
if (ExtractableWidget.is(widget)) {
|
|
249
253
|
if (!widget.isExtractable) {
|
|
250
|
-
|
|
254
|
+
this.logger.error('Widget is not extractable.', widget.id);
|
|
251
255
|
return;
|
|
252
256
|
}
|
|
253
257
|
if (widget.secondaryWindow !== undefined) {
|
|
254
|
-
|
|
258
|
+
this.logger.error('Widget is extracted already.', widget.id);
|
|
255
259
|
return;
|
|
256
260
|
}
|
|
257
261
|
widget.secondaryWindow = secondaryWindow;
|
|
@@ -14,7 +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 { injectable, inject, optional, postConstruct } from 'inversify';
|
|
17
|
+
import { injectable, inject, optional, postConstruct, named } from 'inversify';
|
|
18
18
|
import { ArrayExt, find, toArray, each } from '@lumino/algorithm';
|
|
19
19
|
import {
|
|
20
20
|
BoxLayout, BoxPanel, DockLayout, DockPanel, FocusTracker, Layout, Panel, SplitLayout,
|
|
@@ -46,6 +46,7 @@ import { OpenerService } from '../opener-service';
|
|
|
46
46
|
import { PreviewableWidget } from '../widgets/previewable-widget';
|
|
47
47
|
import { WindowService } from '../window/window-service';
|
|
48
48
|
import { TheiaSplitPanel } from './theia-split-panel';
|
|
49
|
+
import { ILogger } from '../../common/logger';
|
|
49
50
|
|
|
50
51
|
/** The class name added to ApplicationShell instances. */
|
|
51
52
|
export const APPLICATION_SHELL_CLASS = 'theia-ApplicationShell';
|
|
@@ -242,6 +243,9 @@ export class ApplicationShell extends Widget {
|
|
|
242
243
|
@inject(UntitledResourceResolver)
|
|
243
244
|
protected readonly untitledResourceResolver: UntitledResourceResolver;
|
|
244
245
|
|
|
246
|
+
@inject(ILogger) @named('core:ApplicationShell')
|
|
247
|
+
protected readonly logger: ILogger;
|
|
248
|
+
|
|
245
249
|
protected readonly onDidAddWidgetEmitter = new Emitter<Widget>();
|
|
246
250
|
readonly onDidAddWidget = this.onDidAddWidgetEmitter.event;
|
|
247
251
|
protected fireDidAddWidget(widget: Widget): void {
|
|
@@ -595,7 +599,7 @@ export class ApplicationShell extends Widget {
|
|
|
595
599
|
const opener = await this.openerService.getOpener(fileUri);
|
|
596
600
|
opener.open(fileUri);
|
|
597
601
|
} catch (e) {
|
|
598
|
-
|
|
602
|
+
this.logger.info(`no opener found for '${fileUri}'`);
|
|
599
603
|
}
|
|
600
604
|
};
|
|
601
605
|
|
|
@@ -975,7 +979,7 @@ export class ApplicationShell extends Widget {
|
|
|
975
979
|
*/
|
|
976
980
|
async addWidget(widget: Widget, options?: Readonly<ApplicationShell.WidgetOptions>): Promise<void> {
|
|
977
981
|
if (!widget.id) {
|
|
978
|
-
|
|
982
|
+
this.logger.error('Widgets added to the application shell must have a unique id property.');
|
|
979
983
|
return;
|
|
980
984
|
}
|
|
981
985
|
const { area, addOptions } = this.getInsertionOptions(options);
|
|
@@ -1430,7 +1434,7 @@ export class ApplicationShell extends Widget {
|
|
|
1430
1434
|
if (delta < this.activationTimeout) {
|
|
1431
1435
|
request = setTimeout(step, 0);
|
|
1432
1436
|
} else {
|
|
1433
|
-
|
|
1437
|
+
this.logger.warn(`Widget was activated, but did not accept focus after ${this.activationTimeout}ms: ${widget.id}`);
|
|
1434
1438
|
}
|
|
1435
1439
|
};
|
|
1436
1440
|
let request = setTimeout(step, 0);
|
|
@@ -19,6 +19,8 @@ import { Container } from 'inversify';
|
|
|
19
19
|
import { createTreeContainer, isTreeServices } from './tree-container';
|
|
20
20
|
import { TreeSearch } from './tree-search';
|
|
21
21
|
import { defaultTreeProps, TreeProps } from './tree-widget';
|
|
22
|
+
import { ILogger } from '../../common/logger';
|
|
23
|
+
import { MockLogger } from '../../common/test/mock-logger';
|
|
22
24
|
|
|
23
25
|
describe('TreeContainer', () => {
|
|
24
26
|
describe('IsTreeServices should accurately distinguish TreeProps from TreeContainerProps', () => {
|
|
@@ -33,11 +35,15 @@ describe('TreeContainer', () => {
|
|
|
33
35
|
const nonDefault = { search: !defaultTreeProps.search, contextMenu: ['no-default-for-this'] };
|
|
34
36
|
it('should use props passed in as just props', () => {
|
|
35
37
|
const parent = new Container();
|
|
38
|
+
parent.bind(ILogger).to(MockLogger).inSingletonScope();
|
|
39
|
+
|
|
36
40
|
const child = createTreeContainer(parent, nonDefault);
|
|
37
41
|
assert.deepStrictEqual(child.get(TreeProps), { ...defaultTreeProps, ...nonDefault });
|
|
38
42
|
});
|
|
39
43
|
it('should use props passed in as part of TreeContainerProps', () => {
|
|
40
44
|
const parent = new Container();
|
|
45
|
+
parent.bind(ILogger).to(MockLogger).inSingletonScope();
|
|
46
|
+
|
|
41
47
|
const child = createTreeContainer(parent, { props: nonDefault });
|
|
42
48
|
assert.deepStrictEqual(child.get(TreeProps), { ...defaultTreeProps, ...nonDefault });
|
|
43
49
|
});
|
package/src/browser/tree/tree.ts
CHANGED
|
@@ -14,13 +14,14 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { injectable } from 'inversify';
|
|
17
|
+
import { injectable, inject, named } from 'inversify';
|
|
18
18
|
import { Event, Emitter, WaitUntilEvent } from '../../common/event';
|
|
19
19
|
import { Disposable, DisposableCollection } from '../../common/disposable';
|
|
20
20
|
import { CancellationToken, CancellationTokenSource } from '../../common/cancellation';
|
|
21
21
|
import { timeout } from '../../common/promise-util';
|
|
22
22
|
import { isObject, Mutable } from '../../common';
|
|
23
23
|
import { AccessibilityInformation } from '../../common/accessibility';
|
|
24
|
+
import { ILogger } from '../../common/logger';
|
|
24
25
|
|
|
25
26
|
export const Tree = Symbol('Tree');
|
|
26
27
|
|
|
@@ -250,6 +251,9 @@ export namespace CompositeTreeNode {
|
|
|
250
251
|
@injectable()
|
|
251
252
|
export class TreeImpl implements Tree {
|
|
252
253
|
|
|
254
|
+
@inject(ILogger) @named('core:TreeImpl')
|
|
255
|
+
protected readonly logger: ILogger;
|
|
256
|
+
|
|
253
257
|
protected _root: TreeNode | undefined;
|
|
254
258
|
protected readonly onChangedEmitter = new Emitter<void>();
|
|
255
259
|
protected readonly onNodeRefreshedEmitter = new Emitter<CompositeTreeNode & WaitUntilEvent>();
|
|
@@ -344,7 +348,7 @@ export class TreeImpl implements Tree {
|
|
|
344
348
|
protected async setChildren(parent: CompositeTreeNode, children: TreeNode[]): Promise<CompositeTreeNode | undefined> {
|
|
345
349
|
const root = this.getRootNode(parent);
|
|
346
350
|
if (this.nodes[root.id] && this.nodes[root.id] !== root) {
|
|
347
|
-
|
|
351
|
+
this.logger.error(`Child node '${parent.id}' does not belong to this '${root.id}' tree.`);
|
|
348
352
|
return undefined;
|
|
349
353
|
}
|
|
350
354
|
this.removeNode(parent);
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { Container } from 'inversify';
|
|
18
|
-
import { ContributionProvider } from '../../common';
|
|
18
|
+
import { ContributionProvider, ILogger } from '../../common';
|
|
19
19
|
import { CorePreferences } from '../../common/core-preferences';
|
|
20
20
|
import { FrontendApplicationContribution } from '../frontend-application-contribution';
|
|
21
21
|
import { DefaultWindowService } from './default-window-service';
|
|
22
22
|
import assert = require('assert');
|
|
23
|
+
import { MockLogger } from '../../common/test/mock-logger';
|
|
23
24
|
|
|
24
25
|
describe('DefaultWindowService', () => {
|
|
25
26
|
class TestFrontendApplicationContribution implements FrontendApplicationContribution {
|
|
@@ -42,6 +43,7 @@ describe('DefaultWindowService', () => {
|
|
|
42
43
|
.toConstantValue({
|
|
43
44
|
'application.confirmExit': confirmExit,
|
|
44
45
|
});
|
|
46
|
+
container.bind(ILogger).to(MockLogger).inSingletonScope();
|
|
45
47
|
return container.get(DefaultWindowService);
|
|
46
48
|
}
|
|
47
49
|
it('onWillStop should be called on every contribution (never)', () => {
|