mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-30 03:58:11 +01:00
workaround #41987
This commit is contained in:
@@ -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' : '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user