window.title ${remoteName} seems to be "vscode-remote" when not in a remote (fix #122213)

This commit is contained in:
Benjamin Pasero 2021-04-27 10:42:19 +02:00
parent 6ef53c31d9
commit c9e8dff24c
No known key found for this signature in database
GPG key ID: E6380CC4C8219E65

View file

@ -42,6 +42,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
import { Schemas } from 'vs/base/common/network';
import { withNullAsUndefined } from 'vs/base/common/types';
import { Codicon, iconRegistry } from 'vs/base/common/codicons';
import { getVirtualWorkspaceLocation } from 'vs/platform/remote/common/remoteHosts';
export class TitlebarPart extends Part implements ITitleService {
@ -278,6 +279,19 @@ export class TitlebarPart extends Part implements ITitleService {
folder = withNullAsUndefined(this.contextService.getWorkspaceFolder(editorResource));
}
// Compute remote
// vscode-remtoe: use as is
// otherwise figure out if we have a virtual folder opened
let remoteName: string | undefined = undefined;
if (this.environmentService.remoteAuthority) {
remoteName = this.labelService.getHostLabel(Schemas.vscodeRemote, this.environmentService.remoteAuthority);
} else {
const virtualWorkspaceLocation = getVirtualWorkspaceLocation(workspace);
if (virtualWorkspaceLocation) {
remoteName = this.labelService.getHostLabel(virtualWorkspaceLocation.scheme, virtualWorkspaceLocation.authority);
}
}
// Variables
const activeEditorShort = editor ? editor.getTitle(Verbosity.SHORT) : '';
const activeEditorMedium = editor ? editor.getTitle(Verbosity.MEDIUM) : activeEditorShort;
@ -291,7 +305,6 @@ 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.remoteAuthority);
const separator = this.configurationService.getValue<string>('window.titleSeparator');
const titleTemplate = this.configurationService.getValue<string>('window.title');