fileSearchManager.ts ×9

Frontier kind: Code frontier

unlabeled · c_c9ec7ed5ce4b

3 tests · 80154 LOC · 282 files · introduces 0 tests · 57 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
14 ranges57 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5827 ranges80154 lines · 282 files · Browse complete extent
All tests (intent)
3 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 57 introduced LOC across 14 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/services/search/common/fileSearchManager.ts 39 introduced LOC · 9 ranges

Open complete file

165 return;
166 }
168 > // TODO: Optimize siblings clauses with ripgrep here.
169 > this.addDirectoryEntries(fqFolderInfo.tree, fqFolderInfo.folder, relativePath, onResult);
170 });
171 }
226
227 private addDirectoryEntries({ pathToEntries }: IDirectoryTree, base: URI, relativeFile: string, onResult: (result: IInternalFileMatch) => void) {
228 > // Support relative paths to files from a root resource (ignores excludes) fileSearchManager.ts
229 > if (this.filePattern && strings.equals(relativeFile, this.filePattern, this.config.ignoreGlobCase)) {
230 const basename = path.basename(this.filePattern);
231 this.matchFile(onResult, { base: base, relativePath: this.filePattern, basename });
232 }
234 > function add(relativePath: string) {
235 > const basename = path.basename(relativePath);
236 > const dirname = path.dirname(relativePath);
237 > let entries = pathToEntries[dirname];
238 > if (!entries) {
239 entries = pathToEntries[dirname] = [];
240 add(dirname);
241 }
242 > entries.push({ fileSearchManager.ts
243 > base,
244 > relativePath,
245 > basename
246 > });
247 > }
248 >
249 > add(relativeFile);
250 > }
251
252 private matchDirectoryTree({ rootEntries, pathToEntries }: IDirectoryTree, queryTester: QueryGlobTester, onResult: (result: IInternalFileMatch) => void) {
257 const hasSibling = hasSiblingFn(() => entries.map(entry => entry.basename));
258 for (let i = 0, n = entries.length; i < n; i++) {
259 > const entry = entries[i]; fileSearchManager.ts
260 > const { relativePath, basename } = entry;
261 >
262 > // Check exclude pattern
263 > // If the user searches for the exact file name, we adjust the glob matching
264 > // to ignore filtering by siblings because the user seems to know what they
265 > // are searching for and we want to include the result in that case anyway
266 > if (queryTester.matchesExcludesSync(relativePath, basename, !strings.equals(filePattern, basename, ignoreGlobCase) ? hasSibling : undefined)) {
267 continue;
268 }
270 > const sub = pathToEntries[relativePath];
271 > if (sub) {
272 matchDirectory(sub);
273 > } else { fileSearchManager.ts
274 > if (strings.equals(relativePath, filePattern, ignoreGlobCase)) {
275 continue; // ignore file if its path matches with the file pattern because that is already matched above
276 }
278 > self.matchFile(onResult, entry);
279 > }
280 >
281 > if (self.isLimitHit) {
282 break;
283 }
285 }
286 matchDirectory(rootEntries);
src/vs/workbench/services/search/common/search.ts 18 introduced LOC · 5 ranges

Open complete file

741
742 private _evalParsedExcludeExpression(testPath: string, basename: string | undefined, hasSibling?: (name: string) => boolean): string | null {
743 > // todo: less hacky way of evaluating sync vs async sibling clauses search.ts
744 > let result: string | null = null;
745 >
746 > for (const folderExclude of this._parsedExcludeExpression) {
747 >
748 > // find first non-null result
749 > const evaluation = folderExclude(testPath, basename, hasSibling);
750 >
751 > if (typeof evaluation === 'string') {
752 result = evaluation;
753 break;
754 }
755 > } search.ts
756 > return result;
757 > }
758
759
760 matchesExcludesSync(testPath: string, basename?: string, hasSibling?: (name: string) => boolean): boolean {
761 > if (this._parsedExcludeExpression && this._evalParsedExcludeExpression(testPath, basename, hasSibling)) { search.ts
762 return true;
763 }
764 > search.ts
765 > return false;
766 > }
767
768 /**
820 for (const key in pattern) {
821 if (typeof pattern[key] !== 'boolean') {
822 > return true; search.ts
823 > }
824 }
825