Skip to content

Commit 8d0ce97

Browse files
author
Benjamin Pasero
committed
schemas - add vscodeRemote
1 parent 29d9a9a commit 8d0ce97

7 files changed

Lines changed: 11 additions & 12 deletions

File tree

src/vs/base/common/network.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,6 @@ export namespace Schemas {
4444
export const data: string = 'data';
4545

4646
export const command: string = 'command';
47+
48+
export const vscodeRemote: string = 'vscode-remote';
4749
}

src/vs/code/electron-main/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ import { storeBackgroundColor } from 'vs/code/electron-main/theme';
6767
import { homedir } from 'os';
6868
import { join, sep } from 'vs/base/common/path';
6969
import { localize } from 'vs/nls';
70-
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
70+
import { Schemas } from 'vs/base/common/network';
7171
import { REMOTE_FILE_SYSTEM_CHANNEL_NAME } from 'vs/platform/remote/common/remoteAgentFileSystemChannel';
7272
import { ResolvedAuthority } from 'vs/platform/remote/common/remoteAuthorityResolver';
7373
import { SnapUpdateService } from 'vs/platform/update/electron-main/updateService.snap';
@@ -748,7 +748,7 @@ export class CodeApplication extends Disposable {
748748
}
749749
};
750750

751-
protocol.registerBufferProtocol(REMOTE_HOST_SCHEME, async (request, callback) => {
751+
protocol.registerBufferProtocol(Schemas.vscodeRemote, async (request, callback) => {
752752
if (request.method !== 'GET') {
753753
return callback(undefined);
754754
}

src/vs/platform/remote/common/remoteHosts.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { URI } from 'vs/base/common/uri';
7+
import { Schemas } from 'vs/base/common/network';
78

8-
export const REMOTE_HOST_SCHEME = 'vscode-remote';
9+
export const REMOTE_HOST_SCHEME = Schemas.vscodeRemote;
910

1011
export function getRemoteAuthority(uri: URI): string | undefined {
1112
return uri.scheme === REMOTE_HOST_SCHEME ? uri.authority : undefined;

src/vs/workbench/contrib/files/browser/fileCommands.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import { onUnexpectedError } from 'vs/base/common/errors';
4141
import { basename } from 'vs/base/common/resources';
4242
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
4343
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
44-
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
4544

4645
// Commands
4746

@@ -140,7 +139,7 @@ function save(
140139
savePromise = textFileService.save(resource, options).then(result => {
141140
if (result) {
142141
if (environmentService.configuration.remoteAuthority) {
143-
return resource.with({ scheme: REMOTE_HOST_SCHEME });
142+
return resource.with({ scheme: Schemas.vscodeRemote });
144143
}
145144

146145
return resource.with({ scheme: Schemas.file });

src/vs/workbench/contrib/files/common/files.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsSe
2424
import { ExplorerItem } from 'vs/workbench/contrib/files/common/explorerModel';
2525
import { once } from 'vs/base/common/functional';
2626
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
27-
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
2827

2928
/**
3029
* Explorer viewlet id.
@@ -199,7 +198,7 @@ export class FileOnDiskContentProvider implements ITextModelContentProvider {
199198

200199
private toSavedFileResource(resource: URI): URI {
201200
if (this.environmentService.configuration.remoteAuthority) {
202-
return resource.with({ scheme: REMOTE_HOST_SCHEME }); // assume file on disk is remote
201+
return resource.with({ scheme: Schemas.vscodeRemote }); // assume file on disk is remote
203202
}
204203

205204
return resource.with({ scheme: Schemas.file });

src/vs/workbench/electron-browser/main.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import { IFileService } from 'vs/platform/files/common/files';
4646
import { DiskFileSystemProvider } from 'vs/workbench/services/files2/electron-browser/diskFileSystemProvider';
4747
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
4848
import { REMOTE_FILE_SYSTEM_CHANNEL_NAME, RemoteExtensionsFileSystemProvider } from 'vs/platform/remote/common/remoteAgentFileSystemChannel';
49-
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
5049
import { DefaultConfigurationExportHelper } from 'vs/workbench/services/configuration/node/configurationExportHelper';
5150
import { ConfigurationCache } from 'vs/workbench/services/configuration/node/configurationCache';
5251
import { ConfigurationFileService } from 'vs/workbench/services/configuration/node/configurationFileService';
@@ -201,7 +200,7 @@ class CodeRendererMain extends Disposable {
201200
if (connection) {
202201
const channel = connection.getChannel<IChannel>(REMOTE_FILE_SYSTEM_CHANNEL_NAME);
203202
const remoteFileSystemProvider = this._register(new RemoteExtensionsFileSystemProvider(channel, remoteAgentService.getEnvironment()));
204-
fileService.registerProvider(REMOTE_HOST_SCHEME, remoteFileSystemProvider);
203+
fileService.registerProvider(Schemas.vscodeRemote, remoteFileSystemProvider);
205204
}
206205

207206
return this.resolveWorkspaceInitializationPayload(environmentService).then(payload => Promise.all([

src/vs/workbench/services/textfile/common/textFileService.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import { IModelService } from 'vs/editor/common/services/modelService';
3232
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
3333
import { isEqualOrParent, isEqual, joinPath, dirname, extname, basename } from 'vs/base/common/resources';
3434
import { posix } from 'vs/base/common/path';
35-
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
3635
import { getConfirmMessage, IDialogService, IFileDialogService, ISaveDialogOptions, IConfirmation } from 'vs/platform/dialogs/common/dialogs';
3736
import { IModeService } from 'vs/editor/common/services/modeService';
3837
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -615,7 +614,7 @@ export class TextFileService extends Disposable implements ITextFileService {
615614
if (path && path[0] !== posix.sep) {
616615
path = posix.sep + path;
617616
}
618-
return untitled.with({ scheme: REMOTE_HOST_SCHEME, authority, path });
617+
return untitled.with({ scheme: Schemas.vscodeRemote, authority, path });
619618
}
620619
return untitled.with({ scheme: Schemas.file });
621620
}
@@ -800,7 +799,7 @@ export class TextFileService extends Disposable implements ITextFileService {
800799
private suggestFileName(untitledResource: URI): URI {
801800
const untitledFileName = this.untitledEditorService.suggestFileName(untitledResource);
802801
const remoteAuthority = this.environmentService.configuration.remoteAuthority;
803-
const schemeFilter = remoteAuthority ? REMOTE_HOST_SCHEME : Schemas.file;
802+
const schemeFilter = remoteAuthority ? Schemas.vscodeRemote : Schemas.file;
804803

805804
const lastActiveFile = this.historyService.getLastActiveFile(schemeFilter);
806805
if (lastActiveFile) {

0 commit comments

Comments
 (0)