explorer: use findClosesRoot in select()

This commit is contained in:
isidor 2021-03-12 11:42:19 +01:00
parent 3aca77c016
commit 5109a52b2a
No known key found for this signature in database
GPG key ID: F9280366A8370105

View file

@ -227,16 +227,13 @@ export class ExplorerService implements IExplorerService {
// Stat needs to be resolved first and then revealed
const options: IResolveFileOptions = { resolveTo: [resource], resolveMetadata: this.sortOrder === SortOrder.Modified };
const workspaceFolder = this.contextService.getWorkspaceFolder(resource);
if (workspaceFolder === null) {
return Promise.resolve(undefined);
const root = this.findClosestRoot(resource);
if (!root) {
return undefined;
}
const rootUri = workspaceFolder.uri;
const root = this.roots.find(r => this.uriIdentityService.extUri.isEqual(r.resource, rootUri))!;
try {
const stat = await this.fileService.resolve(rootUri, options);
const stat = await this.fileService.resolve(root.resource, options);
// Convert to model
const modelStat = ExplorerItem.create(this.fileService, stat, undefined, options.resolveTo);