Skip to content

Commit a047a37

Browse files
committed
fix: Make documents matcher work with multiple files
1 parent 5bf6a1c commit a047a37

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/matchers/documents.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ export async function isDocumentMatch(
1616
const normalized = normalizeInstanceOrArray(config.documents);
1717
const documents = await context.loadDocuments(normalized);
1818

19-
if (!documents) return false;
19+
if (!documents.length) return false;
2020

21-
for (const document of documents) {
22-
if (!document.location) break;
23-
const relativeDocumentPath = matcher.getRelativePath(document.location);
24-
return matcher.match(relativeDocumentPath);
25-
}
21+
const paths = documents
22+
.map(({ location = '' }) => location)
23+
.map(matcher.getRelativePath)
24+
.filter(Boolean);
2625

27-
return false;
26+
if (!paths.length) return false;
27+
28+
return paths.some(matcher.match);
2829
}

0 commit comments

Comments
 (0)