|
|
@ -205,17 +205,17 @@ export const SearchProvider = ({ |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (state.find) { |
|
|
|
if (state.find) { |
|
|
|
(async () => { |
|
|
|
(async () => { |
|
|
|
const res = await getDirectory('/', plugin) |
|
|
|
const files = await getDirectory('/', plugin) |
|
|
|
const pathFilter: any = {} |
|
|
|
const pathFilter: any = {} |
|
|
|
if (state.include){ |
|
|
|
if (state.include){ |
|
|
|
const inc = state.include.replaceAll(/(?<!\/)(\*\.)/g, '**/*.') |
|
|
|
const includeWithGlobalExpression = state.include.replaceAll(/(?<!\/)(\*\.)/g, '**/*.') |
|
|
|
pathFilter.include = inc.split(',').map(i => i.trim()) |
|
|
|
pathFilter.include = includeWithGlobalExpression.split(',').map(i => i.trim()) |
|
|
|
} |
|
|
|
} |
|
|
|
if (state.exclude){ |
|
|
|
if (state.exclude){ |
|
|
|
const exc = state.exclude.replaceAll(/(?<!\/)(\*\.)/g, '**/*.') |
|
|
|
const excludeWithGlobalExpression = state.exclude.replaceAll(/(?<!\/)(\*\.)/g, '**/*.') |
|
|
|
pathFilter.exclude = state.exclude.split(',').map(i => i.trim()) |
|
|
|
pathFilter.exclude = excludeWithGlobalExpression.split(',').map(i => i.trim()) |
|
|
|
} |
|
|
|
} |
|
|
|
const ob = res.filter(filePathFilter(pathFilter)).map(file => { |
|
|
|
const filteredFiles = files.filter(filePathFilter(pathFilter)).map(file => { |
|
|
|
const r: SearchResult = { |
|
|
|
const r: SearchResult = { |
|
|
|
filename: file, |
|
|
|
filename: file, |
|
|
|
lines: [], |
|
|
|
lines: [], |
|
|
@ -226,7 +226,7 @@ export const SearchProvider = ({ |
|
|
|
} |
|
|
|
} |
|
|
|
return r |
|
|
|
return r |
|
|
|
}) |
|
|
|
}) |
|
|
|
value.setSearchResults(ob) |
|
|
|
value.setSearchResults(filteredFiles) |
|
|
|
})() |
|
|
|
})() |
|
|
|
} |
|
|
|
} |
|
|
|
}, [state.timeStamp]) |
|
|
|
}, [state.timeStamp]) |
|
|
|