convert non global patterns

pull/2092/head
filip mertens 3 years ago
parent c15e7cd9d8
commit bf1df587bb
  1. 10
      libs/remix-ui/search/src/lib/context/context.tsx

@ -200,10 +200,14 @@ export const SearchProvider = ({
(async () => {
const res = await getDirectory('/', plugin)
const pathFilter: any = {}
if (state.include)
pathFilter.include = state.include.split(',').map(i => i.trim())
if (state.exclude)
if (state.include){
const inc = state.include.replaceAll(/(?<!\/)(\*\.)/g, '**/*.')
pathFilter.include = inc.split(',').map(i => i.trim())
}
if (state.exclude){
const exc = state.exclude.replaceAll(/(?<!\/)(\*\.)/g, '**/*.')
pathFilter.exclude = state.exclude.split(',').map(i => i.trim())
}
const ob = res.filter(filePathFilter(pathFilter)).map(file => {
const r: SearchResult = {
filename: file,

Loading…
Cancel
Save