Skip to content

Commit 19a9d83

Browse files
committed
explorerModel: do not use isEqualOrParent in find
1 parent ad68ff3 commit 19a9d83

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/vs/workbench/parts/files/common/explorerModel.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
1515
import { toResource, IEditorIdentifier, IEditorInput } from 'vs/workbench/common/editor';
1616
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
1717
import { Schemas } from 'vs/base/common/network';
18-
import { rtrim } from 'vs/base/common/strings';
18+
import { rtrim, startsWithIgnoreCase, startsWith } from 'vs/base/common/strings';
1919
import { IEditorGroup } from 'vs/workbench/services/group/common/editorGroupsService';
2020

2121
export class Model {
@@ -342,7 +342,9 @@ export class ExplorerItem {
342342
*/
343343
public find(resource: URI): ExplorerItem {
344344
// Return if path found
345-
if (resource && resources.isEqualOrParent(resource, this.resource)) {
345+
// For performance reasons try to do the comparison as fast as possible
346+
if (resource && this.resource.scheme === resource.scheme && this.resource.authority === resource.authority &&
347+
(resources.hasToIgnoreCase(resource) ? startsWithIgnoreCase(resource.path, this.resource.path) : startsWith(resource.path, this.resource.path))) {
346348
return this.findByPath(rtrim(resource.path, paths.sep), this.resource.path.length);
347349
}
348350

0 commit comments

Comments
 (0)