Skip to content

Commit 534c691

Browse files
authored
removed trace logging and normalized paths in search tree parent path checking (microsoft#165850)
1 parent b7237d8 commit 534c691

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

src/vs/workbench/contrib/search/common/searchModel.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
2424
import { IFileService, IFileStatWithPartialMetadata } from 'vs/platform/files/common/files';
2525
import { createDecorator, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
2626
import { ILabelService } from 'vs/platform/label/common/label';
27-
import { ILogService, LogLevel } from 'vs/platform/log/common/log';
2827
import { IProgress, IProgressStep } from 'vs/platform/progress/common/progress';
2928
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
3029
import { minimapFindMatch, overviewRulerFindMatchForeground } from 'vs/platform/theme/common/colorRegistry';
@@ -853,13 +852,12 @@ export class FolderMatchWorkspaceRoot extends FolderMatchWithResource {
853852
@IInstantiationService instantiationService: IInstantiationService,
854853
@ILabelService labelService: ILabelService,
855854
@IUriIdentityService uriIdentityService: IUriIdentityService,
856-
@ILogService private readonly _logService: ILogService,
857855
) {
858856
super(_resource, _id, _index, _query, _parent, _searchModel, null, replaceService, instantiationService, labelService, uriIdentityService);
859857
}
860858

861-
private uriParent(uri: URI): URI {
862-
return this.uriIdentityService.extUri.dirname(uri);
859+
private normalizedUriParent(uri: URI): URI {
860+
return this.uriIdentityService.extUri.normalizePath(this.uriIdentityService.extUri.dirname(uri));
863861
}
864862

865863
private uriEquals(uri1: URI, ur2: URI): boolean {
@@ -881,24 +879,17 @@ export class FolderMatchWorkspaceRoot extends FolderMatchWithResource {
881879
}
882880

883881
const fileMatchParentParts: URI[] = [];
884-
let uri = this.uriParent(rawFileMatch.resource);
882+
const normalizedResource = this.uriIdentityService.extUri.normalizePath(this.resource);
883+
let uri = this.normalizedUriParent(rawFileMatch.resource);
885884

886-
const debug: string[] = ['[search model building]'];
887-
while (!this.uriEquals(this.resource, uri)) {
885+
while (!this.uriEquals(normalizedResource, uri)) {
888886
fileMatchParentParts.unshift(uri);
889887
const prevUri = uri;
890-
uri = this.uriParent(uri);
891-
if (this._logService.getLevel() === LogLevel.Trace) {
892-
debug.push(`current uri parent ${uri} comparing with ${prevUri}`);
893-
}
888+
uri = this.normalizedUriParent(uri);
894889
if (this.uriEquals(prevUri, uri)) {
895-
this._logService.trace(debug.join('\n\n'));
896-
throw Error(`${rawFileMatch.resource} is not correctly configured as a child of its ${this.resource}`);
890+
throw Error(`${rawFileMatch.resource} is not correctly configured as a child of its ${normalizedResource}`);
897891
}
898892
}
899-
if (this._logService.getLevel() === LogLevel.Trace) {
900-
this._logService.trace(debug.join('\n\n'));
901-
}
902893

903894
const root = this.closestRoot ?? this;
904895
let parent: FolderMatch = this;

0 commit comments

Comments
 (0)