-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remote: still use settings and configuration from the local user dir (#…
…14548) * Remote: still use settings and configuration from the local user dir --------- Signed-off-by: Jonah Iden <[email protected]>
- Loading branch information
1 parent
15e9e26
commit 66c1b9d
Showing
11 changed files
with
145 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/remote/src/electron-browser/local-backend-services.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// ***************************************************************************** | ||
// Copyright (C) 2024 TypeFox and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0. | ||
// | ||
// This Source Code may also be made available under the following Secondary | ||
// Licenses when the conditions for such availability set forth in the Eclipse | ||
// Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
// with the GNU Classpath Exception which is available at | ||
// https://www.gnu.org/software/classpath/license.html. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import { RpcProxy } from '@theia/core'; | ||
import { inject, injectable } from '@theia/core/shared/inversify'; | ||
import { RemoteFileSystemProvider, RemoteFileSystemServer } from '@theia/filesystem/lib/common/remote-file-system-provider'; | ||
|
||
export const LocalEnvVariablesServer = Symbol('LocalEnviromentVariableServer'); | ||
export const LocalRemoteFileSytemServer = Symbol('LocalRemoteFileSytemServer'); | ||
|
||
/** | ||
* provide file access to local files while connected to a remote workspace or dev container. | ||
*/ | ||
@injectable() | ||
export class LocalRemoteFileSystemProvider extends RemoteFileSystemProvider { | ||
@inject(LocalRemoteFileSytemServer) | ||
protected override readonly server: RpcProxy<RemoteFileSystemServer>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
packages/remote/src/electron-browser/remote-user-storage-provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// ***************************************************************************** | ||
// Copyright (C) 2024 TypeFox and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0. | ||
// | ||
// This Source Code may also be made available under the following Secondary | ||
// Licenses when the conditions for such availability set forth in the Eclipse | ||
// Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
// with the GNU Classpath Exception which is available at | ||
// https://www.gnu.org/software/classpath/license.html. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; | ||
import { FileService } from '@theia/filesystem/lib/browser/file-service'; | ||
import { FileSystemProvider } from '@theia/filesystem/lib/common/files'; | ||
import { UserStorageContribution } from '@theia/userstorage/lib/browser/user-storage-contribution'; | ||
import { RemoteStatusService } from '../electron-common/remote-status-service'; | ||
import { LocalEnvVariablesServer, LocalRemoteFileSystemProvider } from './local-backend-services'; | ||
import { Deferred } from '@theia/core/lib/common/promise-util'; | ||
import { URI } from '@theia/core'; | ||
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables'; | ||
import { getCurrentPort } from '@theia/core/lib/electron-browser/messaging/electron-local-ws-connection-source'; | ||
|
||
/** | ||
* This overide is to have remote connections still use settings, keymaps, etc. from the local machine. | ||
*/ | ||
@injectable() | ||
export class RemoteUserStorageContribution extends UserStorageContribution { | ||
@inject(RemoteStatusService) | ||
protected readonly remoteStatusService: RemoteStatusService; | ||
|
||
@inject(LocalRemoteFileSystemProvider) | ||
protected readonly localRemoteFileSystemProvider: LocalRemoteFileSystemProvider; | ||
|
||
@inject(LocalEnvVariablesServer) | ||
protected readonly localEnvironments: EnvVariablesServer; | ||
|
||
isRemoteConnection: Deferred<boolean> = new Deferred(); | ||
|
||
@postConstruct() | ||
protected init(): void { | ||
const port = getCurrentPort(); | ||
if (port) { | ||
this.remoteStatusService.getStatus(Number(port)).then(status => this.isRemoteConnection.resolve(status.alive)); | ||
} | ||
} | ||
|
||
protected override async getDelegate(service: FileService): Promise<FileSystemProvider> { | ||
return await this.isRemoteConnection.promise ? | ||
this.localRemoteFileSystemProvider | ||
: service.activateProvider('file'); | ||
} | ||
|
||
protected override async getCongigDirUri(): Promise<URI> { | ||
return await this.isRemoteConnection.promise ? | ||
new URI(await this.localEnvironments.getConfigDirUri()) | ||
: super.getCongigDirUri(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,9 @@ | |
}, | ||
{ | ||
"path": "../filesystem" | ||
}, | ||
{ | ||
"path": "../userstorage" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters