feat: filter files

This commit is contained in:
Daniel Bauer
2024-12-16 13:15:24 +01:00
parent 81e22a01e3
commit 846315c3a7
4 changed files with 64 additions and 17 deletions

View File

@@ -36,5 +36,22 @@ export class SettingsTab extends PluginSettingTab {
this.plugin.suggester?.buildNewIndex();
});
});
new Setting(containerEl)
.setName("Exclude files")
.setDesc("Path pattern to exclude files or folders from suggestions. One pattern per line.")
.addTextArea((textArea) => {
textArea.inputEl.setAttribute("rows", "5");
textArea
.setPlaceholder("templates/")
.setValue(this.plugin.settings.ignoredFiles.join("\n"))
.onChange(async (value) => {
this.plugin.settings.ignoredFiles = value
.split("\n")
.map((val) => val.trim())
.filter((val) => val.length > 0);
await this.plugin.saveSettings();
this.plugin.suggester?.buildNewIndex();
});
});
}
}