diff --git a/src/vs/workbench/api/browser/mainThreadCustomEditors.ts b/src/vs/workbench/api/browser/mainThreadCustomEditors.ts index 28727226932..04aab60a1ad 100644 --- a/src/vs/workbench/api/browser/mainThreadCustomEditors.ts +++ b/src/vs/workbench/api/browser/mainThreadCustomEditors.ts @@ -538,7 +538,7 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod throw new Error('Resource is not untitled'); } - const remoteAuthority = this._environmentService.configuration.remoteAuthority; + const remoteAuthority = this._environmentService.remoteAuthority; const localResource = toLocalResource(this._editorResource, remoteAuthority, this._pathService.defaultUriScheme); return this._fileDialogService.pickFileToSave(localResource, options?.availableFileSystems); diff --git a/src/vs/workbench/api/browser/mainThreadDocuments.ts b/src/vs/workbench/api/browser/mainThreadDocuments.ts index 76751ed19ff..abdd99cd816 100644 --- a/src/vs/workbench/api/browser/mainThreadDocuments.ts +++ b/src/vs/workbench/api/browser/mainThreadDocuments.ts @@ -273,7 +273,7 @@ export class MainThreadDocuments extends Disposable implements MainThreadDocumen } private _handleUntitledScheme(uri: URI): Promise { - const asLocalUri = toLocalResource(uri, this._environmentService.configuration.remoteAuthority, this._pathService.defaultUriScheme); + const asLocalUri = toLocalResource(uri, this._environmentService.remoteAuthority, this._pathService.defaultUriScheme); return this._fileService.resolve(asLocalUri).then(stats => { // don't create a new file ontop of an existing file return Promise.reject(new Error('file already exists')); diff --git a/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.ts b/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.ts index bf40ca23528..a7a5fb056ca 100644 --- a/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.ts +++ b/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.ts @@ -22,7 +22,7 @@ export class MainThreadRemoteConnectionData extends Disposable { super(); this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostExtensionService); - const remoteAuthority = this._environmentService.configuration.remoteAuthority; + const remoteAuthority = this._environmentService.remoteAuthority; if (remoteAuthority) { this._register(remoteAuthorityResolverService.onDidChangeConnectionData(() => { const connectionData = remoteAuthorityResolverService.getConnectionData(remoteAuthority); diff --git a/src/vs/workbench/browser/actions/workspaceActions.ts b/src/vs/workbench/browser/actions/workspaceActions.ts index 90c99b2a858..700fb6ce0b3 100644 --- a/src/vs/workbench/browser/actions/workspaceActions.ts +++ b/src/vs/workbench/browser/actions/workspaceActions.ts @@ -118,7 +118,7 @@ export class CloseWorkspaceAction extends Action { return; } - return this.hostService.openWindow({ forceReuseWindow: true, remoteAuthority: this.environmentService.configuration.remoteAuthority }); + return this.hostService.openWindow({ forceReuseWindow: true, remoteAuthority: this.environmentService.remoteAuthority }); } } @@ -241,7 +241,7 @@ export class DuplicateWorkspaceInNewWindowAction extends Action { async run(): Promise { const folders = this.workspaceContextService.getWorkspace().folders; - const remoteAuthority = this.environmentService.configuration.remoteAuthority; + const remoteAuthority = this.environmentService.remoteAuthority; const newWorkspace = await this.workspacesService.createUntitledWorkspace(folders, remoteAuthority); await this.workspaceEditingService.copyWorkspaceSettings(newWorkspace); diff --git a/src/vs/workbench/browser/contextkeys.ts b/src/vs/workbench/browser/contextkeys.ts index 6fa3ae394c5..1e9fb3756bb 100644 --- a/src/vs/workbench/browser/contextkeys.ts +++ b/src/vs/workbench/browser/contextkeys.ts @@ -83,7 +83,7 @@ export class WorkbenchContextKeysHandler extends Disposable { IsWebContext.bindTo(this.contextKeyService); IsMacNativeContext.bindTo(this.contextKeyService); - RemoteNameContext.bindTo(this.contextKeyService).set(getRemoteName(this.environmentService.configuration.remoteAuthority) || ''); + RemoteNameContext.bindTo(this.contextKeyService).set(getRemoteName(this.environmentService.remoteAuthority) || ''); // Development IsDevelopmentContext.bindTo(this.contextKeyService).set(!this.environmentService.isBuilt || this.environmentService.isExtensionDevelopment); @@ -119,7 +119,7 @@ export class WorkbenchContextKeysHandler extends Disposable { // system to operate with. We always have one when running natively or when // we have a remote connection. this.emptyWorkspaceSupportContext = EmptyWorkspaceSupportContext.bindTo(this.contextKeyService); - this.emptyWorkspaceSupportContext.set(isNative || typeof this.environmentService.configuration.remoteAuthority === 'string'); + this.emptyWorkspaceSupportContext.set(isNative || typeof this.environmentService.remoteAuthority === 'string'); // Editor Layout this.splitEditorsVerticallyContext = SplitEditorsVertically.bindTo(this.contextKeyService); diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts index 7e705974a02..3c687be52e0 100644 --- a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts +++ b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts @@ -134,7 +134,7 @@ export class ActivitybarPart extends Part implements IActivityBarService { this.migrateFromOldCachedViewContainersValue(); for (const cachedViewContainer of this.cachedViewContainers) { - if (environmentService.configuration.remoteAuthority // In remote window, hide activity bar entries until registered. + if (environmentService.remoteAuthority // In remote window, hide activity bar entries until registered. || this.shouldBeHidden(cachedViewContainer.id, cachedViewContainer) ) { cachedViewContainer.visible = false; diff --git a/src/vs/workbench/browser/parts/editor/binaryEditor.ts b/src/vs/workbench/browser/parts/editor/binaryEditor.ts index bed01dd0687..e9bbf8c7ce0 100644 --- a/src/vs/workbench/browser/parts/editor/binaryEditor.ts +++ b/src/vs/workbench/browser/parts/editor/binaryEditor.ts @@ -96,7 +96,7 @@ export abstract class BaseBinaryResourceEditor extends EditorPane { const [binaryContainer, scrollbar] = assertAllDefined(this.binaryContainer, this.scrollbar); this.resourceViewerContext = ResourceViewer.show({ name: model.getName(), resource: model.resource, size: model.getSize(), etag: model.getETag(), mime: model.getMime() }, binaryContainer, scrollbar, { openInternalClb: () => this.handleOpenInternalCallback(input, options), - openExternalClb: this.environmentService.configuration.remoteAuthority ? undefined : resource => this.callbacks.openExternal(resource), + openExternalClb: this.environmentService.remoteAuthority ? undefined : resource => this.callbacks.openExternal(resource), metadataClb: meta => this.handleMetadataChanged(meta) }); } diff --git a/src/vs/workbench/browser/parts/editor/editor.contribution.ts b/src/vs/workbench/browser/parts/editor/editor.contribution.ts index 1ad2ecab59c..e7c3828cc51 100644 --- a/src/vs/workbench/browser/parts/editor/editor.contribution.ts +++ b/src/vs/workbench/browser/parts/editor/editor.contribution.ts @@ -132,7 +132,7 @@ class UntitledTextEditorInputFactory implements IEditorInputFactory { let resource = untitledTextEditorInput.resource; if (untitledTextEditorInput.model.hasAssociatedFilePath) { - resource = toLocalResource(resource, this.environmentService.configuration.remoteAuthority, this.pathService.defaultUriScheme); // untitled with associated file path use the local schema + resource = toLocalResource(resource, this.environmentService.remoteAuthority, this.pathService.defaultUriScheme); // untitled with associated file path use the local schema } // Mode: only remember mode if it is either specific (not text) diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index ae703ce851c..95086b6f0c8 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -281,14 +281,12 @@ export class CustomMenubarControl extends MenubarControl { @IStorageService storageService: IStorageService, @INotificationService notificationService: INotificationService, @IPreferencesService preferencesService: IPreferencesService, - @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, + @IWorkbenchEnvironmentService protected readonly environmentService: IWorkbenchEnvironmentService, @IAccessibilityService accessibilityService: IAccessibilityService, @IThemeService private readonly themeService: IThemeService, @IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService, - @IHostService protected readonly hostService: IHostService, - @IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService + @IHostService protected readonly hostService: IHostService ) { - super( menuService, workspacesService, @@ -451,7 +449,7 @@ export class CustomMenubarControl extends MenubarControl { case StateType.Idle: return new Action('update.check', nls.localize({ key: 'checkForUpdates', comment: ['&& denotes a mnemonic'] }, "Check for &&Updates..."), undefined, true, () => - this.updateService.checkForUpdates(this.workbenchEnvironmentService.configuration.sessionId)); + this.updateService.checkForUpdates(this.environmentService.configuration.sessionId)); case StateType.CheckingForUpdates: return new Action('update.checking', nls.localize('checkingForUpdates', "Checking for Updates..."), undefined, false); diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts index efa39ead6e8..ddb8f2fd842 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts @@ -288,7 +288,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(Schemas.vscodeRemote, this.environmentService.configuration.remoteAuthority); + const remoteName = this.labelService.getHostLabel(Schemas.vscodeRemote, this.environmentService.remoteAuthority); const separator = this.configurationService.getValue('window.titleSeparator'); const titleTemplate = this.configurationService.getValue('window.title'); diff --git a/src/vs/workbench/contrib/backup/common/backupRestorer.ts b/src/vs/workbench/contrib/backup/common/backupRestorer.ts index 4c0413477c2..c32a30eeca2 100644 --- a/src/vs/workbench/contrib/backup/common/backupRestorer.ts +++ b/src/vs/workbench/contrib/backup/common/backupRestorer.ts @@ -99,7 +99,7 @@ export class BackupRestorer implements IWorkbenchContribution { // an associated file path or not by just looking at the path. and // if so, we must ensure to restore the local resource it had. if (resource.scheme === Schemas.untitled && !BackupRestorer.UNTITLED_REGEX.test(resource.path)) { - return { resource: toLocalResource(resource, this.environmentService.configuration.remoteAuthority, this.pathService.defaultUriScheme), options, forceUntitled: true }; + return { resource: toLocalResource(resource, this.environmentService.remoteAuthority, this.pathService.defaultUriScheme), options, forceUntitled: true }; } // handle custom editors by asking the custom editor input factory diff --git a/src/vs/workbench/contrib/debug/browser/linkDetector.ts b/src/vs/workbench/contrib/debug/browser/linkDetector.ts index 5942579f77b..e927b779bb4 100644 --- a/src/vs/workbench/contrib/debug/browser/linkDetector.ts +++ b/src/vs/workbench/contrib/debug/browser/linkDetector.ts @@ -39,7 +39,7 @@ export class LinkDetector { @IFileService private readonly fileService: IFileService, @IOpenerService private readonly openerService: IOpenerService, @IPathService private readonly pathService: IPathService, - @IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService + @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService ) { // noop } @@ -98,7 +98,7 @@ export class LinkDetector { private createWebLink(url: string): Node { const link = this.createLink(url); const uri = URI.parse(url); - this.decorateLink(link, () => this.openerService.open(uri, { allowTunneling: !!this.workbenchEnvironmentService.configuration.remoteAuthority })); + this.decorateLink(link, () => this.openerService.open(uri, { allowTunneling: !!this.environmentService.remoteAuthority })); return link; } diff --git a/src/vs/workbench/contrib/debug/node/debugHelperService.ts b/src/vs/workbench/contrib/debug/node/debugHelperService.ts index a7bed36cf61..a7929124043 100644 --- a/src/vs/workbench/contrib/debug/node/debugHelperService.ts +++ b/src/vs/workbench/contrib/debug/node/debugHelperService.ts @@ -42,7 +42,7 @@ export class NodeDebugHelperService implements IDebugHelperService { return new TelemetryService({ appender, - sendErrorTelemetry: cleanRemoteAuthority(this.environmentService.configuration.remoteAuthority) !== 'other' + sendErrorTelemetry: cleanRemoteAuthority(this.environmentService.remoteAuthority) !== 'other' }, configurationService); } } diff --git a/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts b/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts index 1ce0f3a7aaa..b72a62a2d7b 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts @@ -428,7 +428,7 @@ export class RuntimeExtensionsEditor extends EditorPane { const el = $('span', undefined, ...renderCodicons(`$(remote) ${element.description.extensionLocation.authority}`)); data.msgContainer.appendChild(el); - const hostLabel = this._labelService.getHostLabel(Schemas.vscodeRemote, this._environmentService.configuration.remoteAuthority); + const hostLabel = this._labelService.getHostLabel(Schemas.vscodeRemote, this._environmentService.remoteAuthority); if (hostLabel) { reset(el, ...renderCodicons(`$(remote) ${hostLabel}`)); } diff --git a/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts b/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts index 6c013fb1efc..0e1aaa73bfd 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts @@ -480,7 +480,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon this.extensionService.whenInstalledExtensionsRegistered() .then(() => { - const remoteAuthority = this.environmentService.configuration.remoteAuthority; + const remoteAuthority = this.environmentService.remoteAuthority; const hostLabel = this.labelService.getHostLabel(Schemas.vscodeRemote, remoteAuthority) || remoteAuthority; const label = nls.localize('openRemoteSettings', "Open Remote Settings ({0})", hostLabel); registerAction2(class extends Action2 { diff --git a/src/vs/workbench/contrib/preferences/browser/preferencesRenderers.ts b/src/vs/workbench/contrib/preferences/browser/preferencesRenderers.ts index 11b57be4178..b13338f9960 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferencesRenderers.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferencesRenderers.ts @@ -954,7 +954,7 @@ class UnsupportedSettingsRenderer extends Disposable { private editor: ICodeEditor, private settingsEditorModel: SettingsEditorModel, @IMarkerService private markerService: IMarkerService, - @IWorkbenchEnvironmentService private workbenchEnvironmentService: IWorkbenchEnvironmentService, + @IWorkbenchEnvironmentService private environmentService: IWorkbenchEnvironmentService, @IConfigurationService private configurationService: IConfigurationService, ) { super(); @@ -1012,7 +1012,7 @@ class UnsupportedSettingsRenderer extends Disposable { } private handleLocalUserConfiguration(setting: ISetting, configuration: IConfigurationNode, markerData: IMarkerData[]): void { - if (this.workbenchEnvironmentService.configuration.remoteAuthority && (configuration.scope === ConfigurationScope.MACHINE || configuration.scope === ConfigurationScope.MACHINE_OVERRIDABLE)) { + if (this.environmentService.remoteAuthority && (configuration.scope === ConfigurationScope.MACHINE || configuration.scope === ConfigurationScope.MACHINE_OVERRIDABLE)) { markerData.push({ severity: MarkerSeverity.Hint, tags: [MarkerTag.Unnecessary], diff --git a/src/vs/workbench/contrib/preferences/browser/preferencesWidgets.ts b/src/vs/workbench/contrib/preferences/browser/preferencesWidgets.ts index 1628b250301..a736bea3081 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferencesWidgets.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferencesWidgets.ts @@ -515,7 +515,7 @@ export class SettingsTargetsWidget extends Widget { this.userLocalSettings.tooltip = uri?.fsPath || ''; }); - const remoteAuthority = this.environmentService.configuration.remoteAuthority; + const remoteAuthority = this.environmentService.remoteAuthority; const hostLabel = remoteAuthority && this.labelService.getHostLabel(Schemas.vscodeRemote, remoteAuthority); const remoteSettingsLabel = localize('userSettingsRemote', "Remote") + (hostLabel ? ` [${hostLabel}]` : ''); @@ -596,7 +596,7 @@ export class SettingsTargetsWidget extends Widget { private async update(): Promise { this.settingsSwitcherBar.domNode.classList.toggle('empty-workbench', this.contextService.getWorkbenchState() === WorkbenchState.EMPTY); - this.userRemoteSettings.enabled = !!(this.options.enableRemoteSettings && this.environmentService.configuration.remoteAuthority); + this.userRemoteSettings.enabled = !!(this.options.enableRemoteSettings && this.environmentService.remoteAuthority); this.workspaceSettings.enabled = this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY; this.folderSettings.getAction().enabled = this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE && this.contextService.getWorkspace().folders.length > 0; diff --git a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts index 0174be3416c..e5eb4697ce9 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts @@ -1706,7 +1706,7 @@ export class SettingsTreeFilter implements ITreeFilter { // Non-user scope selected if (element instanceof SettingsTreeSettingElement && this.viewState.settingsTarget !== ConfigurationTarget.USER_LOCAL) { - const isRemote = !!this.environmentService.configuration.remoteAuthority; + const isRemote = !!this.environmentService.remoteAuthority; if (!element.matchesScope(this.viewState.settingsTarget, isRemote)) { return false; } diff --git a/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts b/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts index 7718a6f8b55..12a988e5543 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts @@ -607,7 +607,7 @@ export class SearchResultModel extends SettingsTreeModel { }); // Save time, filter children in the search model instead of relying on the tree filter, which still requires heights to be calculated. - const isRemote = !!this.environmentService.configuration.remoteAuthority; + const isRemote = !!this.environmentService.remoteAuthority; this.root.children = this.root.children .filter(child => child instanceof SettingsTreeSettingElement && child.matchesAllTags(this._viewState.tagFilters) && child.matchesScope(this._viewState.settingsTarget, isRemote) && child.matchesAnyExtension(this._viewState.extensionFilters)); diff --git a/src/vs/workbench/contrib/preferences/browser/tocTree.ts b/src/vs/workbench/contrib/preferences/browser/tocTree.ts index 4c6b8673ced..2078f7824c1 100644 --- a/src/vs/workbench/contrib/preferences/browser/tocTree.ts +++ b/src/vs/workbench/contrib/preferences/browser/tocTree.ts @@ -89,7 +89,7 @@ export class TOCTreeModel { } // Check everything that the SettingsFilter checks except whether it's filtered by a category - const isRemote = !!this.environmentService.configuration.remoteAuthority; + const isRemote = !!this.environmentService.remoteAuthority; return child.matchesScope(this._viewState.settingsTarget, isRemote) && child.matchesAllTags(this._viewState.tagFilters) && child.matchesAnyExtension(this._viewState.extensionFilters); }).length; } diff --git a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts index 29a125e206f..4c0cd2c2370 100644 --- a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts +++ b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts @@ -146,7 +146,7 @@ export class WorkspaceChangeExtHostRelauncher extends Disposable implements IWor return; // no restart when in tests: see https://github.com/microsoft/vscode/issues/66936 } - if (environmentService.configuration.remoteAuthority) { + if (environmentService.remoteAuthority) { hostService.reload(); // TODO@aeschli, workaround } else if (isNative) { extensionService.restartExtensionHost(); diff --git a/src/vs/workbench/contrib/remote/browser/explorerViewItems.ts b/src/vs/workbench/contrib/remote/browser/explorerViewItems.ts index 7f48fe3ed20..99604f4fa31 100644 --- a/src/vs/workbench/contrib/remote/browser/explorerViewItems.ts +++ b/src/vs/workbench/contrib/remote/browser/explorerViewItems.ts @@ -41,7 +41,7 @@ export class SwitchRemoteViewItem extends SelectActionViewItem { private setSelectionForConnection(optionsItems: IRemoteSelectItem[], environmentService: IWorkbenchEnvironmentService, remoteExplorerService: IRemoteExplorerService) { if (this.optionsItems.length > 0) { let index = 0; - const remoteAuthority = environmentService.configuration.remoteAuthority; + const remoteAuthority = environmentService.remoteAuthority; const explorerType: string[] | undefined = remoteAuthority ? [remoteAuthority.split('+')[0]] : this.storageService.get(REMOTE_EXPLORER_TYPE_KEY, StorageScope.WORKSPACE)?.split(',') ?? this.storageService.get(REMOTE_EXPLORER_TYPE_KEY, StorageScope.GLOBAL)?.split(','); if (explorerType !== undefined) { diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts index 98573a206f1..37ae21c47ac 100644 --- a/src/vs/workbench/contrib/remote/browser/remote.ts +++ b/src/vs/workbench/contrib/remote/browser/remote.ts @@ -313,7 +313,7 @@ abstract class HelpItemBase implements IHelpItem { } async handleClick() { - const remoteAuthority = this.environmentService.configuration.remoteAuthority; + const remoteAuthority = this.environmentService.remoteAuthority; if (remoteAuthority) { for (let i = 0; i < this.remoteExplorerService.targetType.length; i++) { if (remoteAuthority.startsWith(this.remoteExplorerService.targetType[i])) { @@ -407,7 +407,7 @@ class HelpPanel extends ViewPane { @IQuickInputService protected quickInputService: IQuickInputService, @ICommandService protected commandService: ICommandService, @IRemoteExplorerService protected readonly remoteExplorerService: IRemoteExplorerService, - @IWorkbenchEnvironmentService protected readonly workbenchEnvironmentService: IWorkbenchEnvironmentService, + @IWorkbenchEnvironmentService protected readonly environmentService: IWorkbenchEnvironmentService, @IThemeService themeService: IThemeService, @ITelemetryService telemetryService: ITelemetryService, ) { @@ -438,7 +438,7 @@ class HelpPanel extends ViewPane { } ); - const model = new HelpModel(this.viewModel, this.openerService, this.quickInputService, this.commandService, this.remoteExplorerService, this.workbenchEnvironmentService); + const model = new HelpModel(this.viewModel, this.openerService, this.quickInputService, this.commandService, this.remoteExplorerService, this.environmentService); this.tree.setInput(model); @@ -560,7 +560,7 @@ export class RemoteViewPaneContainer extends FilterViewPaneContainer implements const panels: ViewPane[] = super.onDidAddViewDescriptors(added); // This context key is set to false in the constructor, but is expected to be changed by resolver extensions to enable the forwarded ports view. const viewEnabled: boolean = !!forwardedPortsViewEnabled.getValue(this.contextKeyService); - if (this.environmentService.configuration.remoteAuthority && !this.tunnelPanelDescriptor && viewEnabled) { + if (this.environmentService.remoteAuthority && !this.tunnelPanelDescriptor && viewEnabled) { this.tunnelPanelDescriptor = new TunnelPanelDescriptor(new TunnelViewModel(this.remoteExplorerService), this.environmentService); const viewsRegistry = Registry.as(Extensions.ViewsRegistry); viewsRegistry.registerViews([this.tunnelPanelDescriptor!], this.viewContainer); @@ -853,7 +853,7 @@ class AutomaticPortForwarding extends Disposable implements IWorkbenchContributi @IContextKeyService private readonly contextKeyService: IContextKeyService ) { super(); - if (this.environmentService.configuration.remoteAuthority) { + if (this.environmentService.remoteAuthority) { this.startUrlFinder(); } else { this.contextServiceListener = this._register(this.contextKeyService.onDidChangeContext(e => { @@ -890,7 +890,7 @@ class AutomaticPortForwarding extends Disposable implements IWorkbenchContributi const showChoice: IPromptChoice = { label: nls.localize('remote.tunnelsView.showView', "Show Forwarded Ports"), run: () => { - const remoteAuthority = this.environmentService.configuration.remoteAuthority; + const remoteAuthority = this.environmentService.remoteAuthority; const explorerType: string[] | undefined = remoteAuthority ? [remoteAuthority.split('+')[0]] : undefined; if (explorerType) { this.remoteExplorerService.targetType = explorerType; diff --git a/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts b/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts index 21ab4d76268..8a1a986c824 100644 --- a/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts +++ b/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts @@ -35,7 +35,7 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr private remoteMenu = this._register(this.menuService.createMenu(MenuId.StatusBarWindowIndicatorMenu, this.contextKeyService)); private hasRemoteActions = false; - private remoteAuthority = this.environmentService.configuration.remoteAuthority; + private remoteAuthority = this.environmentService.remoteAuthority; private connectionState: 'initializing' | 'connected' | 'disconnected' | undefined = undefined; private connectionStateContextKey = new RawContextKey<'' | 'initializing' | 'disconnected' | 'connected'>('remoteConnectionState', '').bindTo(this.contextKeyService); diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index 69ecde88963..809ea341f1b 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -672,7 +672,7 @@ export class TunnelPanelDescriptor implements IViewDescriptor { constructor(viewModel: ITunnelViewModel, environmentService: IWorkbenchEnvironmentService) { this.ctorDescriptor = new SyncDescriptor(TunnelPanel, [viewModel]); - this.remoteAuthority = environmentService.configuration.remoteAuthority ? environmentService.configuration.remoteAuthority.split('+')[0] : undefined; + this.remoteAuthority = environmentService.remoteAuthority ? environmentService.remoteAuthority.split('+')[0] : undefined; } } diff --git a/src/vs/workbench/contrib/remote/common/showCandidate.ts b/src/vs/workbench/contrib/remote/common/showCandidate.ts index 6fa5f01943c..c8283e27aa7 100644 --- a/src/vs/workbench/contrib/remote/common/showCandidate.ts +++ b/src/vs/workbench/contrib/remote/common/showCandidate.ts @@ -11,10 +11,10 @@ import { IRemoteExplorerService } from 'vs/workbench/services/remote/common/remo export class ShowCandidateContribution extends Disposable implements IWorkbenchContribution { constructor( @IRemoteExplorerService remoteExplorerService: IRemoteExplorerService, - @IWorkbenchEnvironmentService workbenchEnvironmentService: IWorkbenchEnvironmentService, + @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, ) { super(); - const showPortCandidate = workbenchEnvironmentService.options?.tunnelProvider?.showPortCandidate; + const showPortCandidate = environmentService.options?.tunnelProvider?.showPortCandidate; if (showPortCandidate) { this._register(remoteExplorerService.setCandidateFilter(async (candidates: { host: string, port: number, detail: string }[]): Promise<{ host: string, port: number, detail: string }[]> => { const filters: boolean[] = await Promise.all(candidates.map(candidate => showPortCandidate(candidate.host, candidate.port, candidate.detail))); diff --git a/src/vs/workbench/contrib/remote/common/tunnelFactory.ts b/src/vs/workbench/contrib/remote/common/tunnelFactory.ts index 2562cb661fe..ab8c80e679b 100644 --- a/src/vs/workbench/contrib/remote/common/tunnelFactory.ts +++ b/src/vs/workbench/contrib/remote/common/tunnelFactory.ts @@ -11,10 +11,10 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/ export class TunnelFactoryContribution extends Disposable implements IWorkbenchContribution { constructor( @ITunnelService tunnelService: ITunnelService, - @IWorkbenchEnvironmentService workbenchEnvironmentService: IWorkbenchEnvironmentService, + @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, ) { super(); - const tunnelFactory = workbenchEnvironmentService.options?.tunnelProvider?.tunnelFactory; + const tunnelFactory = environmentService.options?.tunnelProvider?.tunnelFactory; if (tunnelFactory) { this._register(tunnelService.setTunnelProvider({ forwardPort: (tunnelOptions: TunnelOptions): Promise | undefined => { diff --git a/src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts b/src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts index 83bc8ce9fe5..4ada8402619 100644 --- a/src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts +++ b/src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts @@ -663,7 +663,7 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider { - const uri: URI = resources.toLocalResource(URI.from({ scheme: Schemas.file, path: path }), this.environmentService.configuration.remoteAuthority, this.pathService.defaultUriScheme); + const uri: URI = resources.toLocalResource(URI.from({ scheme: Schemas.file, path: path }), this.environmentService.remoteAuthority, this.pathService.defaultUriScheme); if (await this.fileService.exists(uri)) { return !((await this.fileService.resolve(uri)).isDirectory); } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts b/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts index 9d4efdec9d8..5170e94ec68 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts @@ -136,7 +136,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce if (shellLaunchConfig.cwd && typeof shellLaunchConfig.cwd === 'object') { this.remoteAuthority = getRemoteAuthority(shellLaunchConfig.cwd); } else { - this.remoteAuthority = this._environmentService.configuration.remoteAuthority; + this.remoteAuthority = this._environmentService.remoteAuthority; } const hasRemoteAuthority = !!this.remoteAuthority; let launchRemotely = hasRemoteAuthority || forceExtHostProcess; diff --git a/src/vs/workbench/contrib/update/browser/update.ts b/src/vs/workbench/contrib/update/browser/update.ts index 0fb62d6e25a..8a140af98ff 100644 --- a/src/vs/workbench/contrib/update/browser/update.ts +++ b/src/vs/workbench/contrib/update/browser/update.ts @@ -536,14 +536,14 @@ export class CheckForVSCodeUpdateAction extends Action { constructor( id: string, label: string, - @IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService, + @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, @IUpdateService private readonly updateService: IUpdateService, ) { super(id, label, undefined, true); } run(): Promise { - return this.updateService.checkForUpdates(this.workbenchEnvironmentService.configuration.sessionId); + return this.updateService.checkForUpdates(this.environmentService.configuration.sessionId); } } diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts index 40a58246485..440e030ae24 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts @@ -104,7 +104,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo @IActivityService private readonly activityService: IActivityService, @INotificationService private readonly notificationService: INotificationService, @IEditorService private readonly editorService: IEditorService, - @IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService, + @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, @IDialogService private readonly dialogService: IDialogService, @IQuickInputService private readonly quickInputService: IQuickInputService, @IInstantiationService private readonly instantiationService: IInstantiationService, @@ -373,7 +373,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo if (source !== SyncResource.Settings && source !== SyncResource.Keybindings) { return; } - const resource = source === SyncResource.Settings ? this.workbenchEnvironmentService.settingsResource : this.workbenchEnvironmentService.keybindingsResource; + const resource = source === SyncResource.Settings ? this.environmentService.settingsResource : this.environmentService.keybindingsResource; if (isEqual(resource, EditorResourceAccessor.getCanonicalUri(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY }))) { // Do not show notification if the file in error is active return; @@ -631,14 +631,14 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo private getConflictsEditorInputs(syncResource: SyncResource): DiffEditorInput[] { return this.editorService.editors.filter(input => { const resource = input instanceof DiffEditorInput ? input.primary.resource : input.resource; - return resource && getSyncResourceFromLocalPreview(resource!, this.workbenchEnvironmentService) === syncResource; + return resource && getSyncResourceFromLocalPreview(resource!, this.environmentService) === syncResource; }) as DiffEditorInput[]; } private getAllConflictsEditorInputs(): IEditorInput[] { return this.editorService.editors.filter(input => { const resource = input instanceof DiffEditorInput ? input.primary.resource : input.resource; - return resource && getSyncResourceFromLocalPreview(resource!, this.workbenchEnvironmentService) !== undefined; + return resource && getSyncResourceFromLocalPreview(resource!, this.environmentService) !== undefined; }); } diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger.ts index 9cb6e200cd3..a668fc7bee5 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger.ts @@ -21,7 +21,7 @@ export class UserDataSyncTrigger extends Disposable implements IWorkbenchContrib constructor( @IEditorService editorService: IEditorService, - @IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService, + @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, @IViewsService viewsService: IViewsService, @IUserDataAutoSyncService userDataAutoSyncService: IUserDataAutoSyncService, @IHostService hostService: IHostService, @@ -58,10 +58,10 @@ export class UserDataSyncTrigger extends Disposable implements IWorkbenchContrib return 'keybindingsEditor'; } const resource = editorInput.resource; - if (isEqual(resource, this.workbenchEnvironmentService.settingsResource)) { + if (isEqual(resource, this.environmentService.settingsResource)) { return 'settingsEditor'; } - if (isEqual(resource, this.workbenchEnvironmentService.keybindingsResource)) { + if (isEqual(resource, this.environmentService.keybindingsResource)) { return 'keybindingsEditor'; } return undefined; diff --git a/src/vs/workbench/contrib/webview/browser/webviewElement.ts b/src/vs/workbench/contrib/webview/browser/webviewElement.ts index 55078fbbd64..c24df8a7a27 100644 --- a/src/vs/workbench/contrib/webview/browser/webviewElement.ts +++ b/src/vs/workbench/contrib/webview/browser/webviewElement.ts @@ -139,7 +139,7 @@ export class IFrameWebview extends BaseWebview implements Web private async loadResource(requestPath: string, uri: URI) { try { - const remoteAuthority = this.environmentService.configuration.remoteAuthority; + const remoteAuthority = this.environmentService.remoteAuthority; const remoteConnectionData = remoteAuthority ? this._remoteAuthorityResolverService.getConnectionData(remoteAuthority) : null; const extensionLocation = this.extension?.location; @@ -190,7 +190,7 @@ export class IFrameWebview extends BaseWebview implements Web } private async localLocalhost(origin: string) { - const authority = this.environmentService.configuration.remoteAuthority; + const authority = this.environmentService.remoteAuthority; const resolveAuthority = authority ? await this._remoteAuthorityResolverService.resolveAuthority(authority) : undefined; const redirect = resolveAuthority ? await this._portMappingManager.getRedirect(resolveAuthority.authority, origin) : undefined; return this._send('did-load-localhost', { diff --git a/src/vs/workbench/contrib/webview/electron-sandbox/resourceLoading.ts b/src/vs/workbench/contrib/webview/electron-sandbox/resourceLoading.ts index 6f9ff94676d..b4236def69f 100644 --- a/src/vs/workbench/contrib/webview/electron-sandbox/resourceLoading.ts +++ b/src/vs/workbench/contrib/webview/electron-sandbox/resourceLoading.ts @@ -75,7 +75,7 @@ export class WebviewResourceRequestManager extends Disposable { this._localResourceRoots = initialContentOptions.localResourceRoots || []; this._portMappings = initialContentOptions.portMapping || []; - const remoteAuthority = environmentService.configuration.remoteAuthority; + const remoteAuthority = environmentService.remoteAuthority; const remoteConnectionData = remoteAuthority ? remoteAuthorityResolverService.getConnectionData(remoteAuthority) : null; this._logService.debug(`WebviewResourceRequestManager(${this.id}): did-start-loading`); diff --git a/src/vs/workbench/electron-browser/desktop.main.ts b/src/vs/workbench/electron-browser/desktop.main.ts index f016f9afd4a..1d16963d44d 100644 --- a/src/vs/workbench/electron-browser/desktop.main.ts +++ b/src/vs/workbench/electron-browser/desktop.main.ts @@ -340,7 +340,7 @@ class DesktopMain extends Disposable { } private async createWorkspaceService(payload: IWorkspaceInitializationPayload, fileService: FileService, remoteAgentService: IRemoteAgentService, logService: ILogService): Promise { - const workspaceService = new WorkspaceService({ remoteAuthority: this.environmentService.configuration.remoteAuthority, configurationCache: new ConfigurationCache(this.environmentService) }, this.environmentService, fileService, remoteAgentService, logService); + const workspaceService = new WorkspaceService({ remoteAuthority: this.environmentService.remoteAuthority, configurationCache: new ConfigurationCache(this.environmentService) }, this.environmentService, fileService, remoteAgentService, logService); try { await workspaceService.initialize(payload); diff --git a/src/vs/workbench/electron-sandbox/window.ts b/src/vs/workbench/electron-sandbox/window.ts index 4668b98bdde..c16b7d19881 100644 --- a/src/vs/workbench/electron-sandbox/window.ts +++ b/src/vs/workbench/electron-sandbox/window.ts @@ -444,7 +444,7 @@ export class NativeWindow extends Disposable { if (options?.allowTunneling) { const portMappingRequest = extractLocalHostUriMetaDataForPortMapping(uri); if (portMappingRequest) { - const remoteAuthority = this.environmentService.configuration.remoteAuthority; + const remoteAuthority = this.environmentService.remoteAuthority; const addressProvider: IAddressProvider | undefined = remoteAuthority ? { getAddress: async (): Promise => { return (await this.remoteAuthorityResolverService.resolveAuthority(remoteAuthority)).authority; diff --git a/src/vs/workbench/services/configuration/browser/configurationService.ts b/src/vs/workbench/services/configuration/browser/configurationService.ts index 81d2558bc44..a2c5b9f443b 100644 --- a/src/vs/workbench/services/configuration/browser/configurationService.ts +++ b/src/vs/workbench/services/configuration/browser/configurationService.ts @@ -781,7 +781,7 @@ export class WorkspaceService extends Disposable implements IConfigurationServic class RegisterConfigurationSchemasContribution extends Disposable implements IWorkbenchContribution { constructor( @IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService, - @IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService, + @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, ) { super(); this.registerConfigurationSchemas(); @@ -793,7 +793,7 @@ class RegisterConfigurationSchemasContribution extends Disposable implements IWo private registerConfigurationSchemas(): void { const jsonRegistry = Registry.as(JSONExtensions.JSONContribution); const allSettingsSchema: IJSONSchema = { properties: allSettings.properties, patternProperties: allSettings.patternProperties, additionalProperties: true, allowTrailingCommas: true, allowComments: true }; - const userSettingsSchema: IJSONSchema = this.workbenchEnvironmentService.configuration.remoteAuthority ? { properties: { ...applicationSettings.properties, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true, allowTrailingCommas: true, allowComments: true } : allSettingsSchema; + const userSettingsSchema: IJSONSchema = this.environmentService.remoteAuthority ? { properties: { ...applicationSettings.properties, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true, allowTrailingCommas: true, allowComments: true } : allSettingsSchema; const machineSettingsSchema: IJSONSchema = { properties: { ...machineSettings.properties, ...machineOverridableSettings.properties, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true, allowTrailingCommas: true, allowComments: true }; const workspaceSettingsSchema: IJSONSchema = { properties: { ...machineOverridableSettings.properties, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true, allowTrailingCommas: true, allowComments: true }; diff --git a/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts b/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts index 352dac93cd6..f31fd4c75c1 100644 --- a/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts +++ b/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts @@ -139,7 +139,7 @@ export class SimpleFileDialog { @IKeybindingService private readonly keybindingService: IKeybindingService, @IContextKeyService contextKeyService: IContextKeyService, ) { - this.remoteAuthority = this.environmentService.configuration.remoteAuthority; + this.remoteAuthority = this.environmentService.remoteAuthority; this.contextKey = RemoteFileDialogContext.bindTo(contextKeyService); this.scheme = this.pathService.defaultUriScheme; } diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts index 8d5e0fb7966..759fa8a0d65 100644 --- a/src/vs/workbench/services/environment/browser/environmentService.ts +++ b/src/vs/workbench/services/environment/browser/environmentService.ts @@ -101,6 +101,9 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment return this._configuration; } + @memoize + get remoteAuthority(): string | undefined { return this.options.remoteAuthority; } + @memoize get isBuilt(): boolean { return !!this.productService.commit; } diff --git a/src/vs/workbench/services/environment/common/environmentService.ts b/src/vs/workbench/services/environment/common/environmentService.ts index 01feb213573..860a03fcf35 100644 --- a/src/vs/workbench/services/environment/common/environmentService.ts +++ b/src/vs/workbench/services/environment/common/environmentService.ts @@ -11,6 +11,8 @@ import { URI } from 'vs/base/common/uri'; export const IWorkbenchEnvironmentService = createDecorator('environmentService'); +export interface IWorkbenchConfiguration extends IWindowConfiguration { } + /** * A workbench specific environment service that is only present in workbench * layer. @@ -24,10 +26,12 @@ export interface IWorkbenchEnvironmentService extends IEnvironmentService { readonly _serviceBrand: undefined; - readonly configuration: IWindowConfiguration; + readonly configuration: IWorkbenchConfiguration; readonly options?: IWorkbenchOptions; + readonly remoteAuthority?: string; + readonly logFile: URI; readonly backupWorkspaceHome?: URI; diff --git a/src/vs/workbench/services/environment/electron-browser/environmentService.ts b/src/vs/workbench/services/environment/electron-browser/environmentService.ts index 4a1cef2fac1..f0909420a1f 100644 --- a/src/vs/workbench/services/environment/electron-browser/environmentService.ts +++ b/src/vs/workbench/services/environment/electron-browser/environmentService.ts @@ -46,6 +46,7 @@ export class NativeWorkbenchEnvironmentService extends NativeEnvironmentService @memoize get logExtensionHostCommunication(): boolean { return !!this.args.logExtensionHostCommunication; } + @memoize get extensionEnabledProposedApi(): string[] | undefined { if (Array.isArray(this.args['enable-proposed-api'])) { return this.args['enable-proposed-api']; @@ -60,6 +61,8 @@ export class NativeWorkbenchEnvironmentService extends NativeEnvironmentService readonly execPath = this.configuration.execPath; + readonly remoteAuthority = this.configuration.remoteAuthority; + constructor( readonly configuration: INativeWorkbenchConfiguration, private readonly productService: IProductService diff --git a/src/vs/workbench/services/environment/electron-sandbox/environmentService.ts b/src/vs/workbench/services/environment/electron-sandbox/environmentService.ts index e0bcbac99b6..97b80183da6 100644 --- a/src/vs/workbench/services/environment/electron-sandbox/environmentService.ts +++ b/src/vs/workbench/services/environment/electron-sandbox/environmentService.ts @@ -3,15 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; -import { INativeWindowConfiguration, IWindowConfiguration } from 'vs/platform/windows/common/windows'; +import { IWorkbenchConfiguration, IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; +import { INativeWindowConfiguration } from 'vs/platform/windows/common/windows'; import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { URI } from 'vs/base/common/uri'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; export const INativeWorkbenchEnvironmentService = createDecorator('nativeEnvironmentService'); -export interface INativeWorkbenchConfiguration extends IWindowConfiguration, INativeWindowConfiguration { } +export interface INativeWorkbenchConfiguration extends IWorkbenchConfiguration, INativeWindowConfiguration { } /** * A subclass of the `IWorkbenchEnvironmentService` to be used only in native diff --git a/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts b/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts index cc3cc1b9ba3..9a78b2a5bc9 100644 --- a/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts +++ b/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts @@ -67,7 +67,7 @@ export class BuiltinExtensionsScannerService implements IBuiltinExtensionsScanne if (environmentService.options && typeof environmentService.options._enableBuiltinExtensions !== 'undefined') { enableBuiltinExtensions = environmentService.options._enableBuiltinExtensions; } else { - enableBuiltinExtensions = environmentService.configuration.remoteAuthority ? false : true; + enableBuiltinExtensions = environmentService.remoteAuthority ? false : true; } if (enableBuiltinExtensions) { return getUriFromAmdModule(require, '../../../../../../extensions'); diff --git a/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.ts b/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.ts index 02bcb7ae98c..a70f8a9d9d7 100644 --- a/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.ts +++ b/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.ts @@ -311,7 +311,7 @@ export class WebWorkerExtensionHost extends Disposable implements IExtensionHost logFile: this._extensionHostLogFile, autoStart: initData.autoStart, remote: { - authority: this._environmentService.configuration.remoteAuthority, + authority: this._environmentService.remoteAuthority, connectionData: null, isRemote: false }, diff --git a/src/vs/workbench/services/extensions/common/abstractExtensionService.ts b/src/vs/workbench/services/extensions/common/abstractExtensionService.ts index 4d56f3f8e4e..cf20dafffbe 100644 --- a/src/vs/workbench/services/extensions/common/abstractExtensionService.ts +++ b/src/vs/workbench/services/extensions/common/abstractExtensionService.ts @@ -384,7 +384,7 @@ export abstract class AbstractExtensionService extends Disposable implements IEx ).then(() => { }); } else if (hasWorkspaceContains) { const workspace = await this._contextService.getCompleteWorkspace(); - const forceUsingSearch = !!this._environmentService.configuration.remoteAuthority; + const forceUsingSearch = !!this._environmentService.remoteAuthority; const host: IWorkspaceContainsActivationHost = { folders: workspace.folders.map(folder => folder.uri), forceUsingSearch: forceUsingSearch, diff --git a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts index 962cbfeb83b..c88ec1480d4 100644 --- a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts +++ b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts @@ -174,7 +174,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten // workspace extensions run remotely if possible return ExtensionRunningLocation.Remote; } - if (extensionKind === 'workspace' && !this._environmentService.configuration.remoteAuthority) { + if (extensionKind === 'workspace' && !this._environmentService.remoteAuthority) { // workspace extensions also run locally if there is no remote return ExtensionRunningLocation.LocalProcess; } @@ -273,7 +273,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten } private async _resolveAuthorityAgain(): Promise { - const remoteAuthority = this._environmentService.configuration.remoteAuthority; + const remoteAuthority = this._environmentService.remoteAuthority; if (!remoteAuthority) { return; } @@ -291,7 +291,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten protected async _scanAndHandleExtensions(): Promise { this._extensionScanner.startScanningExtensions(this.createLogger()); - const remoteAuthority = this._environmentService.configuration.remoteAuthority; + const remoteAuthority = this._environmentService.remoteAuthority; const localProcessExtensionHost = this._getExtensionHostManager(ExtensionHostKind.LocalProcess)!; const localExtensions = this._checkEnabledAndProposedAPI(await this._scanAllLocalExtensions()); diff --git a/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts b/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts index 5aaa1ffe508..ae70615cbdd 100644 --- a/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts +++ b/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts @@ -283,7 +283,7 @@ export class LocalProcessExtensionHost implements IExtensionHost { // Help in case we fail to start it let startupTimeoutHandle: any; - if (!this._environmentService.isBuilt && !this._environmentService.configuration.remoteAuthority || this._isExtensionDevHost) { + if (!this._environmentService.isBuilt && !this._environmentService.remoteAuthority || this._isExtensionDevHost) { startupTimeoutHandle = setTimeout(() => { const msg = this._isExtensionDevDebugBrk ? nls.localize('extensionHost.startupFailDebug', "Extension host did not start in 10 seconds, it might be stopped on the first line and needs a debugger to continue.") @@ -471,7 +471,7 @@ export class LocalProcessExtensionHost implements IExtensionHost { isUntitled: workspace.configuration ? isUntitledWorkspace(workspace.configuration, this._environmentService) : false }, remote: { - authority: this._environmentService.configuration.remoteAuthority, + authority: this._environmentService.remoteAuthority, connectionData: null, isRemote: false }, diff --git a/src/vs/workbench/services/host/electron-sandbox/nativeHostService.ts b/src/vs/workbench/services/host/electron-sandbox/nativeHostService.ts index c6cb68a0213..3f15f12b6c3 100644 --- a/src/vs/workbench/services/host/electron-sandbox/nativeHostService.ts +++ b/src/vs/workbench/services/host/electron-sandbox/nativeHostService.ts @@ -62,7 +62,7 @@ export class NativeHostService extends Disposable implements IHostService { } private doOpenWindow(toOpen: IWindowOpenable[], options?: IOpenWindowOptions): Promise { - if (!!this.environmentService.configuration.remoteAuthority) { + if (!!this.environmentService.remoteAuthority) { toOpen.forEach(openable => openable.label = openable.label || this.getRecentLabel(openable)); } diff --git a/src/vs/workbench/services/path/browser/pathService.ts b/src/vs/workbench/services/path/browser/pathService.ts index 2d90a016129..15544966d10 100644 --- a/src/vs/workbench/services/path/browser/pathService.ts +++ b/src/vs/workbench/services/path/browser/pathService.ts @@ -20,12 +20,12 @@ export class BrowserPathService extends AbstractPathService { @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, @IWorkspaceContextService private readonly contextService: IWorkspaceContextService ) { - super(URI.from({ scheme: defaultUriScheme(environmentService, contextService), authority: environmentService.configuration.remoteAuthority, path: '/' }), remoteAgentService); + super(URI.from({ scheme: defaultUriScheme(environmentService, contextService), authority: environmentService.remoteAuthority, path: '/' }), remoteAgentService); } } function defaultUriScheme(environmentService: IWorkbenchEnvironmentService, contextService: IWorkspaceContextService): string { - if (environmentService.configuration.remoteAuthority) { + if (environmentService.remoteAuthority) { return Schemas.vscodeRemote; } diff --git a/src/vs/workbench/services/path/electron-sandbox/pathService.ts b/src/vs/workbench/services/path/electron-sandbox/pathService.ts index 31d6efdaa79..8a709faf8b6 100644 --- a/src/vs/workbench/services/path/electron-sandbox/pathService.ts +++ b/src/vs/workbench/services/path/electron-sandbox/pathService.ts @@ -11,7 +11,7 @@ import { Schemas } from 'vs/base/common/network'; export class NativePathService extends AbstractPathService { - readonly defaultUriScheme = this.environmentService.configuration.remoteAuthority ? Schemas.vscodeRemote : Schemas.file; + readonly defaultUriScheme = this.environmentService.remoteAuthority ? Schemas.vscodeRemote : Schemas.file; constructor( @IRemoteAgentService remoteAgentService: IRemoteAgentService, diff --git a/src/vs/workbench/services/remote/common/abstractRemoteAgentService.ts b/src/vs/workbench/services/remote/common/abstractRemoteAgentService.ts index 12c79e8612d..1ae4b855736 100644 --- a/src/vs/workbench/services/remote/common/abstractRemoteAgentService.ts +++ b/src/vs/workbench/services/remote/common/abstractRemoteAgentService.ts @@ -44,8 +44,8 @@ export abstract class AbstractRemoteAgentService extends Disposable implements I ) { super(); this.socketFactory = socketFactory; - if (this._environmentService.configuration.remoteAuthority) { - this._connection = this._register(new RemoteAgentConnection(this._environmentService.configuration.remoteAuthority, productService.commit, this.socketFactory, this._remoteAuthorityResolverService, signService, logService)); + if (this._environmentService.remoteAuthority) { + this._connection = this._register(new RemoteAgentConnection(this._environmentService.remoteAuthority, productService.commit, this.socketFactory, this._remoteAuthorityResolverService, signService, logService)); } else { this._connection = null; } diff --git a/src/vs/workbench/services/remote/common/remoteExplorerService.ts b/src/vs/workbench/services/remote/common/remoteExplorerService.ts index 463636e7ad6..f90a296d55d 100644 --- a/src/vs/workbench/services/remote/common/remoteExplorerService.ts +++ b/src/vs/workbench/services/remote/common/remoteExplorerService.ts @@ -161,7 +161,7 @@ export class TunnelModel extends Disposable { async forward(remote: { host: string, port: number }, local?: number, name?: string): Promise { const key = MakeAddress(remote.host, remote.port); if (!this.forwarded.has(key)) { - const authority = this.environmentService.configuration.remoteAuthority; + const authority = this.environmentService.remoteAuthority; const addressProvider: IAddressProvider | undefined = authority ? { getAddress: async () => { return (await this.remoteAuthorityResolverService.resolveAuthority(authority)).authority; } } : undefined; diff --git a/src/vs/workbench/services/telemetry/browser/telemetryService.ts b/src/vs/workbench/services/telemetry/browser/telemetryService.ts index 879cca5a776..cfa081b2a0c 100644 --- a/src/vs/workbench/services/telemetry/browser/telemetryService.ts +++ b/src/vs/workbench/services/telemetry/browser/telemetryService.ts @@ -51,7 +51,7 @@ export class TelemetryService extends Disposable implements ITelemetryService { if (!!productService.enableTelemetry) { const config: ITelemetryServiceConfig = { appender: combinedAppender(new WebTelemetryAppender(logService, remoteAgentService), new LogAppender(logService)), - commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, environmentService.configuration.remoteAuthority, environmentService.options && environmentService.options.resolveCommonTelemetryProperties), + commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, environmentService.remoteAuthority, environmentService.options && environmentService.options.resolveCommonTelemetryProperties), sendErrorTelemetry: false, }; diff --git a/src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts b/src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts index 93a14e89918..048318b0cd6 100644 --- a/src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts +++ b/src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts @@ -39,7 +39,7 @@ export class TelemetryService extends Disposable implements ITelemetryService { const channel = sharedProcessService.getChannel('telemetryAppender'); const config: ITelemetryServiceConfig = { appender: combinedAppender(new TelemetryAppenderClient(channel), new LogAppender(logService)), - commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, environmentService.configuration.machineId, productService.msftInternalDomains, environmentService.installSourcePath, environmentService.configuration.remoteAuthority), + commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, environmentService.configuration.machineId, productService.msftInternalDomains, environmentService.installSourcePath, environmentService.remoteAuthority), piiPaths: environmentService.extensionsPath ? [environmentService.appRoot, environmentService.extensionsPath] : [environmentService.appRoot], sendErrorTelemetry: true }; diff --git a/src/vs/workbench/services/textfile/browser/textFileService.ts b/src/vs/workbench/services/textfile/browser/textFileService.ts index a413b65b630..83974e2c424 100644 --- a/src/vs/workbench/services/textfile/browser/textFileService.ts +++ b/src/vs/workbench/services/textfile/browser/textFileService.ts @@ -349,7 +349,7 @@ export abstract class AbstractTextFileService extends Disposable implements ITex // path. This can happen if the file was created after the untitled file was opened. // See https://github.com/microsoft/vscode/issues/67946 let write: boolean; - if (sourceModel instanceof UntitledTextEditorModel && sourceModel.hasAssociatedFilePath && targetExists && this.uriIdentityService.extUri.isEqual(target, toLocalResource(sourceModel.resource, this.environmentService.configuration.remoteAuthority, this.pathService.defaultUriScheme))) { + if (sourceModel instanceof UntitledTextEditorModel && sourceModel.hasAssociatedFilePath && targetExists && this.uriIdentityService.extUri.isEqual(target, toLocalResource(sourceModel.resource, this.environmentService.remoteAuthority, this.pathService.defaultUriScheme))) { write = await this.confirmOverwrite(target); } else { write = true; @@ -420,7 +420,7 @@ export abstract class AbstractTextFileService extends Disposable implements ITex return resource; } - const remoteAuthority = this.environmentService.configuration.remoteAuthority; + const remoteAuthority = this.environmentService.remoteAuthority; // Otherwise try to suggest a path that can be saved let suggestedFilename: string | undefined = undefined; diff --git a/src/vs/workbench/services/textresourceProperties/common/textResourcePropertiesService.ts b/src/vs/workbench/services/textresourceProperties/common/textResourcePropertiesService.ts index fca00b8ebb5..052453bb0aa 100644 --- a/src/vs/workbench/services/textresourceProperties/common/textResourcePropertiesService.ts +++ b/src/vs/workbench/services/textresourceProperties/common/textResourcePropertiesService.ts @@ -41,7 +41,7 @@ export class TextResourcePropertiesService implements ITextResourcePropertiesSer private getOS(resource?: URI): OperatingSystem { let os = OS; - const remoteAuthority = this.environmentService.configuration.remoteAuthority; + const remoteAuthority = this.environmentService.remoteAuthority; if (remoteAuthority) { if (resource && resource.scheme !== Schemas.file) { const osCacheKey = `resource.authority.os.${remoteAuthority}`; diff --git a/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts b/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts index bbce8d5e959..e71e49739b8 100644 --- a/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts +++ b/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts @@ -53,7 +53,7 @@ export abstract class AbstractWorkspaceEditingService implements IWorkspaceEditi title: nls.localize('saveWorkspace', "Save Workspace"), filters: WORKSPACE_FILTER, defaultUri: this.fileDialogService.defaultWorkspacePath(), - availableFileSystems: this.environmentService.configuration.remoteAuthority ? [Schemas.vscodeRemote] : undefined + availableFileSystems: this.environmentService.remoteAuthority ? [Schemas.vscodeRemote] : undefined }); if (!workspacePath) { @@ -132,7 +132,7 @@ export abstract class AbstractWorkspaceEditingService implements IWorkspaceEditi private async doAddFolders(foldersToAdd: IWorkspaceFolderCreationData[], index?: number, donotNotifyError: boolean = false): Promise { const state = this.contextService.getWorkbenchState(); - const remoteAuthority = this.environmentService.configuration.remoteAuthority; + const remoteAuthority = this.environmentService.remoteAuthority; if (remoteAuthority) { // https://github.com/microsoft/vscode/issues/94191 foldersToAdd = foldersToAdd.filter(f => f.uri.scheme !== Schemas.file && (f.uri.scheme !== Schemas.vscodeRemote || isEqualAuthority(f.uri.authority, remoteAuthority))); @@ -198,7 +198,7 @@ export abstract class AbstractWorkspaceEditingService implements IWorkspaceEditi return; } - const remoteAuthority = this.environmentService.configuration.remoteAuthority; + const remoteAuthority = this.environmentService.remoteAuthority; const untitledWorkspace = await this.workspacesService.createUntitledWorkspace(folders, remoteAuthority); if (path) { try { diff --git a/src/vs/workbench/services/workspaces/electron-sandbox/workspaceEditingService.ts b/src/vs/workbench/services/workspaces/electron-sandbox/workspaceEditingService.ts index ed293b30fff..61e588e7e6b 100644 --- a/src/vs/workbench/services/workspaces/electron-sandbox/workspaceEditingService.ts +++ b/src/vs/workbench/services/workspaces/electron-sandbox/workspaceEditingService.ts @@ -177,7 +177,7 @@ export class NativeWorkspaceEditingService extends AbstractWorkspaceEditingServi } // TODO@aeschli: workaround until restarting works - if (this.environmentService.configuration.remoteAuthority) { + if (this.environmentService.remoteAuthority) { this.hostService.reload(); }