提交 d260ccff 编写于 作者: B Benjamin Pasero

workaround #41987

上级 c9b29197
......@@ -55,6 +55,7 @@ import { FileKind, IFileService } from 'vs/platform/files/common/files';
import { scoreItem, ScorerCache, compareItemsByScore, prepareQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer';
import { getBaseLabel } from 'vs/base/common/labels';
import { WorkbenchTree } from 'vs/platform/list/browser/listService';
import { dirname } from 'vs/base/common/paths';
const HELP_PREFIX = '?';
......@@ -1259,7 +1260,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
const resourceInput = input as IResourceInput;
this.resource = resourceInput.resource;
this.label = getBaseLabel(resourceInput.resource);
this.description = labels.getPathLabel(resources.dirname(this.resource), contextService, environmentService);
this.description = labels.getPathLabel(this.safeDirname(this.resource), contextService, environmentService);
this.dirty = this.resource && this.textFileService.isDirty(this.resource);
if (this.dirty && this.textFileService.getAutoSaveMode() === AutoSaveMode.AFTER_SHORT_DELAY) {
......@@ -1268,6 +1269,16 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
}
}
private safeDirname(resource: URI): string | URI {
try {
return resources.dirname(resource); // workaround for https://github.com/Microsoft/vscode/issues/41987
} catch (error) {
console.warn(`Unable to resolve to parent resource: ${resource.toString()}`, resource, error);
return dirname(resource.fsPath);
}
}
public getIcon(): string {
return this.dirty ? 'dirty' : '';
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册