allow remote workspaces

This commit is contained in:
Martin Aeschlimann
2019-01-25 17:04:03 +01:00
parent 7efcf23bbd
commit b5b21eada0
21 changed files with 190 additions and 169 deletions

View File

@@ -11,13 +11,11 @@ import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry, IWo
import { Registry } from 'vs/platform/registry/common/platform';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkspaceContextService, IWorkspace } from 'vs/platform/workspace/common/workspace';
import { isEqual, basenameOrAuthority, basename as resourceBasename } from 'vs/base/common/resources';
import { isEqual, basenameOrAuthority, isEqualOrParent, basename, joinPath, dirname } from 'vs/base/common/resources';
import { isLinux, isWindows } from 'vs/base/common/platform';
import { tildify, getPathLabel } from 'vs/base/common/labels';
import { ltrim } from 'vs/base/common/strings';
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, WORKSPACE_EXTENSION, toWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { isParent } from 'vs/platform/files/common/files';
import { basename, dirname, join } from 'vs/base/common/paths';
import { Schemas } from 'vs/base/common/network';
import { IWindowService } from 'vs/platform/windows/common/windows';
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
@@ -175,7 +173,7 @@ export class LabelService implements ILabelService {
// Workspace: Single Folder
if (isSingleFolderWorkspaceIdentifier(workspace)) {
// Folder on disk
const label = options && options.verbose ? this.getUriLabel(workspace) : resourceBasename(workspace) || '/';
const label = options && options.verbose ? this.getUriLabel(workspace) : basename(workspace) || '/';
if (workspace.scheme === Schemas.file) {
return label;
}
@@ -186,7 +184,7 @@ export class LabelService implements ILabelService {
}
// Workspace: Untitled
if (isParent(workspace.configPath, this.environmentService.workspacesHome, !isLinux /* ignore case */)) {
if (isEqualOrParent(workspace.configPath, URI.file(this.environmentService.workspacesHome))) {
return localize('untitledWorkspace', "Untitled (Workspace)");
}
@@ -194,7 +192,7 @@ export class LabelService implements ILabelService {
const filename = basename(workspace.configPath);
const workspaceName = filename.substr(0, filename.length - WORKSPACE_EXTENSION.length - 1);
if (options && options.verbose) {
return localize('workspaceNameVerbose', "{0} (Workspace)", this.getUriLabel(URI.file(join(dirname(workspace.configPath), workspaceName))));
return localize('workspaceNameVerbose', "{0} (Workspace)", this.getUriLabel(joinPath(dirname(workspace.configPath)!, workspaceName)));
}
return localize('workspaceName', "{0} (Workspace)", workspaceName);