@theia/workspace 1.53.0-next.55 → 1.53.0-next.64

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 (45) hide show
  1. package/README.md +30 -30
  2. package/lib/browser/workspace-trust-preferences.d.ts.map +1 -1
  3. package/lib/browser/workspace-trust-preferences.js +1 -0
  4. package/lib/browser/workspace-trust-preferences.js.map +1 -1
  5. package/lib/browser/workspace-trust-service.d.ts.map +1 -1
  6. package/lib/browser/workspace-trust-service.js +11 -9
  7. package/lib/browser/workspace-trust-service.js.map +1 -1
  8. package/package.json +5 -5
  9. package/src/browser/canonical-uri-service.ts +57 -57
  10. package/src/browser/diff-service.ts +62 -62
  11. package/src/browser/index.ts +23 -23
  12. package/src/browser/quick-open-workspace.ts +112 -112
  13. package/src/browser/untitled-workspace-exit-dialog.ts +70 -70
  14. package/src/browser/workspace-breadcrumbs-contribution.ts +56 -56
  15. package/src/browser/workspace-commands.spec.ts +153 -153
  16. package/src/browser/workspace-commands.ts +557 -557
  17. package/src/browser/workspace-compare-handler.ts +56 -56
  18. package/src/browser/workspace-delete-handler.ts +212 -212
  19. package/src/browser/workspace-duplicate-handler.ts +75 -75
  20. package/src/browser/workspace-frontend-contribution.ts +537 -537
  21. package/src/browser/workspace-frontend-module.ts +118 -118
  22. package/src/browser/workspace-input-dialog.ts +61 -61
  23. package/src/browser/workspace-preferences.ts +58 -58
  24. package/src/browser/workspace-schema-updater.ts +150 -150
  25. package/src/browser/workspace-service.ts +780 -780
  26. package/src/browser/workspace-storage-service.ts +67 -67
  27. package/src/browser/workspace-trust-preferences.ts +77 -76
  28. package/src/browser/workspace-trust-service.ts +154 -152
  29. package/src/browser/workspace-uri-contribution.spec.ts +191 -191
  30. package/src/browser/workspace-uri-contribution.ts +97 -97
  31. package/src/browser/workspace-user-working-directory-provider.ts +49 -49
  32. package/src/browser/workspace-utils.ts +45 -45
  33. package/src/browser/workspace-variable-contribution.ts +222 -222
  34. package/src/browser/workspace-window-title-updater.ts +45 -45
  35. package/src/browser-only/browser-only-workspace-server.ts +69 -69
  36. package/src/browser-only/workspace-frontend-only-module.ts +28 -28
  37. package/src/common/index.ts +19 -19
  38. package/src/common/test/mock-workspace-server.ts +29 -29
  39. package/src/common/untitled-workspace-service.ts +50 -50
  40. package/src/common/workspace-file-service.ts +72 -72
  41. package/src/common/workspace-protocol.ts +47 -47
  42. package/src/node/default-workspace-server.spec.ts +100 -100
  43. package/src/node/default-workspace-server.ts +244 -244
  44. package/src/node/index.ts +18 -18
  45. package/src/node/workspace-backend-module.ts +38 -38
@@ -1,47 +1,47 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2017 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
- export const workspacePath = '/services/workspace';
18
-
19
- /**
20
- * The JSON-RPC workspace interface.
21
- */
22
- export const WorkspaceServer = Symbol('WorkspaceServer');
23
- export interface WorkspaceServer {
24
-
25
- /**
26
- * Returns with a promise that resolves to the most recently used workspace folder URI as a string.
27
- * Resolves to `undefined` if the workspace folder is not yet set.
28
- */
29
- getMostRecentlyUsedWorkspace(): Promise<string | undefined>;
30
-
31
- /**
32
- * Sets the desired string representation of the URI as the most recently used workspace folder.
33
- */
34
- setMostRecentlyUsedWorkspace(uri: string): Promise<void>;
35
-
36
- /**
37
- * Removes a workspace from the list of recently opened workspaces.
38
- *
39
- * @param uri the workspace uri.
40
- */
41
- removeRecentWorkspace(uri: string): Promise<void>;
42
-
43
- /**
44
- * Returns list of recently opened workspaces as an array.
45
- */
46
- getRecentWorkspaces(): Promise<string[]>
47
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2017 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
+ export const workspacePath = '/services/workspace';
18
+
19
+ /**
20
+ * The JSON-RPC workspace interface.
21
+ */
22
+ export const WorkspaceServer = Symbol('WorkspaceServer');
23
+ export interface WorkspaceServer {
24
+
25
+ /**
26
+ * Returns with a promise that resolves to the most recently used workspace folder URI as a string.
27
+ * Resolves to `undefined` if the workspace folder is not yet set.
28
+ */
29
+ getMostRecentlyUsedWorkspace(): Promise<string | undefined>;
30
+
31
+ /**
32
+ * Sets the desired string representation of the URI as the most recently used workspace folder.
33
+ */
34
+ setMostRecentlyUsedWorkspace(uri: string): Promise<void>;
35
+
36
+ /**
37
+ * Removes a workspace from the list of recently opened workspaces.
38
+ *
39
+ * @param uri the workspace uri.
40
+ */
41
+ removeRecentWorkspace(uri: string): Promise<void>;
42
+
43
+ /**
44
+ * Returns list of recently opened workspaces as an array.
45
+ */
46
+ getRecentWorkspaces(): Promise<string[]>
47
+ }
@@ -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
+ });