Try the following template, and see if it does something matching your requirements:
<%*
const dv = app.plugins.plugins.dataview.api
const allTags = Object.entries(app.metadataCache.getTags() )
.sort( (a, b) => a[0].localeCompare(b[0]) ) // Sorted alphabetically
// .sort( (a, b) => b[1] - a[1], "desc" ) // Sorted related to frequency
let selectMore = true
let selectedTags = []
while (selectMore) {
let choice = await tp.system.suggester((t) => t[0] + "(" + t[1] + ")", allTags, false, "[Select more tags (ESC when finished)] - " + selectedTags.join(", "))
if (!choice) {
selectMore = false
} else {
selectedTags.push(choice[0])
}
}
tR = "Selected tags: " + selectedTags.join(", ")
%>
Trigger the template, and start selecting tags. Keep on selecting tags until you got the list you want, and then hit Esc to exit the loop, and get the tags selected inserted into your current note. You could of course do whatever you want with the selectedTags list after the loop.
Uncomment the .sort() you want according to how you want to sort the tags. You can just as normal, do the partial searches within the suggester to select the next tag, and when you select any tag it shows the currently selected tags with a prompt on selecting more or ending the selection by pressing the ESC key.
I have been looking for something like this for quite some time – thank you!
Unfortunately, I am not a coder, so the question might be naive, but: how do I change the code to filter only tags from a specific folder? Must be somewhere in the definition of the allTags constant, right?
I have tried to enter the folder within the app.metadataCache.getTags("folder 1/subfolder 2") but that did not work.