@theia/remote 1.70.0-next.7 → 1.70.0-next.71
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/electron-browser/local-backend-services.d.ts +6 -0
- package/lib/electron-browser/local-backend-services.d.ts.map +1 -1
- package/lib/electron-browser/local-backend-services.js +37 -1
- package/lib/electron-browser/local-backend-services.js.map +1 -1
- package/lib/electron-browser/remote-electron-file-dialog-service.d.ts +1 -0
- package/lib/electron-browser/remote-electron-file-dialog-service.d.ts.map +1 -1
- package/lib/electron-browser/remote-electron-file-dialog-service.js +20 -0
- package/lib/electron-browser/remote-electron-file-dialog-service.js.map +1 -1
- package/lib/electron-browser/remote-frontend-module.d.ts.map +1 -1
- package/lib/electron-browser/remote-frontend-module.js +10 -0
- package/lib/electron-browser/remote-frontend-module.js.map +1 -1
- package/lib/electron-browser/remote-local-workspace-contribution.d.ts +18 -0
- package/lib/electron-browser/remote-local-workspace-contribution.d.ts.map +1 -0
- package/lib/electron-browser/remote-local-workspace-contribution.js +93 -0
- package/lib/electron-browser/remote-local-workspace-contribution.js.map +1 -0
- package/package.json +8 -7
- package/src/electron-browser/local-backend-services.ts +37 -1
- package/src/electron-browser/remote-electron-file-dialog-service.ts +21 -2
- package/src/electron-browser/remote-frontend-module.ts +12 -1
- package/src/electron-browser/remote-local-workspace-contribution.ts +89 -0
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { RpcProxy } from '@theia/core';
|
|
2
2
|
import { RemoteFileSystemProvider, RemoteFileSystemServer } from '@theia/filesystem/lib/common/remote-file-system-provider';
|
|
3
|
+
import { FileService, FileServiceContribution } from '@theia/filesystem/lib/browser/file-service';
|
|
3
4
|
export declare const LocalEnvVariablesServer: unique symbol;
|
|
4
5
|
export declare const LocalRemoteFileSytemServer: unique symbol;
|
|
6
|
+
export declare const LOCAL_FILE_SCHEME = "localfile";
|
|
5
7
|
/**
|
|
6
8
|
* provide file access to local files while connected to a remote workspace or dev container.
|
|
7
9
|
*/
|
|
8
10
|
export declare class LocalRemoteFileSystemProvider extends RemoteFileSystemProvider {
|
|
9
11
|
protected readonly server: RpcProxy<RemoteFileSystemServer>;
|
|
10
12
|
}
|
|
13
|
+
export declare class LocalRemoteFileSystemContribution implements FileServiceContribution {
|
|
14
|
+
protected readonly provider: LocalRemoteFileSystemProvider;
|
|
15
|
+
registerFileSystemProviders(service: FileService): void;
|
|
16
|
+
}
|
|
11
17
|
//# sourceMappingURL=local-backend-services.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-backend-services.d.ts","sourceRoot":"","sources":["../../src/electron-browser/local-backend-services.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"local-backend-services.d.ts","sourceRoot":"","sources":["../../src/electron-browser/local-backend-services.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAO,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAC5H,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAElG,eAAO,MAAM,uBAAuB,eAA0C,CAAC;AAC/E,eAAO,MAAM,0BAA0B,eAAuC,CAAC;AAE/E,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C;;GAEG;AACH,qBACa,6BAA8B,SAAQ,wBAAwB;IACvE,mBAC4B,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC;CAExE;AAED,qBACa,iCAAkC,YAAW,uBAAuB;IAE7E,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,6BAA6B,CAAC;IAE3D,2BAA2B,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;CA0B1D"}
|
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
16
|
// *****************************************************************************
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.LocalRemoteFileSystemProvider = exports.LocalRemoteFileSytemServer = exports.LocalEnvVariablesServer = void 0;
|
|
18
|
+
exports.LocalRemoteFileSystemContribution = exports.LocalRemoteFileSystemProvider = exports.LOCAL_FILE_SCHEME = exports.LocalRemoteFileSytemServer = exports.LocalEnvVariablesServer = void 0;
|
|
19
19
|
const tslib_1 = require("tslib");
|
|
20
|
+
const core_1 = require("@theia/core");
|
|
20
21
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
22
|
const remote_file_system_provider_1 = require("@theia/filesystem/lib/common/remote-file-system-provider");
|
|
22
23
|
exports.LocalEnvVariablesServer = Symbol('LocalEnviromentVariableServer');
|
|
23
24
|
exports.LocalRemoteFileSytemServer = Symbol('LocalRemoteFileSytemServer');
|
|
25
|
+
exports.LOCAL_FILE_SCHEME = 'localfile';
|
|
24
26
|
/**
|
|
25
27
|
* provide file access to local files while connected to a remote workspace or dev container.
|
|
26
28
|
*/
|
|
@@ -34,4 +36,38 @@ tslib_1.__decorate([
|
|
|
34
36
|
exports.LocalRemoteFileSystemProvider = LocalRemoteFileSystemProvider = tslib_1.__decorate([
|
|
35
37
|
(0, inversify_1.injectable)()
|
|
36
38
|
], LocalRemoteFileSystemProvider);
|
|
39
|
+
let LocalRemoteFileSystemContribution = class LocalRemoteFileSystemContribution {
|
|
40
|
+
registerFileSystemProviders(service) {
|
|
41
|
+
service.onWillActivateFileSystemProvider(event => {
|
|
42
|
+
if (event.scheme === exports.LOCAL_FILE_SCHEME) {
|
|
43
|
+
// This provider currently has limited functionality. It can not yet be used to react to listener events like onDidChangeFile
|
|
44
|
+
service.registerProvider(exports.LOCAL_FILE_SCHEME, new Proxy(this.provider, {
|
|
45
|
+
get(target, prop) {
|
|
46
|
+
const member = target[prop];
|
|
47
|
+
if (typeof member === 'function') {
|
|
48
|
+
return (...args) => {
|
|
49
|
+
const mappedArgs = args.map(arg => {
|
|
50
|
+
if (arg instanceof core_1.URI && arg.scheme === exports.LOCAL_FILE_SCHEME) {
|
|
51
|
+
return arg.withScheme('file');
|
|
52
|
+
}
|
|
53
|
+
return arg;
|
|
54
|
+
});
|
|
55
|
+
return member.apply(target, mappedArgs);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return member;
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
exports.LocalRemoteFileSystemContribution = LocalRemoteFileSystemContribution;
|
|
66
|
+
tslib_1.__decorate([
|
|
67
|
+
(0, inversify_1.inject)(LocalRemoteFileSystemProvider),
|
|
68
|
+
tslib_1.__metadata("design:type", LocalRemoteFileSystemProvider)
|
|
69
|
+
], LocalRemoteFileSystemContribution.prototype, "provider", void 0);
|
|
70
|
+
exports.LocalRemoteFileSystemContribution = LocalRemoteFileSystemContribution = tslib_1.__decorate([
|
|
71
|
+
(0, inversify_1.injectable)()
|
|
72
|
+
], LocalRemoteFileSystemContribution);
|
|
37
73
|
//# sourceMappingURL=local-backend-services.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-backend-services.js","sourceRoot":"","sources":["../../src/electron-browser/local-backend-services.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;;;;
|
|
1
|
+
{"version":3,"file":"local-backend-services.js","sourceRoot":"","sources":["../../src/electron-browser/local-backend-services.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EA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D,OAAO,GAAG,CAAC;gCACf,CAAC,CAAC,CAAC;gCACH,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;4BAC5C,CAAC,CAAC;wBACN,CAAC;wBACD,OAAO,MAAM,CAAC;oBAClB,CAAC;iBACJ,CAAC,CAAC,CAAC;YACR,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CAEJ,CAAA;AA9BY,8EAAiC;AAEvB;IADlB,IAAA,kBAAM,EAAC,6BAA6B,CAAC;sCACT,6BAA6B;mEAAC;4CAFlD,iCAAiC;IAD7C,IAAA,sBAAU,GAAE;GACA,iCAAiC,CA8B7C"}
|
|
@@ -10,5 +10,6 @@ export declare class RemoteElectronFileDialogService extends ElectronFileDialogS
|
|
|
10
10
|
}, folder?: FileStat | undefined): Promise<MaybeArray<URI> | undefined>;
|
|
11
11
|
showOpenDialog(props: OpenFileDialogProps, folder?: FileStat | undefined): Promise<URI | undefined>;
|
|
12
12
|
showSaveDialog(props: SaveFileDialogProps, folder?: FileStat | undefined): Promise<URI | undefined>;
|
|
13
|
+
protected addLocalFilesButton(props: OpenFileDialogProps): void;
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=remote-electron-file-dialog-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-electron-file-dialog-service.d.ts","sourceRoot":"","sources":["../../src/electron-browser/remote-electron-file-dialog-service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"remote-electron-file-dialog-service.d.ts","sourceRoot":"","sources":["../../src/electron-browser/remote-electron-file-dialog-service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAO,MAAM,aAAa,CAAC;AAEnD,OAAO,EAA8B,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AACjI,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iFAAiF,CAAC;AAC5H,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,qBACa,+BAAgC,SAAQ,yBAAyB;IAEnD,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAE9D,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG;QAAE,aAAa,EAAE,IAAI,CAAC;KAAE,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC1I,cAAc,CAAC,KAAK,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;IAUnG,cAAc,CAAC,KAAK,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;IAQ5G,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;CAgBlE"}
|
|
@@ -17,13 +17,16 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.RemoteElectronFileDialogService = void 0;
|
|
19
19
|
const tslib_1 = require("tslib");
|
|
20
|
+
const core_1 = require("@theia/core");
|
|
20
21
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
22
|
const file_dialog_service_1 = require("@theia/filesystem/lib/browser/file-dialog/file-dialog-service");
|
|
22
23
|
const electron_file_dialog_service_1 = require("@theia/filesystem/lib/electron-browser/file-dialog/electron-file-dialog-service");
|
|
23
24
|
const remote_service_1 = require("./remote-service");
|
|
25
|
+
const local_backend_services_1 = require("./local-backend-services");
|
|
24
26
|
let RemoteElectronFileDialogService = class RemoteElectronFileDialogService extends electron_file_dialog_service_1.ElectronFileDialogService {
|
|
25
27
|
showOpenDialog(props, folder) {
|
|
26
28
|
if (this.remoteService.isConnected()) {
|
|
29
|
+
this.addLocalFilesButton(props);
|
|
27
30
|
return file_dialog_service_1.DefaultFileDialogService.prototype.showOpenDialog.call(this, props, folder);
|
|
28
31
|
}
|
|
29
32
|
else {
|
|
@@ -38,6 +41,23 @@ let RemoteElectronFileDialogService = class RemoteElectronFileDialogService exte
|
|
|
38
41
|
return super.showSaveDialog(props, folder);
|
|
39
42
|
}
|
|
40
43
|
}
|
|
44
|
+
addLocalFilesButton(props) {
|
|
45
|
+
const localFilesButton = {
|
|
46
|
+
label: core_1.nls.localizeByDefault('Show Local'),
|
|
47
|
+
onClick: async (resolve) => {
|
|
48
|
+
const localFile = await super.showOpenDialog({ ...props, fileScheme: local_backend_services_1.LOCAL_FILE_SCHEME });
|
|
49
|
+
if (localFile) {
|
|
50
|
+
resolve({ uri: localFile });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
if (props.additionalButtons) {
|
|
55
|
+
props.additionalButtons.push(localFilesButton);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
props.additionalButtons = [localFilesButton];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
41
61
|
};
|
|
42
62
|
exports.RemoteElectronFileDialogService = RemoteElectronFileDialogService;
|
|
43
63
|
tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-electron-file-dialog-service.js","sourceRoot":"","sources":["../../src/electron-browser/remote-electron-file-dialog-service.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;;;;
|
|
1
|
+
{"version":3,"file":"remote-electron-file-dialog-service.js","source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AO,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;gBACrB,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,cAAc,CAAC,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,0CAAiB,EAAE,CAAC,CAAC;gBAC1F,IAAI,SAAS,EAAE,CAAC;oBACZ,OAAO,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;gBAChC,CAAC;YACL,CAAC;SACJ,CAAC;QACF,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC1B,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACJ,KAAK,CAAC,iBAAiB,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACjD,CAAC;IACL,CAAC;CACJ,CAAA;AAvCY,0EAA+B;AAEE;IAAzC,IAAA,kBAAM,EAAC,8BAAa,CAAC;sCAAmC,8BAAa;sEAAC;0CAF9D,+BAA+B;IAD3C,IAAA,sBAAU,GAAE;GACA,+BAA+B,CAuC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-frontend-module.d.ts","sourceRoot":"","sources":["../../src/electron-browser/remote-frontend-module.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAgB/D,OAAO,6DAA6D,CAAC;;
|
|
1
|
+
{"version":3,"file":"remote-frontend-module.d.ts","sourceRoot":"","sources":["../../src/electron-browser/remote-frontend-module.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAgB/D,OAAO,6DAA6D,CAAC;;AAUrE,wBAmDG"}
|
|
@@ -38,6 +38,9 @@ const remote_user_storage_provider_1 = require("./remote-user-storage-provider")
|
|
|
38
38
|
const remote_file_system_provider_1 = require("@theia/filesystem/lib/common/remote-file-system-provider");
|
|
39
39
|
const local_backend_services_1 = require("./local-backend-services");
|
|
40
40
|
const env_variables_1 = require("@theia/core/lib/common/env-variables");
|
|
41
|
+
const browser_2 = require("@theia/workspace/lib/browser");
|
|
42
|
+
const remote_local_workspace_contribution_1 = require("./remote-local-workspace-contribution");
|
|
43
|
+
const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
|
|
41
44
|
exports.default = new inversify_1.ContainerModule((bind, _, __, rebind) => {
|
|
42
45
|
bind(remote_frontend_contribution_1.RemoteFrontendContribution).toSelf().inSingletonScope();
|
|
43
46
|
bind(browser_1.FrontendApplicationContribution).toService(remote_frontend_contribution_1.RemoteFrontendContribution);
|
|
@@ -66,5 +69,12 @@ exports.default = new inversify_1.ContainerModule((bind, _, __, rebind) => {
|
|
|
66
69
|
ctx.container.get(env_variables_1.EnvVariablesServer));
|
|
67
70
|
bind(local_backend_services_1.LocalRemoteFileSystemProvider).toSelf().inSingletonScope();
|
|
68
71
|
rebind(user_storage_contribution_1.UserStorageContribution).to(remote_user_storage_provider_1.RemoteUserStorageContribution);
|
|
72
|
+
if (browser_1.isRemote) {
|
|
73
|
+
bind(remote_local_workspace_contribution_1.RemoteLocalWorkspaceContribution).toSelf().inSingletonScope();
|
|
74
|
+
bind(browser_2.WorkspaceOpenHandlerContribution).toService(remote_local_workspace_contribution_1.RemoteLocalWorkspaceContribution);
|
|
75
|
+
bind(browser_2.WorkspaceHandlingContribution).toService(remote_local_workspace_contribution_1.RemoteLocalWorkspaceContribution);
|
|
76
|
+
bind(local_backend_services_1.LocalRemoteFileSystemContribution).toSelf().inSingletonScope();
|
|
77
|
+
bind(file_service_1.FileServiceContribution).toService(local_backend_services_1.LocalRemoteFileSystemContribution);
|
|
78
|
+
}
|
|
69
79
|
});
|
|
70
80
|
//# sourceMappingURL=remote-frontend-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-frontend-module.js","sourceRoot":"","sources":["../../src/electron-browser/remote-frontend-module.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,sCAAgF;AAChF,4DAA+D;AAC/D,qDAAyH;AACzH,uEAAkE;AAClE,sGAAiI;AACjI,iFAA4E;AAC5E,iFAA4E;AAC5E,qDAAiD;AACjD,oFAAwG;AACxG,kIAA4H;AAC5H,+FAAwF;AACxF,8EAA8E;AAC9E,qFAA2G;AAC3G,+FAA2F;AAC3F,uFAAkF;AAClF,wGAA0I;AAC1I,+GAA0G;AAC1G,uEAAqE;AACrE,wGAAmG;AACnG,iFAA+E;AAC/E,0GAAsJ;AACtJ,
|
|
1
|
+
{"version":3,"file":"remote-frontend-module.js","sourceRoot":"","sources":["../../src/electron-browser/remote-frontend-module.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,sCAAgF;AAChF,4DAA+D;AAC/D,qDAAyH;AACzH,uEAAkE;AAClE,sGAAiI;AACjI,iFAA4E;AAC5E,iFAA4E;AAC5E,qDAAiD;AACjD,oFAAwG;AACxG,kIAA4H;AAC5H,+FAAwF;AACxF,8EAA8E;AAC9E,qFAA2G;AAC3G,+FAA2F;AAC3F,uFAAkF;AAClF,wGAA0I;AAC1I,+GAA0G;AAC1G,uEAAqE;AACrE,wGAAmG;AACnG,iFAA+E;AAC/E,0GAAsJ;AACtJ,qEAAiK;AACjK,wEAA4F;AAC5F,0DAA+G;AAC/G,+FAAyF;AACzF,6EAAqF;AAErF,kBAAe,IAAI,2BAAe,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C,CAAC,CAAC,SAAS,CAAC,sEAAgC,CAAC,CAAC;QACnF,IAAI,CAAC,uCAA6B,CAAC,CAAC,SAAS,CAAC,sEAAgC,CAAC,CAAC;QAChF,IAAI,CAAC,0DAAiC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACpE,IAAI,CAAC,sCAAuB,CAAC,CAAC,SAAS,CAAC,0DAAiC,CAAC,CAAC;IAC/E,CAAC;AAEL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ILogger, MaybePromise, URI } from '@theia/core';
|
|
2
|
+
import { WorkspaceHandlingContribution, WorkspaceInput, WorkspaceOpenHandlerContribution } from '@theia/workspace/lib/browser';
|
|
3
|
+
import { RemoteStatusService } from '../electron-common/remote-status-service';
|
|
4
|
+
import { WindowService } from '@theia/core/lib/browser/window/window-service';
|
|
5
|
+
import { WorkspacePreferences } from '@theia/workspace/lib/common';
|
|
6
|
+
export declare class RemoteLocalWorkspaceContribution implements WorkspaceOpenHandlerContribution, WorkspaceHandlingContribution {
|
|
7
|
+
protected readonly remoteStatusService: RemoteStatusService;
|
|
8
|
+
protected readonly windowService: WindowService;
|
|
9
|
+
protected logger: ILogger;
|
|
10
|
+
protected preferences: WorkspacePreferences;
|
|
11
|
+
canHandle(uri: URI): boolean;
|
|
12
|
+
modifyRecentWorkspaces(workspaces: string[]): Promise<string[]>;
|
|
13
|
+
openWorkspace(uri: URI, options?: WorkspaceInput | undefined): MaybePromise<void>;
|
|
14
|
+
protected reloadWindow(workspacePath: string): void;
|
|
15
|
+
protected openNewWindow(workspacePath: string): void;
|
|
16
|
+
protected getModifiedUrl(): URL;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=remote-local-workspace-contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-local-workspace-contribution.d.ts","sourceRoot":"","sources":["../../src/electron-browser/remote-local-workspace-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,6BAA6B,EAAE,cAAc,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAG/H,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,qBACa,gCAAiC,YAAW,gCAAgC,EAAE,6BAA6B;IAGpH,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAG5D,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAGhD,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;IAG1B,SAAS,CAAC,WAAW,EAAE,oBAAoB,CAAC;IAE5C,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO;IAItB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAWrE,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC;IAcjF,SAAS,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAOnD,SAAS,CAAC,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAMpD,SAAS,CAAC,cAAc,IAAI,GAAG;CAMlC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2024 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.RemoteLocalWorkspaceContribution = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const core_1 = require("@theia/core");
|
|
21
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
+
const local_backend_services_1 = require("./local-backend-services");
|
|
23
|
+
const electron_local_ws_connection_source_1 = require("@theia/core/lib/electron-browser/messaging/electron-local-ws-connection-source");
|
|
24
|
+
const remote_status_service_1 = require("../electron-common/remote-status-service");
|
|
25
|
+
const window_service_1 = require("@theia/core/lib/browser/window/window-service");
|
|
26
|
+
const common_1 = require("@theia/workspace/lib/common");
|
|
27
|
+
let RemoteLocalWorkspaceContribution = class RemoteLocalWorkspaceContribution {
|
|
28
|
+
canHandle(uri) {
|
|
29
|
+
return uri.scheme === local_backend_services_1.LOCAL_FILE_SCHEME;
|
|
30
|
+
}
|
|
31
|
+
async modifyRecentWorkspaces(workspaces) {
|
|
32
|
+
return workspaces.map(workspace => {
|
|
33
|
+
const uri = new core_1.URI(workspace);
|
|
34
|
+
if (uri.scheme === 'file') {
|
|
35
|
+
return uri.withScheme(local_backend_services_1.LOCAL_FILE_SCHEME).toString();
|
|
36
|
+
}
|
|
37
|
+
// possible check as well if a remote/dev-container workspace is from the connected remote and therefore change it to the 'file' scheme
|
|
38
|
+
return workspace;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
openWorkspace(uri, options) {
|
|
42
|
+
const workspacePath = uri.path.toString();
|
|
43
|
+
if (this.preferences['workspace.preserveWindow'] || (options && options.preserveWindow)) {
|
|
44
|
+
this.reloadWindow(workspacePath);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
try {
|
|
48
|
+
this.openNewWindow(workspacePath);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
this.logger.error(error.toString()).then(() => this.reloadWindow(workspacePath));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
reloadWindow(workspacePath) {
|
|
56
|
+
const currentPort = (0, electron_local_ws_connection_source_1.getCurrentPort)();
|
|
57
|
+
this.remoteStatusService.connectionClosed(parseInt(currentPort ?? '0'));
|
|
58
|
+
const searchParams = this.getModifiedUrl().searchParams;
|
|
59
|
+
this.windowService.reload({ hash: encodeURI(workspacePath), search: Object.fromEntries(searchParams) });
|
|
60
|
+
}
|
|
61
|
+
openNewWindow(workspacePath) {
|
|
62
|
+
const url = this.getModifiedUrl();
|
|
63
|
+
url.hash = encodeURI(workspacePath);
|
|
64
|
+
this.windowService.openNewWindow(url.toString());
|
|
65
|
+
}
|
|
66
|
+
getModifiedUrl() {
|
|
67
|
+
const url = new URL(window.location.href);
|
|
68
|
+
url.searchParams.set(electron_local_ws_connection_source_1.CURRENT_PORT_PARAM, (0, electron_local_ws_connection_source_1.getLocalPort)() ?? '');
|
|
69
|
+
url.searchParams.delete(electron_local_ws_connection_source_1.LOCAL_PORT_PARAM);
|
|
70
|
+
return url;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
exports.RemoteLocalWorkspaceContribution = RemoteLocalWorkspaceContribution;
|
|
74
|
+
tslib_1.__decorate([
|
|
75
|
+
(0, inversify_1.inject)(remote_status_service_1.RemoteStatusService),
|
|
76
|
+
tslib_1.__metadata("design:type", Object)
|
|
77
|
+
], RemoteLocalWorkspaceContribution.prototype, "remoteStatusService", void 0);
|
|
78
|
+
tslib_1.__decorate([
|
|
79
|
+
(0, inversify_1.inject)(window_service_1.WindowService),
|
|
80
|
+
tslib_1.__metadata("design:type", Object)
|
|
81
|
+
], RemoteLocalWorkspaceContribution.prototype, "windowService", void 0);
|
|
82
|
+
tslib_1.__decorate([
|
|
83
|
+
(0, inversify_1.inject)(core_1.ILogger),
|
|
84
|
+
tslib_1.__metadata("design:type", Object)
|
|
85
|
+
], RemoteLocalWorkspaceContribution.prototype, "logger", void 0);
|
|
86
|
+
tslib_1.__decorate([
|
|
87
|
+
(0, inversify_1.inject)(common_1.WorkspacePreferences),
|
|
88
|
+
tslib_1.__metadata("design:type", Object)
|
|
89
|
+
], RemoteLocalWorkspaceContribution.prototype, "preferences", void 0);
|
|
90
|
+
exports.RemoteLocalWorkspaceContribution = RemoteLocalWorkspaceContribution = tslib_1.__decorate([
|
|
91
|
+
(0, inversify_1.injectable)()
|
|
92
|
+
], RemoteLocalWorkspaceContribution);
|
|
93
|
+
//# sourceMappingURL=remote-local-workspace-contribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-local-workspace-contribution.js","sourceRoot":"","sources":["../../src/electron-browser/remote-local-workspace-contribution.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,sCAAyD;AACzD,4DAAkE;AAElE,qEAA6D;AAC7D,wIAAoK;AACpK,oFAA+E;AAC/E,kFAA8E;AAC9E,wDAAmE;AAG5D,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;IAczC,SAAS,CAAC,GAAQ;QACd,OAAO,GAAG,CAAC,MAAM,KAAK,0CAAiB,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,sBAAsB,CAAC,UAAoB;QAC7C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AC,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAC5G,CAAC;IAES,aAAa,CAAC,aAAqB;QACzC,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAClC,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,aAAa,CAAC,CAAC;QACpC,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrD,CAAC;IAES,cAAc;QACpB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,wDAAkB,EAAE,IAAA,kDAAY,GAAE,IAAI,EAAE,CAAC,CAAC;QAC/D,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,sDAAgB,CAAC,CAAC;QAC1C,OAAO,GAAG,CAAC;IACf,CAAC;CACJ,CAAA;AA9DY,4EAAgC;AAGtB;IADlB,IAAA,kBAAM,EAAC,2CAAmB,CAAC;;6EACgC;AAGzC;IADlB,IAAA,kBAAM,EAAC,8BAAa,CAAC;;uEAC0B;AAGtC;IADT,IAAA,kBAAM,EAAC,cAAO,CAAC;;gEACU;AAGhB;IADT,IAAA,kBAAM,EAAC,6BAAoB,CAAC;;qEACe;2CAZnC,gCAAgC;IAD5C,IAAA,sBAAU,GAAE;GACA,gCAAgC,CA8D5C"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/remote",
|
|
3
|
-
"version": "1.70.0-next.
|
|
3
|
+
"version": "1.70.0-next.71+7ece9ea62",
|
|
4
4
|
"description": "Theia - Remote",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.70.0-next.
|
|
7
|
-
"@theia/filesystem": "1.70.0-next.
|
|
8
|
-
"@theia/userstorage": "1.70.0-next.
|
|
9
|
-
"@theia/variable-resolver": "1.70.0-next.
|
|
6
|
+
"@theia/core": "1.70.0-next.71+7ece9ea62",
|
|
7
|
+
"@theia/filesystem": "1.70.0-next.71+7ece9ea62",
|
|
8
|
+
"@theia/userstorage": "1.70.0-next.71+7ece9ea62",
|
|
9
|
+
"@theia/variable-resolver": "1.70.0-next.71+7ece9ea62",
|
|
10
|
+
"@theia/workspace": "1.70.0-next.71+7ece9ea62",
|
|
10
11
|
"archiver": "^5.3.1",
|
|
11
12
|
"decompress": "^4.2.1",
|
|
12
13
|
"decompress-tar": "^4.0.0",
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
"glob": "^8.1.0",
|
|
17
18
|
"socket.io": "^4.5.3",
|
|
18
19
|
"socket.io-client": "^4.5.3",
|
|
19
|
-
"ssh-config": "
|
|
20
|
+
"ssh-config": "~5.0.3",
|
|
20
21
|
"ssh2": "^1.15.0",
|
|
21
22
|
"ssh2-sftp-client": "^9.1.0",
|
|
22
23
|
"tslib": "^2.6.2"
|
|
@@ -66,5 +67,5 @@
|
|
|
66
67
|
"nyc": {
|
|
67
68
|
"extends": "../../configs/nyc.json"
|
|
68
69
|
},
|
|
69
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "7ece9ea6295b73ee1ac962e29d416cebf578d380"
|
|
70
71
|
}
|
|
@@ -14,13 +14,15 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { RpcProxy } from '@theia/core';
|
|
17
|
+
import { RpcProxy, URI } from '@theia/core';
|
|
18
18
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
19
19
|
import { RemoteFileSystemProvider, RemoteFileSystemServer } from '@theia/filesystem/lib/common/remote-file-system-provider';
|
|
20
|
+
import { FileService, FileServiceContribution } from '@theia/filesystem/lib/browser/file-service';
|
|
20
21
|
|
|
21
22
|
export const LocalEnvVariablesServer = Symbol('LocalEnviromentVariableServer');
|
|
22
23
|
export const LocalRemoteFileSytemServer = Symbol('LocalRemoteFileSytemServer');
|
|
23
24
|
|
|
25
|
+
export const LOCAL_FILE_SCHEME = 'localfile';
|
|
24
26
|
/**
|
|
25
27
|
* provide file access to local files while connected to a remote workspace or dev container.
|
|
26
28
|
*/
|
|
@@ -28,4 +30,38 @@ export const LocalRemoteFileSytemServer = Symbol('LocalRemoteFileSytemServer');
|
|
|
28
30
|
export class LocalRemoteFileSystemProvider extends RemoteFileSystemProvider {
|
|
29
31
|
@inject(LocalRemoteFileSytemServer)
|
|
30
32
|
protected override readonly server: RpcProxy<RemoteFileSystemServer>;
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@injectable()
|
|
37
|
+
export class LocalRemoteFileSystemContribution implements FileServiceContribution {
|
|
38
|
+
@inject(LocalRemoteFileSystemProvider)
|
|
39
|
+
protected readonly provider: LocalRemoteFileSystemProvider;
|
|
40
|
+
|
|
41
|
+
registerFileSystemProviders(service: FileService): void {
|
|
42
|
+
service.onWillActivateFileSystemProvider(event => {
|
|
43
|
+
if (event.scheme === LOCAL_FILE_SCHEME) {
|
|
44
|
+
// This provider currently has limited functionality. It can not yet be used to react to listener events like onDidChangeFile
|
|
45
|
+
service.registerProvider(LOCAL_FILE_SCHEME, new Proxy(this.provider, {
|
|
46
|
+
get(target, prop): unknown {
|
|
47
|
+
const member = target[prop as keyof LocalRemoteFileSystemProvider];
|
|
48
|
+
|
|
49
|
+
if (typeof member === 'function') {
|
|
50
|
+
return (...args: unknown[]) => {
|
|
51
|
+
const mappedArgs = args.map(arg => {
|
|
52
|
+
if (arg instanceof URI && arg.scheme === LOCAL_FILE_SCHEME) {
|
|
53
|
+
return arg.withScheme('file');
|
|
54
|
+
}
|
|
55
|
+
return arg;
|
|
56
|
+
});
|
|
57
|
+
return member.apply(target, mappedArgs);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return member;
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
31
67
|
}
|
|
@@ -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 { MaybeArray, URI } from '@theia/core';
|
|
17
|
+
import { MaybeArray, URI, nls } from '@theia/core';
|
|
18
18
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
19
|
-
import { OpenFileDialogProps, SaveFileDialogProps } from '@theia/filesystem/lib/browser/file-dialog';
|
|
19
|
+
import { AdditionalButtonDefinition, OpenFileDialogProps, SaveFileDialogProps } from '@theia/filesystem/lib/browser/file-dialog';
|
|
20
20
|
import { FileStat } from '@theia/filesystem/lib/common/files';
|
|
21
21
|
import { DefaultFileDialogService } from '@theia/filesystem/lib/browser/file-dialog/file-dialog-service';
|
|
22
22
|
import { ElectronFileDialogService } from '@theia/filesystem/lib/electron-browser/file-dialog/electron-file-dialog-service';
|
|
23
23
|
import { RemoteService } from './remote-service';
|
|
24
|
+
import { LOCAL_FILE_SCHEME } from './local-backend-services';
|
|
24
25
|
|
|
25
26
|
@injectable()
|
|
26
27
|
export class RemoteElectronFileDialogService extends ElectronFileDialogService {
|
|
@@ -31,6 +32,7 @@ export class RemoteElectronFileDialogService extends ElectronFileDialogService {
|
|
|
31
32
|
override showOpenDialog(props: OpenFileDialogProps, folder?: FileStat | undefined): Promise<URI | undefined>;
|
|
32
33
|
override showOpenDialog(props: OpenFileDialogProps, folder?: FileStat): Promise<MaybeArray<URI> | undefined> | Promise<URI | undefined> {
|
|
33
34
|
if (this.remoteService.isConnected()) {
|
|
35
|
+
this.addLocalFilesButton(props);
|
|
34
36
|
return DefaultFileDialogService.prototype.showOpenDialog.call(this, props, folder);
|
|
35
37
|
} else {
|
|
36
38
|
return super.showOpenDialog(props, folder);
|
|
@@ -44,4 +46,21 @@ export class RemoteElectronFileDialogService extends ElectronFileDialogService {
|
|
|
44
46
|
return super.showSaveDialog(props, folder);
|
|
45
47
|
}
|
|
46
48
|
}
|
|
49
|
+
|
|
50
|
+
protected addLocalFilesButton(props: OpenFileDialogProps): void {
|
|
51
|
+
const localFilesButton: AdditionalButtonDefinition<{ uri: URI }> = {
|
|
52
|
+
label: nls.localizeByDefault('Show Local'),
|
|
53
|
+
onClick: async resolve => {
|
|
54
|
+
const localFile = await super.showOpenDialog({ ...props, fileScheme: LOCAL_FILE_SCHEME });
|
|
55
|
+
if (localFile) {
|
|
56
|
+
resolve({ uri: localFile });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
if (props.additionalButtons) {
|
|
61
|
+
props.additionalButtons.push(localFilesButton);
|
|
62
|
+
} else {
|
|
63
|
+
props.additionalButtons = [localFilesButton];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
47
66
|
}
|
|
@@ -35,8 +35,11 @@ import '../../src/electron-browser/style/port-forwarding-widget.css';
|
|
|
35
35
|
import { UserStorageContribution } from '@theia/userstorage/lib/browser/user-storage-contribution';
|
|
36
36
|
import { RemoteUserStorageContribution } from './remote-user-storage-provider';
|
|
37
37
|
import { remoteFileSystemPath, RemoteFileSystemProxyFactory, RemoteFileSystemServer } from '@theia/filesystem/lib/common/remote-file-system-provider';
|
|
38
|
-
import { LocalEnvVariablesServer, LocalRemoteFileSystemProvider, LocalRemoteFileSytemServer } from './local-backend-services';
|
|
38
|
+
import { LocalEnvVariablesServer, LocalRemoteFileSystemContribution, LocalRemoteFileSystemProvider, LocalRemoteFileSytemServer } from './local-backend-services';
|
|
39
39
|
import { envVariablesPath, EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
40
|
+
import { WorkspaceHandlingContribution, WorkspaceOpenHandlerContribution } from '@theia/workspace/lib/browser';
|
|
41
|
+
import { RemoteLocalWorkspaceContribution } from './remote-local-workspace-contribution';
|
|
42
|
+
import { FileServiceContribution } from '@theia/filesystem/lib/browser/file-service';
|
|
40
43
|
|
|
41
44
|
export default new ContainerModule((bind, _, __, rebind) => {
|
|
42
45
|
bind(RemoteFrontendContribution).toSelf().inSingletonScope();
|
|
@@ -81,4 +84,12 @@ export default new ContainerModule((bind, _, __, rebind) => {
|
|
|
81
84
|
bind(LocalRemoteFileSystemProvider).toSelf().inSingletonScope();
|
|
82
85
|
rebind(UserStorageContribution).to(RemoteUserStorageContribution);
|
|
83
86
|
|
|
87
|
+
if (isRemote) {
|
|
88
|
+
bind(RemoteLocalWorkspaceContribution).toSelf().inSingletonScope();
|
|
89
|
+
bind(WorkspaceOpenHandlerContribution).toService(RemoteLocalWorkspaceContribution);
|
|
90
|
+
bind(WorkspaceHandlingContribution).toService(RemoteLocalWorkspaceContribution);
|
|
91
|
+
bind(LocalRemoteFileSystemContribution).toSelf().inSingletonScope();
|
|
92
|
+
bind(FileServiceContribution).toService(LocalRemoteFileSystemContribution);
|
|
93
|
+
}
|
|
94
|
+
|
|
84
95
|
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 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
|
+
import { ILogger, MaybePromise, URI } from '@theia/core';
|
|
18
|
+
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
19
|
+
import { WorkspaceHandlingContribution, WorkspaceInput, WorkspaceOpenHandlerContribution } from '@theia/workspace/lib/browser';
|
|
20
|
+
import { LOCAL_FILE_SCHEME } from './local-backend-services';
|
|
21
|
+
import { CURRENT_PORT_PARAM, LOCAL_PORT_PARAM, getCurrentPort, getLocalPort } from '@theia/core/lib/electron-browser/messaging/electron-local-ws-connection-source';
|
|
22
|
+
import { RemoteStatusService } from '../electron-common/remote-status-service';
|
|
23
|
+
import { WindowService } from '@theia/core/lib/browser/window/window-service';
|
|
24
|
+
import { WorkspacePreferences } from '@theia/workspace/lib/common';
|
|
25
|
+
|
|
26
|
+
@injectable()
|
|
27
|
+
export class RemoteLocalWorkspaceContribution implements WorkspaceOpenHandlerContribution, WorkspaceHandlingContribution {
|
|
28
|
+
|
|
29
|
+
@inject(RemoteStatusService)
|
|
30
|
+
protected readonly remoteStatusService: RemoteStatusService;
|
|
31
|
+
|
|
32
|
+
@inject(WindowService)
|
|
33
|
+
protected readonly windowService: WindowService;
|
|
34
|
+
|
|
35
|
+
@inject(ILogger)
|
|
36
|
+
protected logger: ILogger;
|
|
37
|
+
|
|
38
|
+
@inject(WorkspacePreferences)
|
|
39
|
+
protected preferences: WorkspacePreferences;
|
|
40
|
+
|
|
41
|
+
canHandle(uri: URI): boolean {
|
|
42
|
+
return uri.scheme === LOCAL_FILE_SCHEME;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async modifyRecentWorkspaces(workspaces: string[]): Promise<string[]> {
|
|
46
|
+
return workspaces.map(workspace => {
|
|
47
|
+
const uri = new URI(workspace);
|
|
48
|
+
if (uri.scheme === 'file') {
|
|
49
|
+
return uri.withScheme(LOCAL_FILE_SCHEME).toString();
|
|
50
|
+
}
|
|
51
|
+
// possible check as well if a remote/dev-container workspace is from the connected remote and therefore change it to the 'file' scheme
|
|
52
|
+
return workspace;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
openWorkspace(uri: URI, options?: WorkspaceInput | undefined): MaybePromise<void> {
|
|
57
|
+
const workspacePath = uri.path.toString();
|
|
58
|
+
|
|
59
|
+
if (this.preferences['workspace.preserveWindow'] || (options && options.preserveWindow)) {
|
|
60
|
+
this.reloadWindow(workspacePath);
|
|
61
|
+
} else {
|
|
62
|
+
try {
|
|
63
|
+
this.openNewWindow(workspacePath);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
this.logger.error(error.toString()).then(() => this.reloadWindow(workspacePath));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
protected reloadWindow(workspacePath: string): void {
|
|
71
|
+
const currentPort = getCurrentPort();
|
|
72
|
+
this.remoteStatusService.connectionClosed(parseInt(currentPort ?? '0'));
|
|
73
|
+
const searchParams = this.getModifiedUrl().searchParams;
|
|
74
|
+
this.windowService.reload({ hash: encodeURI(workspacePath), search: Object.fromEntries(searchParams) });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
protected openNewWindow(workspacePath: string): void {
|
|
78
|
+
const url = this.getModifiedUrl();
|
|
79
|
+
url.hash = encodeURI(workspacePath);
|
|
80
|
+
this.windowService.openNewWindow(url.toString());
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
protected getModifiedUrl(): URL {
|
|
84
|
+
const url = new URL(window.location.href);
|
|
85
|
+
url.searchParams.set(CURRENT_PORT_PARAM, getLocalPort() ?? '');
|
|
86
|
+
url.searchParams.delete(LOCAL_PORT_PARAM);
|
|
87
|
+
return url;
|
|
88
|
+
}
|
|
89
|
+
}
|