CodeMirror 6 plugin Beta

Hi @TW_Tones

What would you like to see documented?

Hi @BurningTreeC, in my personal workflow, I’d only need tiddler title autocomplete (AC) when I want to create a link to that tiddler, without needing the wikilink popup. For that, the [[ should remain after the AC result is inserted, followed by the link-closing ]]. The closing brackets might have already been inserted by CM6 itself at that point, depending on how auto-closing of brackets is configured, in which case it need not be inserted by AC or manually.

I do find it slightly distracting if AC with a list of tiddler titles pops up upon typing the start of every word in a prose text. That’s why I’d like the [[ to trigger that. For others it might be perfectly normal, though…

Basicaly the features now available and as listed in the old seperate plugins and in your “try this tiddler” examples. With a few more words in the use and values of the config options.

Expanding this to a list and possibly about a paragraph in each.

I can infer a few and write some examples of you would like. The main help I need is identifying the features so I dont leave any out.

Hi @Yaisog

could you make a test in 5 minutes with version 0.1.7 ?

In the configuration panel you can disable auto-open while typing and you can define [[ as your prefix that should trigger tiddler autocompletion

you should also disable closing brackets

Ah - wait a moment, something’s not working

@Yaisog

now it should work like you want

  • disable closing of brackets
  • set [[ as autocompletion prefix
  • disable “Autocompletion open on typing”

Hi @BurningTreeC: It works in the sense that if I combine the options you mention, the tiddler AC indeed only pops up when the prefix is detected. But then, the useful widget and filter ACs won’t work, only other words from the text. If I enable “AC open on typing” then the prefix is ignored and tiddler AC is always active.

I’m not sure how to best tackle this. I think it might be useful to be able to define a prefix for each AC (e.g. < or <$ for widgets). But then again the rules for e.g. filters seem to be more complicated, since those only pop up when I really do want them, i.e. when writing filter expressions. So those rules should be used when no explicit prefix for filters is defined?

I believe that the implementation could be guided by @Maurycy’s Autocomplete Plugin, to minimize friction when switching between the two. However, I am embarassed to admit that I haven’t installed this plugin yet, though it’s on my long list of things to do, so I cannot really give you details. The feedback I sensed for that plugin was very positive, though.

Have a nice day
Yaisog

@Yaisog the best shortcuts I found in the auto complete plugin were symbol or symbols followed by back tick. This is opposite in order to show we usualy use backticks but can trigger them with the same pattern you would type followed by backtick, which is easy an unshifted on my keyboard…


{`
{{`
{{{`
[`
[[`
<`
<$`

Etc...

1 Like

Hi @Yaisog

Yes I’m not yet fully satisfied with how this is working

What would you like to autocomplete when you type your prefix? Everything? Tiddlers, widgets, filters…?

@Yaisog @TW_Tones

the possibilities for autocompletion in the codemirror 6 plugin are many and I kept them simple in the beginning. Now it’s getting more complicated.

But I wanna tackle the challenge and implement autocompletion in a way that uses configurable triggers to open the autocompletion tooltips.

What makes it more difficult is, that one might also want to remove the trigger characters after autocompletion, another user may want to keep them. So it might be a separate configuration for each trigger, and of course a separate trigger for each category.

I’ll need to think more about this and test but I’m positive that I can make this work.

Best wishes,
Simon

Simon,

Would it not be better to look at ensuring the auto complete plugin can work with code mirror 6

Well, since [[Title]] is the TW syntax for a link to tiddler Title, the [[ prefix should primarily trigger AC of tiddler titles. A prefix of <$ should trigger AC of widgets. Filters would be triggered by e.g. filter=", {{{\s*[ and maybe others. Widgets and filters already trigger correctly in the current implementation, I think.

@TW_Tones’ idea of an extra “trigger character” for manual triggering seems intriguing, too. The backtick is weird on my keyboard, but this could be any other symbol. But this would be independent of your implementation.

1 Like

@TW_Tones

that’s problematic because of the already integrated autocompletion functionality of the codemirror 6 plugin

Hey, I am the author of aforementioned Auto Complete plugin. Different behavior in different contexts is exactly why I opted for adding customizability for my triggers and even with all the options that I already have there is still need for more. Giving the power to the users is certainly a good way to go, though…

…I’d think using a native CM6 plugin would give you way more flexibility, like better contextual completion to for macro attributes based on the macro used, filter auto completion etc. Things that could be difficult to allow customization for the user but also things that are second nature in any serious programming IDE. Food for thought?

Hi @Maurycy

Thank you for your thoughts about this.
I’m currently facing two decisions. Either I make the current implementation more context aware or I focus on the tiddlywiki syntax recognition by implementing a tiddlywiki language mode which would finally be context aware.

I’m currently doing the first and it’s getting better, not yet ready for a release though

But at some point I’ll have to go down the rabbit hole of implementing that language mode.

I think I now finish the work on point one, then freeze the development of the plugin and focus on the tiddlywiki mode even if it’s a difficult task

Hi @BurningTreeC, it seems I have a CSS rule somewhere that makes all the AC text white-on-white:

image

The problem is, I can’t figure out which rule it is, because any interaction with the PC closes the popup, i.e. I cannot look at its CSS rules in the Inspector. I even had to use a delayed screenshot tool to take the screenshot above since pressing the key combination for a regular screenshot would close the popup before taking the shot. In that sense it is even less tangible than a Windows context menu popup. TW popups are much more permanent and easy to style in that regard.

Do you have any ideas what I could do?

Yaisog

Hi @Yaisog

what palette are you using?

Thanks,
Simon

My approach of last resort for these situations is to trigger the debugger from the console with a delay:

setTimeout(function() {debugger;}, 5000);

@BurningTreeC I have a lot of custom CSS in my wiki. It’s probably one of those rules. I just cannot identify which. Is the DOM structure of the popup documented somewhere? I could insert an override rule or an exception if I just knew what to target…

@saqimtiaz That worked! Thanks for the tip. I’ll dig into the CSS now…

Hi @BurningTreeC I think I traced the problem back to a missing line in $:/palettes/Vanilla/extend that should be something like
cm-tooltip-foreground: <<colour foreground>>

Adding this line fixed it for me. The codemirror CSS does try to look up that particular value.
I only checked Vanilla, don’t know about the other palettes.

Yaisog

Thank you @Yaisog !

Yes that parameter is probably missing in all extended palettes.
I’ll fix that!

Thank you