MCPcopy Create free account
hub / github.com/continuedev/continue / shouldIgnorePath

Method shouldIgnorePath

extensions/cli/src/util/fileWatcher.ts:29–57  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

27 }
28
29 private shouldIgnorePath(filePath: string): boolean {
30 const normalizedPath = path.normalize(filePath).replace(/\\/g, "/");
31
32 return this.options.ignore.some((pattern) => {
33 if (pattern.startsWith("**/")) {
34 const suffix = pattern.slice(3);
35 if (suffix.endsWith("/**")) {
36 // Directory pattern like **/node_modules/**
37 const dirName = suffix.slice(0, -3);
38 return (
39 normalizedPath.includes(`/${dirName}/`) ||
40 normalizedPath.endsWith(`/${dirName}`) ||
41 normalizedPath === dirName
42 );
43 } else if (suffix.startsWith("*")) {
44 // File pattern like **/*.tmp
45 const extension = suffix.slice(1); // Remove the '*' to get the extension
46 return normalizedPath.endsWith(extension);
47 } else {
48 // File pattern like **/package.json
49 return (
50 normalizedPath.endsWith(`/${suffix}`) ||
51 normalizedPath.endsWith(suffix)
52 );
53 }
54 }
55 return normalizedPath.includes(pattern);
56 });
57 }
58
59 private triggerCallbacks(): void {
60 // Don't trigger callbacks during initialization

Callers 3

FileWatcherClass · 0.95
watchSubdirectoriesMethod · 0.95
watchDirectoryMethod · 0.95

Calls 2

normalizeMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected