提交 cfd06442 编写于 作者: S Sandeep Somavarapu

#30838 : Naming of files explorer section

- Always show workspace name
- Section root should be folder in case of single folder workspace
上级 6119ece4
...@@ -142,8 +142,7 @@ export class ExplorerView extends CollapsibleView { ...@@ -142,8 +142,7 @@ export class ExplorerView extends CollapsibleView {
} }
public get name(): string { public get name(): string {
const workspace = this.contextService.getWorkspace(); return this.contextService.getWorkspace().name;
return workspace.roots.length === 1 ? workspace.name : nls.localize('folders', "Folders");
} }
public set name(value) { public set name(value) {
...@@ -727,6 +726,8 @@ export class ExplorerView extends CollapsibleView { ...@@ -727,6 +726,8 @@ export class ExplorerView extends CollapsibleView {
let targetsToExpand: URI[] = []; let targetsToExpand: URI[] = [];
if (this.settings[ExplorerView.MEMENTO_EXPANDED_FOLDER_RESOURCES]) { if (this.settings[ExplorerView.MEMENTO_EXPANDED_FOLDER_RESOURCES]) {
targetsToExpand = this.settings[ExplorerView.MEMENTO_EXPANDED_FOLDER_RESOURCES].map((e: string) => URI.parse(e)); targetsToExpand = this.settings[ExplorerView.MEMENTO_EXPANDED_FOLDER_RESOURCES].map((e: string) => URI.parse(e));
} else if (this.contextService.hasFolderWorkspace()) {
targetsToExpand = this.model.roots.map(root => root.resource); // always expand single folder workspace
} }
// First time refresh: Receive target through active editor input or selection and also include settings from previous session // First time refresh: Receive target through active editor input or selection and also include settings from previous session
...@@ -776,7 +777,7 @@ export class ExplorerView extends CollapsibleView { ...@@ -776,7 +777,7 @@ export class ExplorerView extends CollapsibleView {
// Subsequent refresh: Merge stat into our local model and refresh tree // Subsequent refresh: Merge stat into our local model and refresh tree
modelStats.forEach((modelStat, index) => FileStat.mergeLocalWithDisk(modelStat, this.model.roots[index])); modelStats.forEach((modelStat, index) => FileStat.mergeLocalWithDisk(modelStat, this.model.roots[index]));
const input = this.model.roots.length === 1 ? this.model.roots[0] : this.model; const input = this.contextService.hasFolderWorkspace() ? this.model.roots[0] : this.model;
if (input === this.explorerViewer.getInput()) { if (input === this.explorerViewer.getInput()) {
return this.explorerViewer.refresh(); return this.explorerViewer.refresh();
} }
...@@ -787,7 +788,7 @@ export class ExplorerView extends CollapsibleView { ...@@ -787,7 +788,7 @@ export class ExplorerView extends CollapsibleView {
const statsToExpand = expanded.length ? [this.model.roots[0]].concat(expanded) : const statsToExpand = expanded.length ? [this.model.roots[0]].concat(expanded) :
targetsToExpand.map(expand => this.model.findClosest(expand)); targetsToExpand.map(expand => this.model.findClosest(expand));
// Display roots only when there is more than 1 root // Display roots only when multi folder workspace
// Make sure to expand all folders that where expanded in the previous session // Make sure to expand all folders that where expanded in the previous session
return this.explorerViewer.setInput(input).then(() => this.explorerViewer.expandAll(statsToExpand)); return this.explorerViewer.setInput(input).then(() => this.explorerViewer.expandAll(statsToExpand));
}, e => TPromise.wrapError(e)); }, e => TPromise.wrapError(e));
......
...@@ -27,7 +27,6 @@ import { WorkspaceConfigurationModel, ScopedConfigurationModel, FolderConfigurat ...@@ -27,7 +27,6 @@ import { WorkspaceConfigurationModel, ScopedConfigurationModel, FolderConfigurat
import { IConfigurationServiceEvent, ConfigurationSource, IConfigurationKeys, IConfigurationValue, ConfigurationModel, IConfigurationOverrides, Configuration as BaseConfiguration, IConfigurationValues, IConfigurationData } from 'vs/platform/configuration/common/configuration'; import { IConfigurationServiceEvent, ConfigurationSource, IConfigurationKeys, IConfigurationValue, ConfigurationModel, IConfigurationOverrides, Configuration as BaseConfiguration, IConfigurationValues, IConfigurationData } from 'vs/platform/configuration/common/configuration';
import { IWorkspaceConfigurationService, WORKSPACE_CONFIG_FOLDER_DEFAULT_NAME, WORKSPACE_STANDALONE_CONFIGURATIONS, WORKSPACE_CONFIG_DEFAULT_PATH } from 'vs/workbench/services/configuration/common/configuration'; import { IWorkspaceConfigurationService, WORKSPACE_CONFIG_FOLDER_DEFAULT_NAME, WORKSPACE_STANDALONE_CONFIGURATIONS, WORKSPACE_CONFIG_DEFAULT_PATH } from 'vs/workbench/services/configuration/common/configuration';
import { ConfigurationService as GlobalConfigurationService } from 'vs/platform/configuration/node/configurationService'; import { ConfigurationService as GlobalConfigurationService } from 'vs/platform/configuration/node/configurationService';
import { basename } from 'path';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
import { Registry } from 'vs/platform/registry/common/platform'; import { Registry } from 'vs/platform/registry/common/platform';
import { ExtensionsRegistry, ExtensionMessageCollector } from 'vs/platform/extensions/common/extensionsRegistry'; import { ExtensionsRegistry, ExtensionMessageCollector } from 'vs/platform/extensions/common/extensionsRegistry';
...@@ -464,7 +463,6 @@ export class WorkspaceServiceImpl extends WorkspaceService { ...@@ -464,7 +463,6 @@ export class WorkspaceServiceImpl extends WorkspaceService {
const foldersChanged = !equals(this.workspace.roots, configuredFolders, (r1, r2) => r1.toString() === r2.toString()); const foldersChanged = !equals(this.workspace.roots, configuredFolders, (r1, r2) => r1.toString() === r2.toString());
if (foldersChanged) { if (foldersChanged) {
this.workspace.roots = configuredFolders; this.workspace.roots = configuredFolders;
this.workspace.name = configuredFolders.map(root => basename(root.fsPath) || root.fsPath).join(', ');
this._onDidChangeWorkspaceRoots.fire(); this._onDidChangeWorkspaceRoots.fire();
this.onFoldersChanged(); this.onFoldersChanged();
return; return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册