diff --git a/src/vs/platform/remote/common/remoteHosts.ts b/src/vs/platform/remote/common/remoteHosts.ts index feb46455ac48c..1f3ab36f30372 100644 --- a/src/vs/platform/remote/common/remoteHosts.ts +++ b/src/vs/platform/remote/common/remoteHosts.ts @@ -6,10 +6,8 @@ import { URI } from 'vs/base/common/uri'; import { Schemas } from 'vs/base/common/network'; -export const REMOTE_HOST_SCHEME = Schemas.vscodeRemote; - export function getRemoteAuthority(uri: URI): string | undefined { - return uri.scheme === REMOTE_HOST_SCHEME ? uri.authority : undefined; + return uri.scheme === Schemas.vscodeRemote ? uri.authority : undefined; } export function getRemoteName(authority: string): string; diff --git a/src/vs/platform/webview/common/webviewPortMapping.ts b/src/vs/platform/webview/common/webviewPortMapping.ts index dbd8b65a9cd82..5815431305587 100644 --- a/src/vs/platform/webview/common/webviewPortMapping.ts +++ b/src/vs/platform/webview/common/webviewPortMapping.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import { IDisposable } from 'vs/base/common/lifecycle'; +import { Schemas } from 'vs/base/common/network'; import { URI } from 'vs/base/common/uri'; import { IAddress } from 'vs/platform/remote/common/remoteAgentConnection'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; import { extractLocalHostUriMetaDataForPortMapping, ITunnelService, RemoteTunnel } from 'vs/platform/remote/common/tunnel'; export interface IWebviewPortMapping { @@ -37,7 +37,7 @@ export class WebviewPortMappingManager implements IDisposable { for (const mapping of this._getMappings()) { if (mapping.webviewPort === requestLocalHostInfo.port) { const extensionLocation = this._getExtensionLocation(); - if (extensionLocation && extensionLocation.scheme === REMOTE_HOST_SCHEME) { + if (extensionLocation && extensionLocation.scheme === Schemas.vscodeRemote) { const tunnel = resolveAuthority && await this.getOrCreateTunnel(resolveAuthority, mapping.extensionHostPort); if (tunnel) { if (tunnel.tunnelLocalPort === mapping.webviewPort) { diff --git a/src/vs/platform/webview/electron-main/webviewProtocolProvider.ts b/src/vs/platform/webview/electron-main/webviewProtocolProvider.ts index 7c158fa38951f..32fdd04cd2830 100644 --- a/src/vs/platform/webview/electron-main/webviewProtocolProvider.ts +++ b/src/vs/platform/webview/electron-main/webviewProtocolProvider.ts @@ -11,7 +11,6 @@ import { Schemas } from 'vs/base/common/network'; import { URI } from 'vs/base/common/uri'; import { FileOperationError, FileOperationResult, IFileService } from 'vs/platform/files/common/files'; import { IRemoteConnectionData } from 'vs/platform/remote/common/remoteAuthorityResolver'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; import { IRequestService } from 'vs/platform/request/common/request'; import { loadLocalResource, webviewPartitionId, WebviewResourceResponse } from 'vs/platform/webview/common/resourceLoader'; import { IWindowsMainService } from 'vs/platform/windows/electron-main/windows'; @@ -161,7 +160,7 @@ export class WebviewProtocolProvider extends Disposable { if (metadata.remoteConnectionData) { rewriteUri = (uri) => { if (metadata.remoteConnectionData) { - if (uri.scheme === Schemas.vscodeRemote || (metadata.extensionLocation?.scheme === REMOTE_HOST_SCHEME)) { + if (uri.scheme === Schemas.vscodeRemote || (metadata.extensionLocation?.scheme === Schemas.vscodeRemote)) { return URI.parse(`http://${metadata.remoteConnectionData.host}:${metadata.remoteConnectionData.port}`).with({ path: '/vscode-remote-resource', query: `tkn=${metadata.remoteConnectionData.connectionToken}&path=${encodeURIComponent(uri.path)}`, diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts index 9c02c26701847..60f3c9612e7e9 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts @@ -39,7 +39,7 @@ import { IMenuService, IMenu, MenuId } from 'vs/platform/actions/common/actions' import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IHostService } from 'vs/workbench/services/host/browser/host'; import { IProductService } from 'vs/platform/product/common/productService'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; +import { Schemas } from 'vs/base/common/network'; export class TitlebarPart extends Part implements ITitleService { @@ -290,7 +290,7 @@ export class TitlebarPart extends Part implements ITitleService { const folderPath = folder ? this.labelService.getUriLabel(folder.uri) : ''; const dirty = editor?.isDirty() && !editor.isSaving() ? TitlebarPart.TITLE_DIRTY : ''; const appName = this.productService.nameLong; - const remoteName = this.labelService.getHostLabel(REMOTE_HOST_SCHEME, this.environmentService.configuration.remoteAuthority); + const remoteName = this.labelService.getHostLabel(Schemas.vscodeRemote, this.environmentService.configuration.remoteAuthority); const separator = this.configurationService.getValue('window.titleSeparator'); const titleTemplate = this.configurationService.getValue('window.title'); diff --git a/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts b/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts index d34cf3bdd8aef..76dabfd2b9c50 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts @@ -39,7 +39,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage'; import { ILabelService } from 'vs/platform/label/common/label'; import { renderCodiconsAsElement } from 'vs/base/browser/codicons'; import { ExtensionIdentifier, ExtensionType, IExtensionDescription } from 'vs/platform/extensions/common/extensions'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; +import { Schemas } from 'vs/base/common/network'; import { SlowExtensionAction } from 'vs/workbench/contrib/extensions/electron-browser/extensionsSlowActions'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IOpenerService } from 'vs/platform/opener/common/opener'; @@ -427,7 +427,7 @@ export class RuntimeExtensionsEditor extends EditorPane { const el = $('span', undefined, ...renderCodiconsAsElement(`$(remote) ${element.description.extensionLocation.authority}`)); data.msgContainer.appendChild(el); - const hostLabel = this._labelService.getHostLabel(REMOTE_HOST_SCHEME, this._environmentService.configuration.remoteAuthority); + const hostLabel = this._labelService.getHostLabel(Schemas.vscodeRemote, this._environmentService.configuration.remoteAuthority); if (hostLabel) { reset(el, ...renderCodiconsAsElement(`$(remote) ${hostLabel}`)); } diff --git a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts index 9cd9d45d85e50..9c99cf6ccafe0 100644 --- a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts +++ b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts @@ -40,7 +40,6 @@ import { ILabelService, IFormatterChangeEvent } from 'vs/platform/label/common/l import { ExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService'; import { IProductService } from 'vs/platform/product/common/productService'; import { Schemas } from 'vs/base/common/network'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IProgressService } from 'vs/platform/progress/common/progress'; import { ProgressService } from 'vs/workbench/services/progress/browser/progressService'; @@ -2527,7 +2526,7 @@ function aSingleRemoteExtensionManagementServerService(instantiationService: Tes remoteExtensionManagementServer, webExtensionManagementServer: null, getExtensionManagementServer: (extension: IExtension) => { - if (extension.location.scheme === REMOTE_HOST_SCHEME) { + if (extension.location.scheme === Schemas.vscodeRemote) { return remoteExtensionManagementServer; } return null; @@ -2555,7 +2554,7 @@ function aMultiExtensionManagementServerService(instantiationService: TestInstan if (extension.location.scheme === Schemas.file) { return localExtensionManagementServer; } - if (extension.location.scheme === REMOTE_HOST_SCHEME) { + if (extension.location.scheme === Schemas.vscodeRemote) { return remoteExtensionManagementServer; } throw new Error(''); diff --git a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsWorkbenchService.test.ts b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsWorkbenchService.test.ts index 15c3f1a024197..c14c5a662a4ee 100644 --- a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsWorkbenchService.test.ts +++ b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsWorkbenchService.test.ts @@ -46,7 +46,6 @@ import { IExperimentService } from 'vs/workbench/contrib/experiments/common/expe import { TestExperimentService } from 'vs/workbench/contrib/experiments/test/electron-browser/experimentService.test'; import { ExtensionTipsService } from 'vs/platform/extensionManagement/node/extensionTipsService'; import { Schemas } from 'vs/base/common/network'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; suite('ExtensionsWorkbenchServiceTest', () => { @@ -1431,7 +1430,7 @@ suite('ExtensionsWorkbenchServiceTest', () => { if (extension.location.scheme === Schemas.file) { return localExtensionManagementServer; } - if (extension.location.scheme === REMOTE_HOST_SCHEME) { + if (extension.location.scheme === Schemas.vscodeRemote) { return remoteExtensionManagementServer; } throw new Error(''); diff --git a/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts b/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts index 5bfbe8133ab30..114dd1d556e8d 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts @@ -19,7 +19,7 @@ import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/co import { ILabelService } from 'vs/platform/label/common/label'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { Registry } from 'vs/platform/registry/common/platform'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; +import { Schemas } from 'vs/base/common/network'; import { IWorkspaceContextService, IWorkspaceFolder, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { PICK_WORKSPACE_FOLDER_COMMAND_ID } from 'vs/workbench/browser/actions/workspaceCommands'; import { RemoteNameContext, WorkbenchStateContext } from 'vs/workbench/browser/contextkeys'; @@ -478,7 +478,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon this.extensionService.whenInstalledExtensionsRegistered() .then(() => { const remoteAuthority = this.environmentService.configuration.remoteAuthority; - const hostLabel = this.labelService.getHostLabel(REMOTE_HOST_SCHEME, remoteAuthority) || remoteAuthority; + const hostLabel = this.labelService.getHostLabel(Schemas.vscodeRemote, remoteAuthority) || remoteAuthority; const label = nls.localize('openRemoteSettings', "Open Remote Settings ({0})", hostLabel); registerAction2(class extends Action2 { constructor() { diff --git a/src/vs/workbench/contrib/preferences/browser/preferencesWidgets.ts b/src/vs/workbench/contrib/preferences/browser/preferencesWidgets.ts index 97c53d12e144e..1628b250301f9 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferencesWidgets.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferencesWidgets.ts @@ -25,7 +25,7 @@ import { IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ILabelService } from 'vs/platform/label/common/label'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; +import { Schemas } from 'vs/base/common/network'; import { activeContrastBorder, badgeBackground, badgeForeground, contrastBorder, focusBorder } from 'vs/platform/theme/common/colorRegistry'; import { attachInputBoxStyler, attachStylerCallback } from 'vs/platform/theme/common/styler'; import { ICssStyleCollector, IColorTheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; @@ -516,7 +516,7 @@ export class SettingsTargetsWidget extends Widget { }); const remoteAuthority = this.environmentService.configuration.remoteAuthority; - const hostLabel = remoteAuthority && this.labelService.getHostLabel(REMOTE_HOST_SCHEME, remoteAuthority); + const hostLabel = remoteAuthority && this.labelService.getHostLabel(Schemas.vscodeRemote, remoteAuthority); const remoteSettingsLabel = localize('userSettingsRemote', "Remote") + (hostLabel ? ` [${hostLabel}]` : ''); this.userRemoteSettings = new Action('userSettingsRemote', remoteSettingsLabel, '.settings-tab', true, () => this.updateTarget(ConfigurationTarget.USER_REMOTE)); diff --git a/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts b/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts index c6dfe890b386a..21ab4d7626856 100644 --- a/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts +++ b/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts @@ -14,7 +14,7 @@ import { StatusbarAlignment, IStatusbarService, IStatusbarEntryAccessor, IStatus import { ILabelService } from 'vs/platform/label/common/label'; import { IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { ICommandService } from 'vs/platform/commands/common/commands'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; +import { Schemas } from 'vs/base/common/network'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { IQuickInputService, IQuickPickItem, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; @@ -194,7 +194,7 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr // Remote Authority: show connection state else if (this.remoteAuthority) { - const hostLabel = this.labelService.getHostLabel(REMOTE_HOST_SCHEME, this.remoteAuthority) || this.remoteAuthority; + const hostLabel = this.labelService.getHostLabel(Schemas.vscodeRemote, this.remoteAuthority) || this.remoteAuthority; switch (this.connectionState) { case 'initializing': this.renderRemoteStatusIndicator(`$(sync~spin) ${nls.localize('host.open', "Opening Remote...")}`, nls.localize('host.open', "Opening Remote...")); diff --git a/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts b/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts index 52c5305bc2619..83baf2d6e70e2 100644 --- a/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts +++ b/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts @@ -14,7 +14,7 @@ import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { ILabelService } from 'vs/platform/label/common/label'; import { ICommandService } from 'vs/platform/commands/common/commands'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; +import { Schemas } from 'vs/base/common/network'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { ILogService } from 'vs/platform/log/common/log'; import { DownloadServiceChannel } from 'vs/platform/download/common/downloadIpc'; @@ -53,7 +53,7 @@ class RemoteAgentDiagnosticListener implements IWorkbenchContribution { ipcRenderer.on('vscode:getDiagnosticInfo', (event: unknown, request: { replyChannel: string, args: IDiagnosticInfoOptions }): void => { const connection = remoteAgentService.getConnection(); if (connection) { - const hostName = labelService.getHostLabel(REMOTE_HOST_SCHEME, connection.remoteAuthority); + const hostName = labelService.getHostLabel(Schemas.vscodeRemote, connection.remoteAuthority); remoteAgentService.getDiagnosticInfo(request.args) .then(info => { if (info) { diff --git a/src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.ts b/src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.ts index da6858a833e13..dd384908f5ff9 100644 --- a/src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.ts +++ b/src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.ts @@ -5,7 +5,6 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { Emitter, Event } from 'vs/base/common/event'; -import * as network from 'vs/base/common/network'; import { basename } from 'vs/base/common/path'; import { extname, isEqual, joinPath } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; @@ -24,7 +23,6 @@ import { Memento } from 'vs/workbench/common/memento'; import { SearchEditorFindMatchClass, SearchEditorScheme } from 'vs/workbench/contrib/searchEditor/browser/constants'; import { SearchEditorModel } from 'vs/workbench/contrib/searchEditor/browser/searchEditorModel'; import { defaultSearchConfig, extractSearchQueryFromModel, parseSavedSearchEditor, serializeSearchConfiguration } from 'vs/workbench/contrib/searchEditor/browser/searchEditorSerialization'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { AutoSaveMode, IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService'; import { IPathService } from 'vs/workbench/services/path/common/pathService'; import { ISearchConfigurationProperties } from 'vs/workbench/services/search/common/search'; @@ -82,7 +80,6 @@ export class SearchEditorInput extends EditorInput { private searchEditorModel: SearchEditorModel, @IModelService private readonly modelService: IModelService, @ITextFileService protected readonly textFileService: ITextFileService, - @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, @IFileDialogService private readonly fileDialogService: IFileDialogService, @IInstantiationService private readonly instantiationService: IInstantiationService, @IWorkingCopyService private readonly workingCopyService: IWorkingCopyService, @@ -277,10 +274,7 @@ export class SearchEditorInput extends EditorInput { const searchFileName = (query.replace(/[^\w \-_]+/g, '_') || 'Search') + SEARCH_EDITOR_EXT; - const remoteAuthority = this.environmentService.configuration.remoteAuthority; - const schemeFilter = remoteAuthority ? network.Schemas.vscodeRemote : network.Schemas.file; - - return joinPath(this.fileDialogService.defaultFilePath(schemeFilter) || (await this.pathService.userHome()), searchFileName); + return joinPath(this.fileDialogService.defaultFilePath(this.pathService.defaultUriScheme()) || (await this.pathService.userHome()), searchFileName); } } diff --git a/src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts b/src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts index 4d7892c992303..c3b990985fe78 100644 --- a/src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts +++ b/src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts @@ -14,7 +14,7 @@ import { ITextEditorSelection } from 'vs/platform/editor/common/editor'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IFileService } from 'vs/platform/files/common/files'; import type { Terminal, IViewportRange, ILinkProvider } from 'xterm'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; +import { Schemas } from 'vs/base/common/network'; import { posix, win32 } from 'vs/base/common/path'; import { ITerminalExternalLinkProvider, ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal'; import { OperatingSystem, isMacintosh, OS } from 'vs/base/common/platform'; @@ -296,7 +296,7 @@ export class TerminalLinkManager extends DisposableStore { let uri: URI; if (this._processManager.remoteAuthority) { uri = URI.from({ - scheme: REMOTE_HOST_SCHEME, + scheme: Schemas.vscodeRemote, authority: this._processManager.remoteAuthority, path: linkUrl }); diff --git a/src/vs/workbench/contrib/webview/browser/webviewElement.ts b/src/vs/workbench/contrib/webview/browser/webviewElement.ts index 0fca575f5894a..55078fbbd643c 100644 --- a/src/vs/workbench/contrib/webview/browser/webviewElement.ts +++ b/src/vs/workbench/contrib/webview/browser/webviewElement.ts @@ -12,7 +12,6 @@ import { IFileService } from 'vs/platform/files/common/files'; import { ILogService } from 'vs/platform/log/common/log'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; import { ITunnelService } from 'vs/platform/remote/common/tunnel'; import { IRequestService } from 'vs/platform/request/common/request'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; @@ -146,11 +145,11 @@ export class IFrameWebview extends BaseWebview implements Web // If we are loading a file resource from a remote extension, rewrite the uri to go remote let rewriteUri: undefined | ((uri: URI) => URI); - if (extensionLocation?.scheme === REMOTE_HOST_SCHEME) { + if (extensionLocation?.scheme === Schemas.vscodeRemote) { rewriteUri = (uri) => { - if (uri.scheme === Schemas.file && extensionLocation?.scheme === REMOTE_HOST_SCHEME) { + if (uri.scheme === Schemas.file && extensionLocation?.scheme === Schemas.vscodeRemote) { return URI.from({ - scheme: REMOTE_HOST_SCHEME, + scheme: Schemas.vscodeRemote, authority: extensionLocation.authority, path: '/vscode-resource', query: JSON.stringify({ diff --git a/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts b/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts index cbefdbce353bd..aca00dd322695 100644 --- a/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts +++ b/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts @@ -11,7 +11,6 @@ import { IQuickInputService, IQuickPickItem, IQuickPick } from 'vs/platform/quic import { URI } from 'vs/base/common/uri'; import { isWindows, OperatingSystem } from 'vs/base/common/platform'; import { ISaveDialogOptions, IOpenDialogOptions, IFileDialogService } from 'vs/platform/dialogs/common/dialogs'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; import { ILabelService } from 'vs/platform/label/common/label'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { INotificationService } from 'vs/platform/notification/common/notification'; @@ -109,7 +108,7 @@ export class SimpleFileDialog { private remoteAuthority: string | undefined; private requiresTrailing: boolean = false; private trailing: string | undefined; - protected scheme: string = REMOTE_HOST_SCHEME; + protected scheme: string = Schemas.vscodeRemote; private contextKey: IContextKey; private userEnteredPathSegment: string = ''; private autoCompletePathSegment: string = ''; diff --git a/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.ts b/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.ts index 2fa59ee92f48a..18824bb766e47 100644 --- a/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.ts +++ b/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.ts @@ -6,7 +6,7 @@ import { localize } from 'vs/nls'; import { IExtensionManagementServer, IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; +import { Schemas } from 'vs/base/common/network'; import { IChannel } from 'vs/base/parts/ipc/common/ipc'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { ILabelService } from 'vs/platform/label/common/label'; @@ -41,7 +41,7 @@ export class ExtensionManagementServerService implements IExtensionManagementSer this.remoteExtensionManagementServer = { id: 'remote', extensionManagementService, - get label() { return labelService.getHostLabel(REMOTE_HOST_SCHEME, remoteAgentConnection!.remoteAuthority) || localize('remote', "Remote"); } + get label() { return labelService.getHostLabel(Schemas.vscodeRemote, remoteAgentConnection!.remoteAuthority) || localize('remote', "Remote"); } }; } if (isWeb) { @@ -55,7 +55,7 @@ export class ExtensionManagementServerService implements IExtensionManagementSer } getExtensionManagementServer(extension: IExtension): IExtensionManagementServer { - if (extension.location.scheme === REMOTE_HOST_SCHEME) { + if (extension.location.scheme === Schemas.vscodeRemote) { return this.remoteExtensionManagementServer!; } if (this.webExtensionManagementServer) { diff --git a/src/vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService.ts b/src/vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService.ts index 98538abceb8a0..539792a97c675 100644 --- a/src/vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService.ts +++ b/src/vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService.ts @@ -8,7 +8,6 @@ import { Schemas } from 'vs/base/common/network'; import { IExtensionManagementServer, IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; import { ExtensionManagementChannelClient } from 'vs/platform/extensionManagement/common/extensionManagementIpc'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; import { IChannel } from 'vs/base/parts/ipc/common/ipc'; import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; @@ -47,7 +46,7 @@ export class ExtensionManagementServerService implements IExtensionManagementSer this.remoteExtensionManagementServer = { id: 'remote', extensionManagementService, - get label() { return labelService.getHostLabel(REMOTE_HOST_SCHEME, remoteAgentConnection!.remoteAuthority) || localize('remote', "Remote"); } + get label() { return labelService.getHostLabel(Schemas.vscodeRemote, remoteAgentConnection!.remoteAuthority) || localize('remote', "Remote"); } }; } } @@ -56,7 +55,7 @@ export class ExtensionManagementServerService implements IExtensionManagementSer if (extension.location.scheme === Schemas.file) { return this.localExtensionManagementServer; } - if (this.remoteExtensionManagementServer && extension.location.scheme === REMOTE_HOST_SCHEME) { + if (this.remoteExtensionManagementServer && extension.location.scheme === Schemas.vscodeRemote) { return this.remoteExtensionManagementServer; } throw new Error(`Invalid Extension ${extension.location}`); diff --git a/src/vs/workbench/services/extensionManagement/test/browser/extensionEnablementService.test.ts b/src/vs/workbench/services/extensionManagement/test/browser/extensionEnablementService.test.ts index 02ddb58cf37ee..07fc68a91a65b 100644 --- a/src/vs/workbench/services/extensionManagement/test/browser/extensionEnablementService.test.ts +++ b/src/vs/workbench/services/extensionManagement/test/browser/extensionEnablementService.test.ts @@ -18,7 +18,6 @@ import { areSameExtensions } from 'vs/platform/extensionManagement/common/extens import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { URI } from 'vs/base/common/uri'; import { Schemas } from 'vs/base/common/network'; -import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; import { productService } from 'vs/workbench/test/browser/workbenchTestServices'; import { GlobalExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionEnablementService'; @@ -593,7 +592,7 @@ function anExtensionManagementServerService(localExtensionManagementServer: IExt if (extension.location.scheme === Schemas.file) { return localExtensionManagementServer; } - if (extension.location.scheme === REMOTE_HOST_SCHEME) { + if (extension.location.scheme === Schemas.vscodeRemote) { return remoteExtensionManagementServer; } return webExtensionManagementServer; diff --git a/src/vs/workbench/services/history/browser/history.ts b/src/vs/workbench/services/history/browser/history.ts index 370837ef71c14..9442efba37515 100644 --- a/src/vs/workbench/services/history/browser/history.ts +++ b/src/vs/workbench/services/history/browser/history.ts @@ -35,6 +35,7 @@ import { onUnexpectedError } from 'vs/base/common/errors'; import { extUri } from 'vs/base/common/resources'; import { IdleValue } from 'vs/base/common/async'; import { ResourceGlobMatcher } from 'vs/workbench/common/resources'; +import { IPathService } from 'vs/workbench/services/path/common/pathService'; /** * Stores the selection & view state of an editor and allows to compare it to other selection states. @@ -117,7 +118,8 @@ export class HistoryService extends Disposable implements IHistoryService { @IWorkspacesService private readonly workspacesService: IWorkspacesService, @IInstantiationService private readonly instantiationService: IInstantiationService, @IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService, - @IContextKeyService private readonly contextKeyService: IContextKeyService + @IContextKeyService private readonly contextKeyService: IContextKeyService, + @IPathService private readonly pathService: IPathService ) { super(); @@ -514,7 +516,7 @@ export class HistoryService extends Disposable implements IHistoryService { private preferResourceEditorInput(input: IEditorInput): IEditorInput | IResourceEditorInput { const resource = input.resource; - if (resource && (resource.scheme === Schemas.file || resource.scheme === Schemas.vscodeRemote || resource.scheme === Schemas.userData)) { + if (resource && (resource.scheme === Schemas.file || resource.scheme === Schemas.vscodeRemote || resource.scheme === Schemas.userData || resource.scheme === this.pathService.defaultUriScheme())) { // for now, only prefer well known schemes that we control to prevent // issues such as https://github.com/microsoft/vscode/issues/85204 return { resource };