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

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.

I used triggers /[ and /| for all tiddlers, //, /n, /m for reference as it is easy to type with right hand and starting with / means auto complete.

1 Like
  • I can’t reproduce this here on chrome, I think it clashing with another shortcut.

Yes, I have not seen it yet, and an example in the documentation would be helpful.

Thanks.

Clever! no shift key is required here.

Sometimes I forget what was the shortcut for example for advanced search filter or for macros, so I have written a triger with ?h it shows the list of shortcuts for all available triggers.

Yes, / is good one, but so is I believe my suggestion the back tick, if it follows something, because then if not it is just code.

  • We could also use \ to trigger a selection from the new options on 5.3.0
\define
\procedure
\parameters

In fact all pragmas,

I think this solution will work best with this after market in sets of curated auto complete triggers, perhaps organised so when not designing you disable the TiddlyWiki Script items.

To me there is real value in leveraging existing symbols such as [ { | < because it is in a way self documenting, and appears when you are doing something with the elements that us the character.

I can also see value in pulling the default parameters from widgets, pull content from inside ( ) and change : to =

Here is my opinionated perspective, for you to throw “bouquets or brickbats” at.

  • I am not yet good enough to write the complex regex if needed for these yet.

    • \+backtick, pragmas *
    • /+backtick escaped regex (not sure here?)
    • etc…

[[ link tiddlers (in wikitext [[tiddlername]] ) ← existing
{{ transclude all tiddlers (in wikitext {{tiddlername}} ) *
|| transclude here all tiddlers (in wikitext {{||tiddlername}} ) ← existing
!! transclude field (in wikitext {{!!fieldname}} ) *
<< replacing macro: variable or macroname ( in wikitext <<macros>> ) *

And the harder to document using a single backtick

[` link all tiddlers (in filters `[tiddlername]`) *
{` transclude all tiddlers  (in filters `{tiddlername}`) *
{!` transclude field (in filters `{!fieldname}`) *
<` all macros (in filters `<macroname>`) *
<`??? all variables and macros (in filters `<macroname>`)
maybe also ?
  <m` for macros not variables ???
  <v` for variables not macros ???
  <p` for parameters ???
etc...
  • Note: When I use a single backtick in the trigger it does not display correctly in the Registered triggers
    • Changing from <code> to (Trigger <$text text={{!!trigger}}/>) fixes it.
  • The above lend themself to definition in data tiddlers, perhaps with a toggle to enable / disable.
  • I am building these now and will package, but there will be a few challenges
  • Edited to reflect changes as I build them, * used for those created
  • My efforts so far autocomplete-triggers.json (5.0 KB)

The beauty being we can do what ever we want :nerd_face:

I successfully created this one, only to realise the possibility of having one autocomplete triggering a second one, ie chain to another, hitting space after the inserted pragma, triggered the pragma for \whitespace<space>

For example type the following

\`wh<enter>

which gives you

\whitespace

Now add a space

\whitespace<space>

And it triggers an autocomplete of trim | notrim

\whitespace trim

This makes me realise this could be a complete syntax and parameters tool, I wonder if it could be performant enough as it stands?

Love your work @Maurycy

One issue with [, (, { is if you have codemirror-autoclose-bracket installed, then these chars cause having extra brackets in finall autocomplete!

I see @Maurycy has listed this in his Raod Plan. By that time I dropped brackets from my autocomplete triggers.

I believe AutoComplete can save you a lot and helps newcomers to get onboard. So Autocomplete is an essential plugin!

I note that if codemirror provides the braces, then it is just a matter of changing what autocomplete inserts? for example with {{ don’t supply the closing braces because code mirror will do it.

  • Thus autocomplete can have a different template field to use when the code mirror plugin(s) are active, that is use that instead.
  • I just tested it with {{ and {<backtick> and it works.

Post script: Because there is no need to change the trigger there is nothing different between with or without codemirror, just the replacement template.

A post was merged into an existing topic: Community Curated AutoComplete Triggers

See also: Community Curated AutoComplete Triggers - Tips & Tricks - Talk TW (tiddlywiki.org)

1 Like

@Maurycy, would it be difficult to add refresh throttling to the dropdown?