Auto Complete plugin 1.0.15 - Complete tiddlers, fields and your dreams

I’m using this successfully after installing yesterday, and it’s a great time-saver. Kudos, and many thanks!

I’ve had no issues except one as I tried to extend it today to work with Widgets. It successfully loads the full scrollable list of widgets, but doesn’t filter them as I type. I’m guessing that this is possible, and that the problems has to do with my configuration. Is there something wrong with this?

auto-trigger-textarea: 1
caption: Widgets
created: 20221222152528635
display-filter: [<currentTiddler>]
filter: [all[tiddlers+shadows]prefix[$:/core/modules/widgets/]] +[removeprefix[$:/core/modules/widgets/]] +[removesuffix[.js]]
modified: 20221222154409874
tags: $:/tags/EC/AutoComplete/Trigger
template: <$$option$ $caret$ >
title: $:/EvidentlyCube/Trigger/3
trigger: <?
type: text/vnd.tiddlywiki

Finds names of built-in widgets.  (How to extend to custom ones, if they're not in the same namespace?  A problem for later.  Also won't work if tiddler names don't match widget name; don't know if that's a real concern.)

I also tried to move the adjustments out of the filter to the display-filter and transform-filter with no luck.

display-filter: [<currentTiddler>] +[removeprefix[$:/core/modules/widgets/]] +[removesuffix[.js]]
filter: [all[tiddlers+shadows]prefix[$:/core/modules/widgets/]]
transform-filter: [<currentTiddler>] +[removeprefix[$:/core/modules/widgets/]] +[removesuffix[.js]]

This is minor concern. I rarely need to do much type-ahead for widgets; I was mostly curious as to how I’d write a filter for them, and I pat myself on the back for figuring it out. :slight_smile:

But now I’m wondering why it’s not working and whether I can adjust it to work as expected.

Looks like your filter gas mo additional filtering! You should add another +[search:title<query>] at the end of the filter and I think it should work, unless thr variable name is different but I can’t check right now.

That was it exactly! Thank you for your help.

1 Like

And now I went back to see that you already had this as an example in your showcase. I missed the entire list of examples. Now I have to go see about the goodies…

Thanks again!

Wonderful! The core image also a good example to be added to triggers!

Maybe I missed it somewhere in the thread, can you elaborate on the bugs you’ve encountered in TW5-extendedit? The only bug I seem to encounter with TW5-extendedit is it sometimes just doesn’t work and I’m not sure why.

It’s covered in the “Why should you switch” section in the first post and randomly not working is exactly the problem that bothered me. And it bothered me a lot!

Even if TW5-extendedit has no issues, I would absolutely recommend switch to AutComplete!
It is very flexible in creating your own triggers with options and this allow you to create auto completion for anything you like in TiddlyWiki.

Some use cases for me:

  • Autocomplete for links/macros/widgets
  • Create snippets of code (WikiText, CSS, …)
  • Create autocomplete for fields, use different behavior on different field
  • Use of data tiddler (dictionary and json)
  • use of template for trigger text / for inserted text
  • Compatibility with palettes (no yellow color everywhere)
  • Use for reference manage here Refnotes (similar to EndNote, and Zotero,…)

I think autocomplete should be distributed with official plugin library as it a mush have tool

2 Likes

My DREAMS are likely orthogonal to your remit.

A list of variant dreams might be useful?

Just comments, TT

Ah thanks for clarifying. For me, I installed it but it didn’t work in fields which is where I use autocomplete the most. But I modified my add field area like so:

add-field-value

I believe the issue is not with your plugin, but rather my implementation of the add field area. I do know some portions of the code for adding field values changed between 5.2.1 (my current version) and in 5.2.5. Not sure if those changes to how field values are added has any effect on whether or not your plugin works for autocomplete in field values.

Do you mention a minimum version of TiddlyWiki your plugin supports?

Despite all of this, the prospect of having a reliable method of autocomplete is exciting :slight_smile:

First of all, thanks @Maurycy for this great plugin!

I have two questions/suggestions:

Is there currently any way of modifying the style of the displayed suggestions? I have configured the tiddler title autocompletion after [[ to also display missing tiddlers, which it does as expected. It would be nice however, if the missing tiddlers in the suggestion list would be displayed in italics, as they are in many other contexts.
I couldn’t find any information here. I tried inserting <$list> based conditional and html formatting in the Display Filter but without success.
Edit: I use the following Display Filter as a workaround [<currentTiddler>] [<currentTiddler>is[missing]then[ (𝘮𝘪𝘴𝘴𝘪𝘯𝘨)]] +[join[]]. It displays (𝘮𝘪𝘴𝘴𝘪𝘯𝘨) after missing tiddler’s title, it uses italic unicode characters instead of formatting.

In reply to your post, I think both mechanisms would be helpful. If you were to introduce the cancel trigger, my suggestion is to make it also possible to cancel auto complete if another trigger is typed and immediately switch to the second auto complete. For example I have set [[ to autocomplete links and | to autocomplete links after an [[alias| is already typed. As of now I have to type [[alias Escape | to exit the first auto complete and allow the second one to trigger. It would be much more comfortable if typing [[alias| would immediately switch to the second trigger.

2 Likes

Great plugin! It doesn’t work very well with the Notebook theme though. The popup dialog is misaligned because of the left and top bar affecting how you calculate the position of the dialog.

I’m not sure if anyone cares, but I was able to overcome the issue by adding two new configuration fields (xoffset and yoffset) and then altering the completion-api.js tiddler to use those fields. I can then enter in the necessary values to position the suggestion box in the right place. Setting the values to 0 make it behave like normal.

A bit clunky, but I like this plugin so much it was worth it. Since the template has a sidebar that can be enabled or disabled a different offset value has to be put in depending on whether you have the sidebar enabled or not. I just keep it enabled all the time so it isn’t a problem.

I’m sure there is a better solution but I don’t know how to program TiddlyWiki plugins so it’s the best I could do.

1 Like

Thanks for the notification, it should automatically detect position of everything and calculate where to put itself in a smart way but it must not be working correctly.

I wish I could tackle this right now, but I am in the crunch mode before the release of my upcoming game and every free second is spent on that so I’ll take a look sometime after 22nd May (or earlier if I need a break).

Going by memory I don’t think there is a way to do so. Sounds like a good feature to be able to control the CSS class of the tiddlers, perhaps with a filter. I’ll keep this in mind, thanks!

1 Like

Thanks @Maurycy for this practical extension to the TiddlyWiki UI, At the time your first published, I was much more focused on custom EditorToolbar buttons and mouse clicks, I am a big user of ctrl-L which is complementary.

Only now I got to review how Autocomplete works, with @Mohammad and @telumire’s additional triggers all the better.

As I was playing with the demo site, I felt like even words like macro: were too long, and though of making it << but then to avoid unwanted hits, I realised a useful trigger pattern. Use the common braces and then the single backtick, on my keyboard unshifted top left, of number keys. So I can use these;

<<` for macros
{{` for transclusions
{{|`for transclusions here 
{{!!` for fieldnames (I will try and make an in current tiddler only filter)
  • So for all my code triggers I just need to remember backtick after the thing I am after.

Question for @Maurycy

Did the use data tiddler method to generate the list of elements go anywhere?

  • I think this may suit a few applications, and large wikis I have better. It may also allow an easy way to add new entries in the list of responses to a particular trigger, perhaps even longer replacement strings like <$l giving a list widget more like a snipit <$list filter="" variable=></$list>

One more for @Maurycy

It needs a change but could we stack triggers so for example both [[ and [[: would work so if we type : the original closes and open a second?

Actually it’s own library would be good, with the package of triggers that @Mohammad and @telumire have prepared loaded in there as well.

  • A Core plugin for Auto-complete, that includes a library tiddler, to access the other “triggers”, and to obtain the latest plugin may work. Even for @Mohammad’s plugins.
  • This allows core distribution with a known version, but adds the library for updates and addons.

Once again @Maurycy thanks again for this lovely contribution.

1 Like

What do you think if use ? for triggering:

?<
?[
?{

1 Like

We can, but to me it would be ‘<?’ Because its think macro, then think use autocomplete.

What ever the special character, and ? Is ok but needs shift on my keyboard.

In my example there is no need for the doubles eg < and { are fine then they work in filter composition. use the doubles for outside filters eg {{

Also {| {! + special character

If we have tiddlers whose title is text we may want to include (we can use this to insert small snipits) without wrapping with [[ ]].

1 Like

You can also disable auto triggering and use the default ctrl+space to trigger the auto completion.

I vaguely recall there is at least one example using a data tiddler to pull the list of options, does that do what you have in mind? If not, what are the issues?

That’s a tough one. That’s something that certainly makes sense to have but with how the whole thing is coded I don’t think it’d be too easy to implement. Still, with all the feature requests and ideas that are coming the natural next step is to think about stuff like that. I just want to avoid a situation where another trigger accidentally intercepts your previous one, say you have a trigger for [[ (for existing tiddlers) and macro: and you have a lot of tiddlers called Understanding macro: <something something something>. Then when you type [[Understand macro: we don’t want the colon to suddenly stop the existing auto complete session and use the next trigger.

Something I’ll need to figure out how to handle, possibly just a built-in rule that says “triggers can only override used trigger if the length of the existing input is at most 1”. Will think about it.

I am happy to add more triggers to the showcase, just hit me with the list and I’ll work on that next time I sit down to work on this project.

4 Likes

Some great triggers also added by @Zheng_Bangyou.