@theia/workspace 1.45.1 → 1.46.0-next.72
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/README.md +30 -30
- package/lib/browser/canonical-uri-service.d.ts +11 -11
- package/lib/browser/canonical-uri-service.js +59 -59
- package/lib/browser/diff-service.d.ts +10 -10
- package/lib/browser/diff-service.js +85 -85
- package/lib/browser/index.d.ts +7 -7
- package/lib/browser/index.js +34 -34
- package/lib/browser/quick-open-workspace.d.ts +25 -25
- package/lib/browser/quick-open-workspace.js +137 -137
- package/lib/browser/untitled-workspace-exit-dialog.d.ts +19 -19
- package/lib/browser/untitled-workspace-exit-dialog.js +74 -74
- package/lib/browser/workspace-breadcrumbs-contribution.d.ts +10 -10
- package/lib/browser/workspace-breadcrumbs-contribution.js +66 -66
- package/lib/browser/workspace-commands.d.ts +117 -117
- package/lib/browser/workspace-commands.js +601 -601
- package/lib/browser/workspace-commands.spec.d.ts +1 -1
- package/lib/browser/workspace-commands.spec.js +127 -127
- package/lib/browser/workspace-compare-handler.d.ts +26 -26
- package/lib/browser/workspace-compare-handler.js +66 -66
- package/lib/browser/workspace-delete-handler.d.ts +75 -75
- package/lib/browser/workspace-delete-handler.js +214 -214
- package/lib/browser/workspace-duplicate-handler.d.ts +30 -30
- package/lib/browser/workspace-duplicate-handler.js +86 -86
- package/lib/browser/workspace-frontend-contribution.d.ts +110 -110
- package/lib/browser/workspace-frontend-contribution.js +546 -546
- package/lib/browser/workspace-frontend-contribution.js.map +1 -1
- package/lib/browser/workspace-frontend-module.d.ts +3 -3
- package/lib/browser/workspace-frontend-module.js +91 -91
- package/lib/browser/workspace-input-dialog.d.ts +19 -19
- package/lib/browser/workspace-input-dialog.js +74 -74
- package/lib/browser/workspace-preferences.d.ts +11 -11
- package/lib/browser/workspace-preferences.js +46 -46
- package/lib/browser/workspace-schema-updater.d.ts +34 -34
- package/lib/browser/workspace-schema-updater.js +153 -153
- package/lib/browser/workspace-service.d.ts +184 -184
- package/lib/browser/workspace-service.js +739 -739
- package/lib/browser/workspace-storage-service.d.ts +15 -15
- package/lib/browser/workspace-storage-service.js +80 -80
- package/lib/browser/workspace-trust-preferences.d.ts +21 -21
- package/lib/browser/workspace-trust-preferences.js +65 -65
- package/lib/browser/workspace-trust-service.d.ts +27 -27
- package/lib/browser/workspace-trust-service.js +152 -152
- package/lib/browser/workspace-uri-contribution.d.ts +20 -20
- package/lib/browser/workspace-uri-contribution.js +113 -113
- package/lib/browser/workspace-uri-contribution.spec.d.ts +1 -1
- package/lib/browser/workspace-uri-contribution.spec.js +169 -169
- package/lib/browser/workspace-user-working-directory-provider.d.ts +12 -12
- package/lib/browser/workspace-user-working-directory-provider.js +62 -62
- package/lib/browser/workspace-utils.d.ts +15 -15
- package/lib/browser/workspace-utils.js +54 -54
- package/lib/browser/workspace-variable-contribution.d.ts +23 -23
- package/lib/browser/workspace-variable-contribution.js +237 -237
- package/lib/browser/workspace-window-title-updater.d.ts +7 -7
- package/lib/browser/workspace-window-title-updater.js +57 -57
- package/lib/browser-only/browser-only-workspace-server.d.ts +13 -0
- package/lib/browser-only/browser-only-workspace-server.d.ts.map +1 -0
- package/lib/browser-only/browser-only-workspace-server.js +81 -0
- package/lib/browser-only/browser-only-workspace-server.js.map +1 -0
- package/lib/browser-only/workspace-frontend-only-module.d.ts +4 -0
- package/lib/browser-only/workspace-frontend-only-module.d.ts.map +1 -0
- package/lib/browser-only/workspace-frontend-only-module.js +30 -0
- package/lib/browser-only/workspace-frontend-only-module.js.map +1 -0
- package/lib/common/index.d.ts +3 -3
- package/lib/common/index.js +30 -30
- package/lib/common/test/mock-workspace-server.d.ts +7 -7
- package/lib/common/test/mock-workspace-server.js +35 -35
- package/lib/common/untitled-workspace-service.d.ts +8 -8
- package/lib/common/untitled-workspace-service.js +60 -60
- package/lib/common/workspace-file-service.d.ts +26 -26
- package/lib/common/workspace-file-service.js +71 -71
- package/lib/common/workspace-protocol.d.ts +26 -26
- package/lib/common/workspace-protocol.js +23 -23
- package/lib/node/default-workspace-server.d.ts +65 -65
- package/lib/node/default-workspace-server.js +248 -248
- package/lib/node/default-workspace-server.spec.d.ts +1 -1
- package/lib/node/default-workspace-server.spec.js +85 -85
- package/lib/node/index.d.ts +2 -2
- package/lib/node/index.js +29 -29
- package/lib/node/workspace-backend-module.d.ts +3 -3
- package/lib/node/workspace-backend-module.js +33 -33
- package/package.json +9 -6
- package/src/browser/canonical-uri-service.ts +57 -57
- package/src/browser/diff-service.ts +62 -62
- package/src/browser/index.ts +23 -23
- package/src/browser/quick-open-workspace.ts +112 -112
- package/src/browser/untitled-workspace-exit-dialog.ts +70 -70
- package/src/browser/workspace-breadcrumbs-contribution.ts +56 -56
- package/src/browser/workspace-commands.spec.ts +153 -153
- package/src/browser/workspace-commands.ts +588 -588
- package/src/browser/workspace-compare-handler.ts +56 -56
- package/src/browser/workspace-delete-handler.ts +212 -212
- package/src/browser/workspace-duplicate-handler.ts +75 -75
- package/src/browser/workspace-frontend-contribution.ts +537 -537
- package/src/browser/workspace-frontend-module.ts +118 -118
- package/src/browser/workspace-input-dialog.ts +61 -61
- package/src/browser/workspace-preferences.ts +58 -58
- package/src/browser/workspace-schema-updater.ts +150 -150
- package/src/browser/workspace-service.ts +780 -780
- package/src/browser/workspace-storage-service.ts +67 -67
- package/src/browser/workspace-trust-preferences.ts +76 -76
- package/src/browser/workspace-trust-service.ts +147 -147
- package/src/browser/workspace-uri-contribution.spec.ts +191 -191
- package/src/browser/workspace-uri-contribution.ts +97 -97
- package/src/browser/workspace-user-working-directory-provider.ts +49 -49
- package/src/browser/workspace-utils.ts +45 -45
- package/src/browser/workspace-variable-contribution.ts +222 -222
- package/src/browser/workspace-window-title-updater.ts +45 -45
- package/src/browser-only/browser-only-workspace-server.ts +69 -0
- package/src/browser-only/workspace-frontend-only-module.ts +28 -0
- package/src/common/index.ts +19 -19
- package/src/common/test/mock-workspace-server.ts +29 -29
- package/src/common/untitled-workspace-service.ts +50 -50
- package/src/common/workspace-file-service.ts +72 -72
- package/src/common/workspace-protocol.ts +47 -47
- package/src/node/default-workspace-server.spec.ts +100 -100
- package/src/node/default-workspace-server.ts +244 -244
- package/src/node/index.ts +18 -18
- package/src/node/workspace-backend-module.ts +38 -38
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2022 Alexander Flammer 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 { Container } from '@theia/core/shared/inversify';
|
|
18
|
-
import { MockEnvVariablesServerImpl } from '@theia/core/lib/browser/test/mock-env-variables-server';
|
|
19
|
-
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
20
|
-
import URI from '@theia/core/lib/common/uri';
|
|
21
|
-
import { FileUri } from '@theia/core/lib/node';
|
|
22
|
-
import { WorkspaceFileService, UntitledWorkspaceService } from '../common';
|
|
23
|
-
import { DefaultWorkspaceServer, WorkspaceCliContribution } from './default-workspace-server';
|
|
24
|
-
import { expect } from 'chai';
|
|
25
|
-
import * as temp from 'temp';
|
|
26
|
-
import * as fs from 'fs';
|
|
27
|
-
|
|
28
|
-
describe('DefaultWorkspaceServer', function (): void {
|
|
29
|
-
|
|
30
|
-
describe('getRecentWorkspaces()', async () => {
|
|
31
|
-
let workspaceServer: DefaultWorkspaceServer;
|
|
32
|
-
let tmpConfigDir: URI;
|
|
33
|
-
let recentWorkspaceFile: string;
|
|
34
|
-
|
|
35
|
-
beforeEach(() => {
|
|
36
|
-
// create a temporary directory
|
|
37
|
-
const tempDirPath = temp.track().mkdirSync();
|
|
38
|
-
tmpConfigDir = FileUri.create(fs.realpathSync(tempDirPath));
|
|
39
|
-
recentWorkspaceFile = FileUri.fsPath(tmpConfigDir.resolve('recentworkspace.json'));
|
|
40
|
-
|
|
41
|
-
// create a container with the necessary bindings for the DefaultWorkspaceServer
|
|
42
|
-
const container = new Container();
|
|
43
|
-
container.bind(WorkspaceCliContribution).toSelf().inSingletonScope();
|
|
44
|
-
container.bind(DefaultWorkspaceServer).toSelf().inSingletonScope();
|
|
45
|
-
container.bind(WorkspaceFileService).toSelf().inSingletonScope();
|
|
46
|
-
container.bind(UntitledWorkspaceService).toSelf().inSingletonScope();
|
|
47
|
-
container.bind(EnvVariablesServer).toConstantValue(new MockEnvVariablesServerImpl(tmpConfigDir));
|
|
48
|
-
|
|
49
|
-
workspaceServer = container.get(DefaultWorkspaceServer);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should return empty list of workspaces if no recent workspaces file is existing', async function (): Promise<void> {
|
|
53
|
-
const recent = await workspaceServer.getRecentWorkspaces();
|
|
54
|
-
expect(recent).to.be.empty;
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('should not return non-existing workspaces from recent workspaces file', async function (): Promise<void> {
|
|
58
|
-
fs.writeFileSync(recentWorkspaceFile, JSON.stringify({
|
|
59
|
-
recentRoots: [
|
|
60
|
-
tmpConfigDir.resolve('somethingNotExisting').toString(),
|
|
61
|
-
tmpConfigDir.resolve('somethingElseNotExisting').toString()
|
|
62
|
-
]
|
|
63
|
-
}));
|
|
64
|
-
|
|
65
|
-
const recent = await workspaceServer.getRecentWorkspaces();
|
|
66
|
-
|
|
67
|
-
expect(recent).to.be.empty;
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('should return only existing workspaces from recent workspaces file', async function (): Promise<void> {
|
|
71
|
-
fs.writeFileSync(recentWorkspaceFile, JSON.stringify({
|
|
72
|
-
recentRoots: [
|
|
73
|
-
tmpConfigDir.toString(),
|
|
74
|
-
tmpConfigDir.resolve('somethingNotExisting').toString()
|
|
75
|
-
]
|
|
76
|
-
}));
|
|
77
|
-
|
|
78
|
-
const recent = await workspaceServer.getRecentWorkspaces();
|
|
79
|
-
|
|
80
|
-
expect(recent).to.have.members([tmpConfigDir.toString()]);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('should ignore non-string array entries but return remaining existing file paths', async function (): Promise<void> {
|
|
84
|
-
// previously caused: 'TypeError: Cannot read property 'fsPath' of undefined', see issue #10250
|
|
85
|
-
fs.writeFileSync(recentWorkspaceFile, JSON.stringify({
|
|
86
|
-
recentRoots: [
|
|
87
|
-
[tmpConfigDir.toString()],
|
|
88
|
-
{},
|
|
89
|
-
12345678,
|
|
90
|
-
undefined,
|
|
91
|
-
tmpConfigDir.toString(),
|
|
92
|
-
]
|
|
93
|
-
}));
|
|
94
|
-
|
|
95
|
-
const recent = await workspaceServer.getRecentWorkspaces();
|
|
96
|
-
|
|
97
|
-
expect(recent).to.have.members([tmpConfigDir.toString()]);
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
});
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2022 Alexander Flammer 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 { Container } from '@theia/core/shared/inversify';
|
|
18
|
+
import { MockEnvVariablesServerImpl } from '@theia/core/lib/browser/test/mock-env-variables-server';
|
|
19
|
+
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
20
|
+
import URI from '@theia/core/lib/common/uri';
|
|
21
|
+
import { FileUri } from '@theia/core/lib/node';
|
|
22
|
+
import { WorkspaceFileService, UntitledWorkspaceService } from '../common';
|
|
23
|
+
import { DefaultWorkspaceServer, WorkspaceCliContribution } from './default-workspace-server';
|
|
24
|
+
import { expect } from 'chai';
|
|
25
|
+
import * as temp from 'temp';
|
|
26
|
+
import * as fs from 'fs';
|
|
27
|
+
|
|
28
|
+
describe('DefaultWorkspaceServer', function (): void {
|
|
29
|
+
|
|
30
|
+
describe('getRecentWorkspaces()', async () => {
|
|
31
|
+
let workspaceServer: DefaultWorkspaceServer;
|
|
32
|
+
let tmpConfigDir: URI;
|
|
33
|
+
let recentWorkspaceFile: string;
|
|
34
|
+
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
// create a temporary directory
|
|
37
|
+
const tempDirPath = temp.track().mkdirSync();
|
|
38
|
+
tmpConfigDir = FileUri.create(fs.realpathSync(tempDirPath));
|
|
39
|
+
recentWorkspaceFile = FileUri.fsPath(tmpConfigDir.resolve('recentworkspace.json'));
|
|
40
|
+
|
|
41
|
+
// create a container with the necessary bindings for the DefaultWorkspaceServer
|
|
42
|
+
const container = new Container();
|
|
43
|
+
container.bind(WorkspaceCliContribution).toSelf().inSingletonScope();
|
|
44
|
+
container.bind(DefaultWorkspaceServer).toSelf().inSingletonScope();
|
|
45
|
+
container.bind(WorkspaceFileService).toSelf().inSingletonScope();
|
|
46
|
+
container.bind(UntitledWorkspaceService).toSelf().inSingletonScope();
|
|
47
|
+
container.bind(EnvVariablesServer).toConstantValue(new MockEnvVariablesServerImpl(tmpConfigDir));
|
|
48
|
+
|
|
49
|
+
workspaceServer = container.get(DefaultWorkspaceServer);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should return empty list of workspaces if no recent workspaces file is existing', async function (): Promise<void> {
|
|
53
|
+
const recent = await workspaceServer.getRecentWorkspaces();
|
|
54
|
+
expect(recent).to.be.empty;
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should not return non-existing workspaces from recent workspaces file', async function (): Promise<void> {
|
|
58
|
+
fs.writeFileSync(recentWorkspaceFile, JSON.stringify({
|
|
59
|
+
recentRoots: [
|
|
60
|
+
tmpConfigDir.resolve('somethingNotExisting').toString(),
|
|
61
|
+
tmpConfigDir.resolve('somethingElseNotExisting').toString()
|
|
62
|
+
]
|
|
63
|
+
}));
|
|
64
|
+
|
|
65
|
+
const recent = await workspaceServer.getRecentWorkspaces();
|
|
66
|
+
|
|
67
|
+
expect(recent).to.be.empty;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should return only existing workspaces from recent workspaces file', async function (): Promise<void> {
|
|
71
|
+
fs.writeFileSync(recentWorkspaceFile, JSON.stringify({
|
|
72
|
+
recentRoots: [
|
|
73
|
+
tmpConfigDir.toString(),
|
|
74
|
+
tmpConfigDir.resolve('somethingNotExisting').toString()
|
|
75
|
+
]
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
const recent = await workspaceServer.getRecentWorkspaces();
|
|
79
|
+
|
|
80
|
+
expect(recent).to.have.members([tmpConfigDir.toString()]);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('should ignore non-string array entries but return remaining existing file paths', async function (): Promise<void> {
|
|
84
|
+
// previously caused: 'TypeError: Cannot read property 'fsPath' of undefined', see issue #10250
|
|
85
|
+
fs.writeFileSync(recentWorkspaceFile, JSON.stringify({
|
|
86
|
+
recentRoots: [
|
|
87
|
+
[tmpConfigDir.toString()],
|
|
88
|
+
{},
|
|
89
|
+
12345678,
|
|
90
|
+
undefined,
|
|
91
|
+
tmpConfigDir.toString(),
|
|
92
|
+
]
|
|
93
|
+
}));
|
|
94
|
+
|
|
95
|
+
const recent = await workspaceServer.getRecentWorkspaces();
|
|
96
|
+
|
|
97
|
+
expect(recent).to.have.members([tmpConfigDir.toString()]);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
});
|