提交 0359e059 编写于 作者: I isidor

introduce resources.dirname, fixes label in no-tab view

上级 ceb34634
......@@ -18,3 +18,9 @@ export function isEqualOrParent(first: uri, second: uri, ignoreCase?: boolean):
return false;
}
export function dirname(resource: uri): uri {
return resource.with({
path: paths.dirname(resource.path)
});
}
......@@ -11,6 +11,7 @@ import { memoize } from 'vs/base/common/decorators';
import labels = require('vs/base/common/labels');
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
import paths = require('vs/base/common/paths');
import resources = require('vs/base/common/resources');
import { EditorInput, IEncodingSupport, EncodingMode, ConfirmResult } from 'vs/workbench/common/editor';
import { UntitledEditorModel } from 'vs/workbench/common/editor/untitledEditorModel';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
......@@ -87,22 +88,22 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
}
public getName(): string {
return this.hasAssociatedFilePath ? paths.basename(this.resource.fsPath) : this.resource.fsPath;
return this.hasAssociatedFilePath ? resources.basenameOrAuthority(this.resource) : this.resource.path;
}
@memoize
private get shortDescription(): string {
return paths.basename(labels.getPathLabel(paths.dirname(this.resource.path), void 0, this.environmentService));
return paths.basename(labels.getPathLabel(resources.dirname(this.resource), void 0, this.environmentService));
}
@memoize
private get mediumDescription(): string {
return labels.getPathLabel(paths.dirname(this.resource.path), this.contextService, this.environmentService);
return labels.getPathLabel(resources.dirname(this.resource), this.contextService, this.environmentService);
}
@memoize
private get longDescription(): string {
return labels.getPathLabel(paths.dirname(this.resource.path), void 0, this.environmentService);
return labels.getPathLabel(resources.dirname(this.resource), void 0, this.environmentService);
}
public getDescription(verbosity: Verbosity = Verbosity.MEDIUM): string {
......
......@@ -8,6 +8,7 @@ import { localize } from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import { memoize } from 'vs/base/common/decorators';
import paths = require('vs/base/common/paths');
import resources = require('vs/base/common/resources');
import labels = require('vs/base/common/labels');
import URI from 'vs/base/common/uri';
import { EncodingMode, ConfirmResult, EditorInput, IFileEditorInput, ITextEditorModel } from 'vs/workbench/common/editor';
......@@ -117,7 +118,7 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput {
public getName(): string {
if (!this.name) {
this.name = paths.basename(this.resource.fsPath);
this.name = resources.basenameOrAuthority(this.resource);
}
return this.decorateOrphanedFiles(this.name);
......@@ -125,17 +126,18 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput {
@memoize
private get shortDescription(): string {
return paths.basename(labels.getPathLabel(paths.dirname(this.resource.path), void 0, this.environmentService));
return paths.basename(labels.getPathLabel(resources.dirname(this.resource), void 0, this.environmentService));
}
@memoize
private get mediumDescription(): string {
return labels.getPathLabel(paths.dirname(this.resource.path), this.contextService, this.environmentService);
return labels.getPathLabel(resources.dirname(this.resource), this.contextService, this.environmentService);
}
@memoize
private get longDescription(): string {
return labels.getPathLabel(paths.dirname(this.resource.path), void 0, this.environmentService);
return labels.getPathLabel(resources.dirname(this.resource), void 0, this.environmentService);
}
public getDescription(verbosity: Verbosity = Verbosity.MEDIUM): string {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册