Question about Autocomplete plugin or more generally about the output of a filter

Hi, I was trying to make a custom Trigger for Autocomplete and I needed to make a very simple one (i.e. the combination of two characters that rarely go together just recommends me just 2 specific words). So I didn’t want to make more tiddlers or work on this for too long, and thought to put as theSuggestion Filter something like this: [list[$:/EvidentlyCube/Trigger/10]]
I would then put the two words in the “list” field and ideally Autocomplete would recommend the words entered in the filter.
But unfortunately it does suggest them but enclosing them in double square brackets, like so [[Word1]] [[Word2]]
Once I saw it I remembered why this happens (It also happens with other fields)
But at the moment I haven’t come up with any other ideas to solve this problem.

  • Is there some way for autocomplete to just give me the words I manually insert without putting them in square brackets?
    (The only solution that I think might work even if I haven’t tested it is to create tiddlers with that name, but I don’t like it because they wouldn’t be shadows)

Ideal would be a field or data tiddler or similar. I’m sure there is a way, but I just have no idea where to start.

Sam

Hi Sam!

If I understand your problem, it should be easy to solve by specifying your custom autocomplete trigger’s “template”.

When you’re specifying the autocomplete trigger, just look toward the bottom for the template, and replace the standard template (that includes brackets) with the simpler string:

$option$$caret$

-Springer

2 Likes

Brilliant, that’s really handy!
Thanks a lot :blush:

1 Like

Still on the same topic, if I had to do the same thing but with spaces inside the suggestions, how should I do it?
For example if in my list field I put: First sentence Second sentence
And I’d like to have as suggestions:

  1. First sentence
  2. Second sentence

I tried to modify the template, but blindly because I couldn’t find info about it, and I still can’t encapsulate the sentences as I would like

Have you tried putting [[First sentence]] [[Second sentence]] as the list field value?

I’m not sure if Autocomplete handles the list properly, but enclosing list values within doubled square brackets is the TWCore standard method of storing a list where the item values contain spaces. Note that list items that don’t have spaces don’t need the doubled square brackets. Thus, a typical list field might contain:

One [[Two words]] Three [[an item with more words]] Argle Bargle Mumble Frotz Gronk
1 Like

Yes, it works. I hadn’t tried it because my initial problem was actually not wanting the square brackets. But having changed template, it is no longer a problem. I was looking at the problem with the same old perspective. Thank you!