@theia/workspace 1.67.0-next.13 → 1.67.0-next.56
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 +1 -1
- package/package.json +5 -5
- package/src/browser/diff-service.ts +6 -12
- package/src/browser/workspace-schema-updater.ts +3 -3
- package/src/browser/workspace-service.ts +2 -2
- package/src/browser/workspace-variable-contribution.ts +13 -12
- package/lib/browser/canonical-uri-service.d.ts +0 -12
- package/lib/browser/canonical-uri-service.d.ts.map +0 -1
- package/lib/browser/canonical-uri-service.js +0 -55
- package/lib/browser/canonical-uri-service.js.map +0 -1
- package/lib/browser/diff-service.d.ts +0 -11
- package/lib/browser/diff-service.d.ts.map +0 -1
- package/lib/browser/diff-service.js +0 -78
- package/lib/browser/diff-service.js.map +0 -1
- package/lib/browser/index.d.ts +0 -7
- package/lib/browser/index.d.ts.map +0 -1
- package/lib/browser/index.js +0 -25
- package/lib/browser/index.js.map +0 -1
- package/lib/browser/quick-open-workspace.d.ts +0 -18
- package/lib/browser/quick-open-workspace.d.ts.map +0 -1
- package/lib/browser/quick-open-workspace.js +0 -112
- package/lib/browser/quick-open-workspace.js.map +0 -1
- package/lib/browser/untitled-workspace-exit-dialog.d.ts +0 -20
- package/lib/browser/untitled-workspace-exit-dialog.d.ts.map +0 -1
- package/lib/browser/untitled-workspace-exit-dialog.js +0 -64
- package/lib/browser/untitled-workspace-exit-dialog.js.map +0 -1
- package/lib/browser/workspace-breadcrumbs-contribution.d.ts +0 -11
- package/lib/browser/workspace-breadcrumbs-contribution.d.ts.map +0 -1
- package/lib/browser/workspace-breadcrumbs-contribution.js +0 -59
- package/lib/browser/workspace-breadcrumbs-contribution.js.map +0 -1
- package/lib/browser/workspace-commands.d.ts +0 -116
- package/lib/browser/workspace-commands.d.ts.map +0 -1
- package/lib/browser/workspace-commands.js +0 -568
- package/lib/browser/workspace-commands.js.map +0 -1
- package/lib/browser/workspace-commands.spec.d.ts +0 -2
- package/lib/browser/workspace-commands.spec.d.ts.map +0 -1
- package/lib/browser/workspace-commands.spec.js +0 -128
- package/lib/browser/workspace-commands.spec.js.map +0 -1
- package/lib/browser/workspace-compare-handler.d.ts +0 -27
- package/lib/browser/workspace-compare-handler.d.ts.map +0 -1
- package/lib/browser/workspace-compare-handler.js +0 -59
- package/lib/browser/workspace-compare-handler.js.map +0 -1
- package/lib/browser/workspace-delete-handler.d.ts +0 -76
- package/lib/browser/workspace-delete-handler.d.ts.map +0 -1
- package/lib/browser/workspace-delete-handler.js +0 -207
- package/lib/browser/workspace-delete-handler.js.map +0 -1
- package/lib/browser/workspace-duplicate-handler.d.ts +0 -31
- package/lib/browser/workspace-duplicate-handler.d.ts.map +0 -1
- package/lib/browser/workspace-duplicate-handler.js +0 -79
- package/lib/browser/workspace-duplicate-handler.js.map +0 -1
- package/lib/browser/workspace-frontend-contribution.d.ts +0 -111
- package/lib/browser/workspace-frontend-contribution.d.ts.map +0 -1
- package/lib/browser/workspace-frontend-contribution.js +0 -538
- package/lib/browser/workspace-frontend-contribution.js.map +0 -1
- package/lib/browser/workspace-frontend-module.d.ts +0 -4
- package/lib/browser/workspace-frontend-module.d.ts.map +0 -1
- package/lib/browser/workspace-frontend-module.js +0 -93
- package/lib/browser/workspace-frontend-module.js.map +0 -1
- package/lib/browser/workspace-input-dialog.d.ts +0 -20
- package/lib/browser/workspace-input-dialog.d.ts.map +0 -1
- package/lib/browser/workspace-input-dialog.js +0 -64
- package/lib/browser/workspace-input-dialog.js.map +0 -1
- package/lib/browser/workspace-schema-updater.d.ts +0 -34
- package/lib/browser/workspace-schema-updater.d.ts.map +0 -1
- package/lib/browser/workspace-schema-updater.js +0 -147
- package/lib/browser/workspace-schema-updater.js.map +0 -1
- package/lib/browser/workspace-service.d.ts +0 -201
- package/lib/browser/workspace-service.d.ts.map +0 -1
- package/lib/browser/workspace-service.js +0 -753
- package/lib/browser/workspace-service.js.map +0 -1
- package/lib/browser/workspace-storage-service.d.ts +0 -16
- package/lib/browser/workspace-storage-service.d.ts.map +0 -1
- package/lib/browser/workspace-storage-service.js +0 -73
- package/lib/browser/workspace-storage-service.js.map +0 -1
- package/lib/browser/workspace-trust-service.d.ts +0 -30
- package/lib/browser/workspace-trust-service.d.ts.map +0 -1
- package/lib/browser/workspace-trust-service.js +0 -153
- package/lib/browser/workspace-trust-service.js.map +0 -1
- package/lib/browser/workspace-uri-contribution.d.ts +0 -21
- package/lib/browser/workspace-uri-contribution.d.ts.map +0 -1
- package/lib/browser/workspace-uri-contribution.js +0 -106
- package/lib/browser/workspace-uri-contribution.js.map +0 -1
- package/lib/browser/workspace-uri-contribution.spec.d.ts +0 -2
- package/lib/browser/workspace-uri-contribution.spec.d.ts.map +0 -1
- package/lib/browser/workspace-uri-contribution.spec.js +0 -170
- package/lib/browser/workspace-uri-contribution.spec.js.map +0 -1
- package/lib/browser/workspace-user-working-directory-provider.d.ts +0 -13
- package/lib/browser/workspace-user-working-directory-provider.d.ts.map +0 -1
- package/lib/browser/workspace-user-working-directory-provider.js +0 -55
- package/lib/browser/workspace-user-working-directory-provider.js.map +0 -1
- package/lib/browser/workspace-utils.d.ts +0 -16
- package/lib/browser/workspace-utils.d.ts.map +0 -1
- package/lib/browser/workspace-utils.js +0 -47
- package/lib/browser/workspace-utils.js.map +0 -1
- package/lib/browser/workspace-variable-contribution.d.ts +0 -24
- package/lib/browser/workspace-variable-contribution.d.ts.map +0 -1
- package/lib/browser/workspace-variable-contribution.js +0 -230
- package/lib/browser/workspace-variable-contribution.js.map +0 -1
- package/lib/browser/workspace-window-title-updater.d.ts +0 -8
- package/lib/browser/workspace-window-title-updater.d.ts.map +0 -1
- package/lib/browser/workspace-window-title-updater.js +0 -50
- package/lib/browser/workspace-window-title-updater.js.map +0 -1
- package/lib/browser-only/browser-only-workspace-server.d.ts +0 -13
- package/lib/browser-only/browser-only-workspace-server.d.ts.map +0 -1
- package/lib/browser-only/browser-only-workspace-server.js +0 -73
- package/lib/browser-only/browser-only-workspace-server.js.map +0 -1
- package/lib/browser-only/workspace-frontend-only-module.d.ts +0 -4
- package/lib/browser-only/workspace-frontend-only-module.d.ts.map +0 -1
- package/lib/browser-only/workspace-frontend-only-module.js +0 -30
- package/lib/browser-only/workspace-frontend-only-module.js.map +0 -1
- package/lib/common/index.d.ts +0 -5
- package/lib/common/index.d.ts.map +0 -1
- package/lib/common/index.js +0 -23
- package/lib/common/index.js.map +0 -1
- package/lib/common/test/mock-workspace-server.d.ts +0 -8
- package/lib/common/test/mock-workspace-server.d.ts.map +0 -1
- package/lib/common/test/mock-workspace-server.js +0 -31
- package/lib/common/test/mock-workspace-server.js.map +0 -1
- package/lib/common/untitled-workspace-service.d.ts +0 -9
- package/lib/common/untitled-workspace-service.d.ts.map +0 -1
- package/lib/common/untitled-workspace-service.js +0 -53
- package/lib/common/untitled-workspace-service.js.map +0 -1
- package/lib/common/workspace-file-service.d.ts +0 -27
- package/lib/common/workspace-file-service.d.ts.map +0 -1
- package/lib/common/workspace-file-service.js +0 -67
- package/lib/common/workspace-file-service.js.map +0 -1
- package/lib/common/workspace-preferences.d.ts +0 -12
- package/lib/common/workspace-preferences.d.ts.map +0 -1
- package/lib/common/workspace-preferences.js +0 -46
- package/lib/common/workspace-preferences.js.map +0 -1
- package/lib/common/workspace-protocol.d.ts +0 -27
- package/lib/common/workspace-protocol.d.ts.map +0 -1
- package/lib/common/workspace-protocol.js +0 -24
- package/lib/common/workspace-protocol.js.map +0 -1
- package/lib/common/workspace-trust-preferences.d.ts +0 -22
- package/lib/common/workspace-trust-preferences.d.ts.map +0 -1
- package/lib/common/workspace-trust-preferences.js +0 -66
- package/lib/common/workspace-trust-preferences.js.map +0 -1
- package/lib/node/default-workspace-server.d.ts +0 -78
- package/lib/node/default-workspace-server.d.ts.map +0 -1
- package/lib/node/default-workspace-server.js +0 -265
- package/lib/node/default-workspace-server.js.map +0 -1
- package/lib/node/default-workspace-server.spec.d.ts +0 -2
- package/lib/node/default-workspace-server.spec.d.ts.map +0 -1
- package/lib/node/default-workspace-server.spec.js +0 -96
- package/lib/node/default-workspace-server.spec.js.map +0 -1
- package/lib/node/index.d.ts +0 -3
- package/lib/node/index.d.ts.map +0 -1
- package/lib/node/index.js +0 -21
- package/lib/node/index.js.map +0 -1
- package/lib/node/workspace-backend-module.d.ts +0 -4
- package/lib/node/workspace-backend-module.d.ts.map +0 -1
- package/lib/node/workspace-backend-module.js +0 -40
- package/lib/node/workspace-backend-module.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-trust-preferences.d.ts","sourceRoot":"","sources":["../../src/common/workspace-trust-preferences.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAyB,eAAe,EAAmB,iBAAiB,EAA0B,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE1K,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,eAAO,MAAM,uBAAuB,qCAAqC,CAAC;AAC1E,eAAO,MAAM,8BAA8B,2CAA2C,CAAC;AACvF,eAAO,MAAM,4BAA4B,yCAAyC,CAAC;AAEnF,oBAAY,oBAAoB;IAC5B,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;CAClB;AAED,eAAO,MAAM,8BAA8B,EAAE,gBAmB5C,CAAC;AAEF,MAAM,WAAW,2BAA2B;IACxC,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IACnC,CAAC,8BAA8B,CAAC,EAAE,oBAAoB,CAAC;IACvD,CAAC,4BAA4B,CAAC,EAAE,OAAO,CAAC;CAC3C;AAED,eAAO,MAAM,oCAAoC,eAAiD,CAAC;AACnG,eAAO,MAAM,yBAAyB,eAAsC,CAAC;AAC7E,MAAM,MAAM,yBAAyB,GAAG,eAAe,CAAC,2BAA2B,CAAC,CAAC;AAErF,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,iBAAiB,EAAE,MAAM,GAAE,gBAAiD,GAAG,yBAAyB,CAEpK;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,GAAG,IAAI,CAQzE"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2021 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.bindWorkspaceTrustPreferences = exports.createWorkspaceTrustPreferences = exports.WorkspaceTrustPreferences = exports.WorkspaceTrustPreferenceContribution = exports.workspaceTrustPreferenceSchema = exports.WorkspaceTrustPrompt = exports.WORKSPACE_TRUST_EMPTY_WINDOW = exports.WORKSPACE_TRUST_STARTUP_PROMPT = exports.WORKSPACE_TRUST_ENABLED = void 0;
|
|
19
|
-
const preferences_1 = require("@theia/core/lib/common/preferences");
|
|
20
|
-
const nls_1 = require("@theia/core/lib/common/nls");
|
|
21
|
-
exports.WORKSPACE_TRUST_ENABLED = 'security.workspace.trust.enabled';
|
|
22
|
-
exports.WORKSPACE_TRUST_STARTUP_PROMPT = 'security.workspace.trust.startupPrompt';
|
|
23
|
-
exports.WORKSPACE_TRUST_EMPTY_WINDOW = 'security.workspace.trust.emptyWindow';
|
|
24
|
-
var WorkspaceTrustPrompt;
|
|
25
|
-
(function (WorkspaceTrustPrompt) {
|
|
26
|
-
WorkspaceTrustPrompt["ALWAYS"] = "always";
|
|
27
|
-
WorkspaceTrustPrompt["ONCE"] = "once";
|
|
28
|
-
WorkspaceTrustPrompt["NEVER"] = "never";
|
|
29
|
-
})(WorkspaceTrustPrompt || (exports.WorkspaceTrustPrompt = WorkspaceTrustPrompt = {}));
|
|
30
|
-
exports.workspaceTrustPreferenceSchema = {
|
|
31
|
-
scope: preferences_1.PreferenceScope.User,
|
|
32
|
-
properties: {
|
|
33
|
-
[exports.WORKSPACE_TRUST_ENABLED]: {
|
|
34
|
-
description: nls_1.nls.localize('theia/workspace/trustEnabled', 'Controls whether or not workspace trust is enabled. If disabled, all workspaces are trusted.'),
|
|
35
|
-
type: 'boolean',
|
|
36
|
-
default: true
|
|
37
|
-
},
|
|
38
|
-
[exports.WORKSPACE_TRUST_STARTUP_PROMPT]: {
|
|
39
|
-
description: nls_1.nls.localizeByDefault('Controls when the startup prompt to trust a workspace is shown.'),
|
|
40
|
-
enum: Object.values(WorkspaceTrustPrompt),
|
|
41
|
-
default: WorkspaceTrustPrompt.ALWAYS
|
|
42
|
-
},
|
|
43
|
-
[exports.WORKSPACE_TRUST_EMPTY_WINDOW]: {
|
|
44
|
-
description: nls_1.nls.localize('theia/workspace/trustEmptyWindow', 'Controls whether or not the empty workspace is trusted by default.'),
|
|
45
|
-
type: 'boolean',
|
|
46
|
-
default: true
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
exports.WorkspaceTrustPreferenceContribution = Symbol('WorkspaceTrustPreferenceContribution');
|
|
51
|
-
exports.WorkspaceTrustPreferences = Symbol('WorkspaceTrustPreferences');
|
|
52
|
-
function createWorkspaceTrustPreferences(preferences, schema = exports.workspaceTrustPreferenceSchema) {
|
|
53
|
-
return (0, preferences_1.createPreferenceProxy)(preferences, schema);
|
|
54
|
-
}
|
|
55
|
-
exports.createWorkspaceTrustPreferences = createWorkspaceTrustPreferences;
|
|
56
|
-
function bindWorkspaceTrustPreferences(bind) {
|
|
57
|
-
bind(exports.WorkspaceTrustPreferences).toDynamicValue(ctx => {
|
|
58
|
-
const preferences = ctx.container.get(preferences_1.PreferenceService);
|
|
59
|
-
const contribution = ctx.container.get(exports.WorkspaceTrustPreferenceContribution);
|
|
60
|
-
return createWorkspaceTrustPreferences(preferences, contribution.schema);
|
|
61
|
-
}).inSingletonScope();
|
|
62
|
-
bind(exports.WorkspaceTrustPreferenceContribution).toConstantValue({ schema: exports.workspaceTrustPreferenceSchema });
|
|
63
|
-
bind(preferences_1.PreferenceContribution).toService(exports.WorkspaceTrustPreferenceContribution);
|
|
64
|
-
}
|
|
65
|
-
exports.bindWorkspaceTrustPreferences = bindWorkspaceTrustPreferences;
|
|
66
|
-
//# sourceMappingURL=workspace-trust-preferences.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-trust-preferences.js","sourceRoot":"","sources":["../../src/common/workspace-trust-preferences.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,oEAA0K;AAC1K,oDAAiD;AAGpC,QAAA,uBAAuB,GAAG,kCAAkC,CAAC;AAC7D,QAAA,8BAA8B,GAAG,wCAAwC,CAAC;AAC1E,QAAA,4BAA4B,GAAG,sCAAsC,CAAC;AAEnF,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC5B,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,uCAAe,CAAA;AACnB,CAAC,EAJW,oBAAoB,oCAApB,oBAAoB,QAI/B;AAEY,QAAA,8BAA8B,GAAqB;IAC5D,KAAK,EAAE,6BAAe,CAAC,IAAI;IAC3B,UAAU,EAAE;QACR,CAAC,+BAAuB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AAE,CAAC,CAAC;IACvG,IAAI,CAAC,oCAAsB,CAAC,CAAC,SAAS,CAAC,4CAAoC,CAAC,CAAC;AACjF,CAAC;AARD,sEAQC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/// <reference types="yargs" />
|
|
2
|
-
import * as yargs from '@theia/core/shared/yargs';
|
|
3
|
-
import { BackendApplicationContribution } from '@theia/core/lib/node';
|
|
4
|
-
import { CliContribution } from '@theia/core/lib/node/cli';
|
|
5
|
-
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
6
|
-
import { WorkspaceServer, UntitledWorkspaceService } from '../common';
|
|
7
|
-
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
8
|
-
import URI from '@theia/core/lib/common/uri';
|
|
9
|
-
import { ContributionProvider } from '@theia/core';
|
|
10
|
-
export declare const WorkspaceHandlerContribution: unique symbol;
|
|
11
|
-
export interface WorkspaceHandlerContribution {
|
|
12
|
-
canHandle(uri: URI): boolean;
|
|
13
|
-
workspaceStillExists(uri: URI): Promise<boolean>;
|
|
14
|
-
}
|
|
15
|
-
export declare class WorkspaceCliContribution implements CliContribution {
|
|
16
|
-
protected readonly envVariablesServer: EnvVariablesServer;
|
|
17
|
-
protected readonly untitledWorkspaceService: UntitledWorkspaceService;
|
|
18
|
-
workspaceRoot: Deferred<string | undefined>;
|
|
19
|
-
configure(conf: yargs.Argv): void;
|
|
20
|
-
setArguments(args: yargs.Arguments): Promise<void>;
|
|
21
|
-
protected normalizeWorkspaceArg(raw: string): string;
|
|
22
|
-
protected buildWorkspaceForMultipleArguments(workspaceArguments: string[]): Promise<string | undefined>;
|
|
23
|
-
}
|
|
24
|
-
export declare class DefaultWorkspaceServer implements WorkspaceServer, BackendApplicationContribution {
|
|
25
|
-
protected root: Deferred<string | undefined>;
|
|
26
|
-
/**
|
|
27
|
-
* Untitled workspaces that are not among the most recent N workspaces will be deleted on start. Increase this number to keep older files,
|
|
28
|
-
* lower it to delete stale untitled workspaces more aggressively.
|
|
29
|
-
*/
|
|
30
|
-
protected untitledWorkspaceStaleThreshold: number;
|
|
31
|
-
protected readonly cliParams: WorkspaceCliContribution;
|
|
32
|
-
protected readonly envServer: EnvVariablesServer;
|
|
33
|
-
protected readonly untitledWorkspaceService: UntitledWorkspaceService;
|
|
34
|
-
protected readonly workspaceHandlers: ContributionProvider<WorkspaceHandlerContribution>;
|
|
35
|
-
protected init(): void;
|
|
36
|
-
protected doInit(): Promise<void>;
|
|
37
|
-
onStart(): Promise<void>;
|
|
38
|
-
protected getRoot(): Promise<string | undefined>;
|
|
39
|
-
getMostRecentlyUsedWorkspace(): Promise<string | undefined>;
|
|
40
|
-
setMostRecentlyUsedWorkspace(rawUri: string): Promise<void>;
|
|
41
|
-
removeRecentWorkspace(rawUri: string): Promise<void>;
|
|
42
|
-
getRecentWorkspaces(): Promise<string[]>;
|
|
43
|
-
protected workspaceStillExist(workspaceRootUri: string): Promise<boolean>;
|
|
44
|
-
protected getWorkspaceURIFromCli(): Promise<string | undefined>;
|
|
45
|
-
/**
|
|
46
|
-
* Writes the given uri as the most recently used workspace root to the user's home directory.
|
|
47
|
-
* @param uri most recently used uri
|
|
48
|
-
*/
|
|
49
|
-
protected writeToUserHome(data: RecentWorkspacePathsData): Promise<void>;
|
|
50
|
-
protected writeToFile(fsPath: string, data: object): Promise<void>;
|
|
51
|
-
/**
|
|
52
|
-
* Reads the most recently used workspace root from the user's home directory.
|
|
53
|
-
*/
|
|
54
|
-
protected readRecentWorkspacePathsFromUserHome(): Promise<RecentWorkspacePathsData | undefined>;
|
|
55
|
-
protected readJsonFromFile(fsPath: string): Promise<object | undefined>;
|
|
56
|
-
protected getUserStoragePath(): Promise<string>;
|
|
57
|
-
/**
|
|
58
|
-
* Removes untitled workspaces that are not among the most recently used workspaces.
|
|
59
|
-
* Use the `untitledWorkspaceStaleThreshold` to configure when to delete workspaces.
|
|
60
|
-
*/
|
|
61
|
-
protected removeOldUntitledWorkspaces(): Promise<void>;
|
|
62
|
-
}
|
|
63
|
-
export declare class FileWorkspaceHandlerContribution implements WorkspaceHandlerContribution {
|
|
64
|
-
canHandle(uri: URI): boolean;
|
|
65
|
-
workspaceStillExists(uri: URI): Promise<boolean>;
|
|
66
|
-
}
|
|
67
|
-
export interface RecentWorkspacePathsData {
|
|
68
|
-
recentRoots: string[];
|
|
69
|
-
}
|
|
70
|
-
export declare namespace RecentWorkspacePathsData {
|
|
71
|
-
/**
|
|
72
|
-
* Parses `data` as `RecentWorkspacePathsData` but removes any non-string array entry.
|
|
73
|
-
*
|
|
74
|
-
* Returns undefined if the given `data` does not contain a `recentRoots` array property.
|
|
75
|
-
*/
|
|
76
|
-
function create(data: unknown): RecentWorkspacePathsData | undefined;
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=default-workspace-server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-workspace-server.d.ts","sourceRoot":"","sources":["../../src/node/default-workspace-server.ts"],"names":[],"mappings":";AAiBA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAIlD,OAAO,EAAW,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,GAAG,MAAM,4BAA4B,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAY,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,4BAA4B,eAAyC,CAAC;AACnF,MAAM,WAAW,4BAA4B;IACzC,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC;IAC7B,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpD;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MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYpD,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;cAU9B,mBAAmB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;cAW/D,sBAAsB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAKrE;;;OAGG;cACa,eAAe,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;cAK9D,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOxE;;OAEG;cACa,oCAAoC,IAAI,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;cAMrF,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;cAQ7D,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAKrD;;;OAGG;cACa,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC;CAU/D;AAED,qBACa,gCAAiC,YAAW,4BAA4B;IAEjF,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO;IAItB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;CAGzD;AAED,MAAM,WAAW,wBAAwB;IACrC,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,yBAAiB,wBAAwB,CAAC;IACtC;;;;OAIG;IACH,SAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,wBAAwB,GAAG,SAAS,CAO1E;CACJ"}
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017 TypeFox 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.RecentWorkspacePathsData = exports.FileWorkspaceHandlerContribution = exports.DefaultWorkspaceServer = exports.WorkspaceCliContribution = exports.WorkspaceHandlerContribution = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const path = require("path");
|
|
21
|
-
const fs = require("@theia/core/shared/fs-extra");
|
|
22
|
-
const jsoncparser = require("jsonc-parser");
|
|
23
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
24
|
-
const node_1 = require("@theia/core/lib/node");
|
|
25
|
-
const promise_util_1 = require("@theia/core/lib/common/promise-util");
|
|
26
|
-
const common_1 = require("../common");
|
|
27
|
-
const env_variables_1 = require("@theia/core/lib/common/env-variables");
|
|
28
|
-
const uri_1 = require("@theia/core/lib/common/uri");
|
|
29
|
-
const core_1 = require("@theia/core");
|
|
30
|
-
exports.WorkspaceHandlerContribution = Symbol('workspaceHandlerContribution');
|
|
31
|
-
let WorkspaceCliContribution = class WorkspaceCliContribution {
|
|
32
|
-
constructor() {
|
|
33
|
-
this.workspaceRoot = new promise_util_1.Deferred();
|
|
34
|
-
}
|
|
35
|
-
configure(conf) {
|
|
36
|
-
conf.usage('$0 [workspace-directories] [options]');
|
|
37
|
-
conf.option('root-dir', {
|
|
38
|
-
description: 'DEPRECATED: Sets the workspace directory.',
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
async setArguments(args) {
|
|
42
|
-
const workspaceArguments = args._.map(probablyAlreadyString => String(probablyAlreadyString));
|
|
43
|
-
if (workspaceArguments.length === 0 && args['root-dir']) {
|
|
44
|
-
workspaceArguments.push(String(args['root-dir']));
|
|
45
|
-
}
|
|
46
|
-
if (workspaceArguments.length === 0) {
|
|
47
|
-
this.workspaceRoot.resolve(undefined);
|
|
48
|
-
}
|
|
49
|
-
else if (workspaceArguments.length === 1) {
|
|
50
|
-
this.workspaceRoot.resolve(this.normalizeWorkspaceArg(workspaceArguments[0]));
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
this.workspaceRoot.resolve(this.buildWorkspaceForMultipleArguments(workspaceArguments));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
normalizeWorkspaceArg(raw) {
|
|
57
|
-
return path.resolve(raw).replace(/\/$/, '');
|
|
58
|
-
}
|
|
59
|
-
async buildWorkspaceForMultipleArguments(workspaceArguments) {
|
|
60
|
-
var _a;
|
|
61
|
-
try {
|
|
62
|
-
const dirs = await Promise.all(workspaceArguments.map(async (maybeDir) => { var _a; return (_a = (await fs.stat(maybeDir).catch(() => undefined))) === null || _a === void 0 ? void 0 : _a.isDirectory(); }));
|
|
63
|
-
const folders = workspaceArguments.filter((_, index) => dirs[index]).map(dir => ({ path: this.normalizeWorkspaceArg(dir) }));
|
|
64
|
-
if (folders.length < 2) {
|
|
65
|
-
return (_a = folders[0]) === null || _a === void 0 ? void 0 : _a.path;
|
|
66
|
-
}
|
|
67
|
-
const untitledWorkspaceUri = await this.untitledWorkspaceService.getUntitledWorkspaceUri(new uri_1.default(await this.envVariablesServer.getConfigDirUri()), async (uri) => !await fs.pathExists(uri.path.fsPath()));
|
|
68
|
-
const untitledWorkspacePath = untitledWorkspaceUri.path.fsPath();
|
|
69
|
-
await fs.ensureDir(path.dirname(untitledWorkspacePath));
|
|
70
|
-
await fs.writeFile(untitledWorkspacePath, JSON.stringify({ folders }, undefined, 4));
|
|
71
|
-
return untitledWorkspacePath;
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
exports.WorkspaceCliContribution = WorkspaceCliContribution;
|
|
79
|
-
tslib_1.__decorate([
|
|
80
|
-
(0, inversify_1.inject)(env_variables_1.EnvVariablesServer),
|
|
81
|
-
tslib_1.__metadata("design:type", Object)
|
|
82
|
-
], WorkspaceCliContribution.prototype, "envVariablesServer", void 0);
|
|
83
|
-
tslib_1.__decorate([
|
|
84
|
-
(0, inversify_1.inject)(common_1.UntitledWorkspaceService),
|
|
85
|
-
tslib_1.__metadata("design:type", common_1.UntitledWorkspaceService)
|
|
86
|
-
], WorkspaceCliContribution.prototype, "untitledWorkspaceService", void 0);
|
|
87
|
-
exports.WorkspaceCliContribution = WorkspaceCliContribution = tslib_1.__decorate([
|
|
88
|
-
(0, inversify_1.injectable)()
|
|
89
|
-
], WorkspaceCliContribution);
|
|
90
|
-
let DefaultWorkspaceServer = class DefaultWorkspaceServer {
|
|
91
|
-
constructor() {
|
|
92
|
-
this.root = new promise_util_1.Deferred();
|
|
93
|
-
/**
|
|
94
|
-
* Untitled workspaces that are not among the most recent N workspaces will be deleted on start. Increase this number to keep older files,
|
|
95
|
-
* lower it to delete stale untitled workspaces more aggressively.
|
|
96
|
-
*/
|
|
97
|
-
this.untitledWorkspaceStaleThreshold = 10;
|
|
98
|
-
}
|
|
99
|
-
init() {
|
|
100
|
-
this.doInit();
|
|
101
|
-
}
|
|
102
|
-
async doInit() {
|
|
103
|
-
const root = await this.getRoot();
|
|
104
|
-
this.root.resolve(root);
|
|
105
|
-
}
|
|
106
|
-
async onStart() {
|
|
107
|
-
await this.removeOldUntitledWorkspaces();
|
|
108
|
-
}
|
|
109
|
-
async getRoot() {
|
|
110
|
-
let root = await this.getWorkspaceURIFromCli();
|
|
111
|
-
if (!root) {
|
|
112
|
-
const data = await this.readRecentWorkspacePathsFromUserHome();
|
|
113
|
-
if (data && data.recentRoots) {
|
|
114
|
-
root = data.recentRoots[0];
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return root;
|
|
118
|
-
}
|
|
119
|
-
getMostRecentlyUsedWorkspace() {
|
|
120
|
-
return this.root.promise;
|
|
121
|
-
}
|
|
122
|
-
async setMostRecentlyUsedWorkspace(rawUri) {
|
|
123
|
-
const uri = rawUri && new uri_1.default(rawUri).toString(); // the empty string is used as a signal from the frontend not to load a workspace.
|
|
124
|
-
this.root = new promise_util_1.Deferred();
|
|
125
|
-
this.root.resolve(uri);
|
|
126
|
-
const recentRoots = Array.from(new Set([uri, ...await this.getRecentWorkspaces()]));
|
|
127
|
-
this.writeToUserHome({ recentRoots });
|
|
128
|
-
}
|
|
129
|
-
async removeRecentWorkspace(rawUri) {
|
|
130
|
-
const uri = rawUri && new uri_1.default(rawUri).toString(); // the empty string is used as a signal from the frontend not to load a workspace.
|
|
131
|
-
const recentRoots = await this.getRecentWorkspaces();
|
|
132
|
-
const index = recentRoots.indexOf(uri);
|
|
133
|
-
if (index !== -1) {
|
|
134
|
-
recentRoots.splice(index, 1);
|
|
135
|
-
this.writeToUserHome({
|
|
136
|
-
recentRoots
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
async getRecentWorkspaces() {
|
|
141
|
-
const data = await this.readRecentWorkspacePathsFromUserHome();
|
|
142
|
-
if (data && data.recentRoots) {
|
|
143
|
-
const allRootUris = await Promise.all(data.recentRoots.map(async (element) => element && await this.workspaceStillExist(element) ? element : undefined));
|
|
144
|
-
return allRootUris.filter(core_1.notEmpty);
|
|
145
|
-
}
|
|
146
|
-
return [];
|
|
147
|
-
}
|
|
148
|
-
async workspaceStillExist(workspaceRootUri) {
|
|
149
|
-
const uri = new uri_1.default(workspaceRootUri);
|
|
150
|
-
for (const handler of this.workspaceHandlers.getContributions()) {
|
|
151
|
-
if (handler.canHandle(uri)) {
|
|
152
|
-
return handler.workspaceStillExists(uri);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
async getWorkspaceURIFromCli() {
|
|
158
|
-
const arg = await this.cliParams.workspaceRoot.promise;
|
|
159
|
-
return arg !== undefined ? node_1.FileUri.create(arg).toString() : undefined;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Writes the given uri as the most recently used workspace root to the user's home directory.
|
|
163
|
-
* @param uri most recently used uri
|
|
164
|
-
*/
|
|
165
|
-
async writeToUserHome(data) {
|
|
166
|
-
const file = await this.getUserStoragePath();
|
|
167
|
-
await this.writeToFile(file, data);
|
|
168
|
-
}
|
|
169
|
-
async writeToFile(fsPath, data) {
|
|
170
|
-
if (!await fs.pathExists(fsPath)) {
|
|
171
|
-
await fs.mkdirs(path.resolve(fsPath, '..'));
|
|
172
|
-
}
|
|
173
|
-
await fs.writeJson(fsPath, data);
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Reads the most recently used workspace root from the user's home directory.
|
|
177
|
-
*/
|
|
178
|
-
async readRecentWorkspacePathsFromUserHome() {
|
|
179
|
-
const fsPath = await this.getUserStoragePath();
|
|
180
|
-
const data = await this.readJsonFromFile(fsPath);
|
|
181
|
-
return RecentWorkspacePathsData.create(data);
|
|
182
|
-
}
|
|
183
|
-
async readJsonFromFile(fsPath) {
|
|
184
|
-
if (await fs.pathExists(fsPath)) {
|
|
185
|
-
const rawContent = await fs.readFile(fsPath, 'utf-8');
|
|
186
|
-
const strippedContent = jsoncparser.stripComments(rawContent);
|
|
187
|
-
return jsoncparser.parse(strippedContent);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
async getUserStoragePath() {
|
|
191
|
-
const configDirUri = await this.envServer.getConfigDirUri();
|
|
192
|
-
return path.resolve(node_1.FileUri.fsPath(configDirUri), 'recentworkspace.json');
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Removes untitled workspaces that are not among the most recently used workspaces.
|
|
196
|
-
* Use the `untitledWorkspaceStaleThreshold` to configure when to delete workspaces.
|
|
197
|
-
*/
|
|
198
|
-
async removeOldUntitledWorkspaces() {
|
|
199
|
-
const recents = (await this.getRecentWorkspaces()).map(node_1.FileUri.fsPath);
|
|
200
|
-
const olderUntitledWorkspaces = recents
|
|
201
|
-
.slice(this.untitledWorkspaceStaleThreshold)
|
|
202
|
-
.filter(workspace => this.untitledWorkspaceService.isUntitledWorkspace(node_1.FileUri.create(workspace)));
|
|
203
|
-
await Promise.all(olderUntitledWorkspaces.map(workspace => fs.promises.unlink(node_1.FileUri.fsPath(workspace)).catch(() => { })));
|
|
204
|
-
if (olderUntitledWorkspaces.length > 0) {
|
|
205
|
-
await this.writeToUserHome({ recentRoots: await this.getRecentWorkspaces() });
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
exports.DefaultWorkspaceServer = DefaultWorkspaceServer;
|
|
210
|
-
tslib_1.__decorate([
|
|
211
|
-
(0, inversify_1.inject)(WorkspaceCliContribution),
|
|
212
|
-
tslib_1.__metadata("design:type", WorkspaceCliContribution)
|
|
213
|
-
], DefaultWorkspaceServer.prototype, "cliParams", void 0);
|
|
214
|
-
tslib_1.__decorate([
|
|
215
|
-
(0, inversify_1.inject)(env_variables_1.EnvVariablesServer),
|
|
216
|
-
tslib_1.__metadata("design:type", Object)
|
|
217
|
-
], DefaultWorkspaceServer.prototype, "envServer", void 0);
|
|
218
|
-
tslib_1.__decorate([
|
|
219
|
-
(0, inversify_1.inject)(common_1.UntitledWorkspaceService),
|
|
220
|
-
tslib_1.__metadata("design:type", common_1.UntitledWorkspaceService)
|
|
221
|
-
], DefaultWorkspaceServer.prototype, "untitledWorkspaceService", void 0);
|
|
222
|
-
tslib_1.__decorate([
|
|
223
|
-
(0, inversify_1.inject)(core_1.ContributionProvider),
|
|
224
|
-
(0, inversify_1.named)(exports.WorkspaceHandlerContribution),
|
|
225
|
-
tslib_1.__metadata("design:type", Object)
|
|
226
|
-
], DefaultWorkspaceServer.prototype, "workspaceHandlers", void 0);
|
|
227
|
-
tslib_1.__decorate([
|
|
228
|
-
(0, inversify_1.postConstruct)(),
|
|
229
|
-
tslib_1.__metadata("design:type", Function),
|
|
230
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
231
|
-
tslib_1.__metadata("design:returntype", void 0)
|
|
232
|
-
], DefaultWorkspaceServer.prototype, "init", null);
|
|
233
|
-
exports.DefaultWorkspaceServer = DefaultWorkspaceServer = tslib_1.__decorate([
|
|
234
|
-
(0, inversify_1.injectable)()
|
|
235
|
-
], DefaultWorkspaceServer);
|
|
236
|
-
let FileWorkspaceHandlerContribution = class FileWorkspaceHandlerContribution {
|
|
237
|
-
canHandle(uri) {
|
|
238
|
-
return uri.scheme === 'file';
|
|
239
|
-
}
|
|
240
|
-
async workspaceStillExists(uri) {
|
|
241
|
-
return fs.pathExists(uri.path.fsPath());
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
exports.FileWorkspaceHandlerContribution = FileWorkspaceHandlerContribution;
|
|
245
|
-
exports.FileWorkspaceHandlerContribution = FileWorkspaceHandlerContribution = tslib_1.__decorate([
|
|
246
|
-
(0, inversify_1.injectable)()
|
|
247
|
-
], FileWorkspaceHandlerContribution);
|
|
248
|
-
var RecentWorkspacePathsData;
|
|
249
|
-
(function (RecentWorkspacePathsData) {
|
|
250
|
-
/**
|
|
251
|
-
* Parses `data` as `RecentWorkspacePathsData` but removes any non-string array entry.
|
|
252
|
-
*
|
|
253
|
-
* Returns undefined if the given `data` does not contain a `recentRoots` array property.
|
|
254
|
-
*/
|
|
255
|
-
function create(data) {
|
|
256
|
-
if (typeof data !== 'object' || !data || !Array.isArray(data.recentRoots)) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
return {
|
|
260
|
-
recentRoots: data.recentRoots.filter(root => typeof root === 'string')
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
RecentWorkspacePathsData.create = create;
|
|
264
|
-
})(RecentWorkspacePathsData || (exports.RecentWorkspacePathsData = RecentWorkspacePathsData = {}));
|
|
265
|
-
//# sourceMappingURL=default-workspace-server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-workspace-server.js","sourceRoot":"","sources":["../../src/node/default-workspace-server.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,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,6BAA6B;AAE7B,kDAAkD;AAClD,4CAA4C;AAC5C,4DAAwF;AACxF,+CAA+E;AAE/E,sEAA+D;AAC/D,sCAAsE;AACtE,wEAA0E;AAC1E,oDAA6C;AAC7C,sCAA6D;AAEhD,QAAA,4BAA4B,GAAG,MAAM,CAAC,8BAA8B,CAAC,CAAC;AAM5E,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAA9B;QAKH,kBAAa,GAAG,IAAI,uBAAQ,EAAsB,CAAC;IA+CvD,CAAC;IA7CG,SAAS,CAAC,IAAgB;QACtB,IAAI,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YACpB,WAAW,EAAE,2CAA2C;SAC3D,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAqB;QACpC,MAAM,kBAAkB,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAC9F,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACtD,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,U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DACsB;AAG9B;IADlB,IAAA,kBAAM,EAAC,iCAAwB,CAAC;sCACY,iCAAwB;wEAAC;AAGnD;IADlB,IAAA,kBAAM,EAAC,2BAAoB,CAAC;IAAE,IAAA,iBAAK,EAAC,oCAA4B,CAAC;;iEACuB;AAG/E;IADT,IAAA,yBAAa,GAAE;;;;kDAGf;iCAxBQ,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CAoJlC;AAGM,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;IAEzC,SAAS,CAAC,GAAQ;QACd,OAAO,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,GAAQ;QAC/B,OAAO,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,CAAC;CACJ,CAAA;AATY,4EAAgC;2CAAhC,gCAAgC;IAD5C,IAAA,sBAAU,GAAE;GACA,gCAAgC,CAS5C;AAMD,IAAiB,wBAAwB,CAcxC;AAdD,WAAiB,wBAAwB;IACrC;;;;OAIG;IACH,SAAgB,MAAM,CAAC,IAAa;QAChC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAE,IAAiC,CAAC,WAAW,CAAC,EAAE,CAAC;YACtG,OAAO;QACX,CAAC;QACD,OAAO;YACH,WAAW,EAAG,IAAiC,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC;SACvG,CAAC;IACN,CAAC;IAPe,+BAAM,SAOrB,CAAA;AACL,CAAC,EAdgB,wBAAwB,wCAAxB,wBAAwB,QAcxC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-workspace-server.spec.d.ts","sourceRoot":"","sources":["../../src/node/default-workspace-server.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2022 Alexander Flammer 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
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
19
|
-
const mock_env_variables_server_1 = require("@theia/core/lib/browser/test/mock-env-variables-server");
|
|
20
|
-
const env_variables_1 = require("@theia/core/lib/common/env-variables");
|
|
21
|
-
const node_1 = require("@theia/core/lib/node");
|
|
22
|
-
const common_1 = require("../common");
|
|
23
|
-
const default_workspace_server_1 = require("./default-workspace-server");
|
|
24
|
-
const chai_1 = require("chai");
|
|
25
|
-
const temp = require("temp");
|
|
26
|
-
const fs = require("fs");
|
|
27
|
-
const core_1 = require("@theia/core");
|
|
28
|
-
const mock_logger_1 = require("@theia/core/lib/common/test/mock-logger");
|
|
29
|
-
describe('DefaultWorkspaceServer', function () {
|
|
30
|
-
describe('getRecentWorkspaces()', async () => {
|
|
31
|
-
let workspaceServer;
|
|
32
|
-
let tmpConfigDir;
|
|
33
|
-
let recentWorkspaceFile;
|
|
34
|
-
beforeEach(() => {
|
|
35
|
-
// create a temporary directory
|
|
36
|
-
const tempDirPath = temp.track().mkdirSync();
|
|
37
|
-
tmpConfigDir = node_1.FileUri.create(fs.realpathSync(tempDirPath));
|
|
38
|
-
recentWorkspaceFile = node_1.FileUri.fsPath(tmpConfigDir.resolve('recentworkspace.json'));
|
|
39
|
-
// create a container with the necessary bindings for the DefaultWorkspaceServer
|
|
40
|
-
const container = new inversify_1.Container();
|
|
41
|
-
const containerModule = new inversify_1.ContainerModule(bind => {
|
|
42
|
-
/* Mock logger binding*/
|
|
43
|
-
bind(core_1.ILogger).to(mock_logger_1.MockLogger);
|
|
44
|
-
(0, core_1.bindContributionProvider)(bind, default_workspace_server_1.WorkspaceHandlerContribution);
|
|
45
|
-
bind(default_workspace_server_1.FileWorkspaceHandlerContribution).toSelf().inSingletonScope();
|
|
46
|
-
bind(default_workspace_server_1.WorkspaceHandlerContribution).toService(default_workspace_server_1.FileWorkspaceHandlerContribution);
|
|
47
|
-
bind(default_workspace_server_1.WorkspaceCliContribution).toSelf().inSingletonScope();
|
|
48
|
-
bind(default_workspace_server_1.DefaultWorkspaceServer).toSelf().inSingletonScope();
|
|
49
|
-
bind(common_1.WorkspaceFileService).toSelf().inSingletonScope();
|
|
50
|
-
bind(common_1.UntitledWorkspaceService).toSelf().inSingletonScope();
|
|
51
|
-
bind(env_variables_1.EnvVariablesServer).toConstantValue(new mock_env_variables_server_1.MockEnvVariablesServerImpl(tmpConfigDir));
|
|
52
|
-
});
|
|
53
|
-
container.load(containerModule);
|
|
54
|
-
workspaceServer = container.get(default_workspace_server_1.DefaultWorkspaceServer);
|
|
55
|
-
});
|
|
56
|
-
it('should return empty list of workspaces if no recent workspaces file is existing', async function () {
|
|
57
|
-
const recent = await workspaceServer.getRecentWorkspaces();
|
|
58
|
-
(0, chai_1.expect)(recent).to.be.empty;
|
|
59
|
-
});
|
|
60
|
-
it('should not return non-existing workspaces from recent workspaces file', async function () {
|
|
61
|
-
fs.writeFileSync(recentWorkspaceFile, JSON.stringify({
|
|
62
|
-
recentRoots: [
|
|
63
|
-
tmpConfigDir.resolve('somethingNotExisting').toString(),
|
|
64
|
-
tmpConfigDir.resolve('somethingElseNotExisting').toString()
|
|
65
|
-
]
|
|
66
|
-
}));
|
|
67
|
-
const recent = await workspaceServer.getRecentWorkspaces();
|
|
68
|
-
(0, chai_1.expect)(recent).to.be.empty;
|
|
69
|
-
});
|
|
70
|
-
it('should return only existing workspaces from recent workspaces file', async function () {
|
|
71
|
-
fs.writeFileSync(recentWorkspaceFile, JSON.stringify({
|
|
72
|
-
recentRoots: [
|
|
73
|
-
tmpConfigDir.toString(),
|
|
74
|
-
tmpConfigDir.resolve('somethingNotExisting').toString()
|
|
75
|
-
]
|
|
76
|
-
}));
|
|
77
|
-
const recent = await workspaceServer.getRecentWorkspaces();
|
|
78
|
-
(0, chai_1.expect)(recent).to.have.members([tmpConfigDir.toString()]);
|
|
79
|
-
});
|
|
80
|
-
it('should ignore non-string array entries but return remaining existing file paths', async function () {
|
|
81
|
-
// previously caused: 'TypeError: Cannot read property 'fsPath' of undefined', see issue #10250
|
|
82
|
-
fs.writeFileSync(recentWorkspaceFile, JSON.stringify({
|
|
83
|
-
recentRoots: [
|
|
84
|
-
[tmpConfigDir.toString()],
|
|
85
|
-
{},
|
|
86
|
-
12345678,
|
|
87
|
-
undefined,
|
|
88
|
-
tmpConfigDir.toString(),
|
|
89
|
-
]
|
|
90
|
-
}));
|
|
91
|
-
const recent = await workspaceServer.getRecentWorkspaces();
|
|
92
|
-
(0, chai_1.expect)(recent).to.have.members([tmpConfigDir.toString()]);
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
//# sourceMappingURL=default-workspace-server.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-workspace-server.spec.js","sourceRoot":"","sources":["../../src/node/default-workspace-server.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,mDAAmD;AACnD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E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AAa,CAAC,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC;gBACjD,WAAW,EAAE;oBACT,YAAY,CAAC,QAAQ,EAAE;oBACvB,YAAY,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,QAAQ,EAAE;iBAC1D;aACJ,CAAC,CAAC,CAAC;YAEJ,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,mBAAmB,EAAE,CAAC;YAE3D,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iFAAiF,EAAE,KAAK;YACvF,+FAA+F;YAC/F,EAAE,CAAC,aAAa,CAAC,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC;gBACjD,WAAW,EAAE;oBACT,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;oBACzB,EAAE;oBACF,QAAQ;oBACR,SAAS;oBACT,YAAY,CAAC,QAAQ,EAAE;iBAC1B;aACJ,CAAC,CAAC,CAAC;YAEJ,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,mBAAmB,EAAE,CAAC;YAE3D,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/lib/node/index.d.ts
DELETED
package/lib/node/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAgBA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC"}
|
package/lib/node/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017 TypeFox 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
|
-
const tslib_1 = require("tslib");
|
|
19
|
-
tslib_1.__exportStar(require("./default-workspace-server"), exports);
|
|
20
|
-
tslib_1.__exportStar(require("./workspace-backend-module"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
package/lib/node/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,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,qEAA2C;AAC3C,qEAA2C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/workspace-backend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAQ/D,wBAqBG"}
|