-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Problem
Currently, we use vscode.workspace.findFiles('**/*.md') to find all fiels that we are about to parse (parse.ts)
This finds files in the whole workspace which might not be desirable. My particular use case is that I've got two folders in my workspace:
permanentnotesreferencenotes
The permanent notes are about a particular topic and the reference notes are notes taken from a book or an article. permanent notes are almost always linking to reference notes (i.e. saying that I learnt that particular information in book XYZ).
The current parsing mechanism results in showing huge clusters of notes all linked by reference note (a book or an article) whilst I'm only interested in the connections between permanent notes.
Suggested solution
We could allow users to configure the findFiles expression. So instead of
const files = await vscode.workspace.findFiles(
`**/*{${(getFileTypesSetting() as string[]).map((f) => `.${f}`).join(",")}}`
);we would use the configured value and only if that's missing, we would default to the current expression:
const searchExpression = getConfiguration("searchExpression");
const defaultExpression = `**/*{${(getFileTypesSetting() as string[]).map((f) => `.${f}`).join(",")}}`;
const files = await vscode.workspace.findFiles(searchExpression || defaultExpression);This would be the most performant solution, but we could as well introduce some allow/deny list that would be used when we iterate through the findFiles() result:
for (const file of files) {
const hiddenFile = path.basename(file.path).startsWith(".");
if (!hiddenFile) {
promises.push(fileCallback(graph, file.path));
}
}How does this sound @tchayen ?