CodeMirror 6 - back to development

Hello dear Tiddlywikians,

As you may know, there are TWO implementations of the codemirror 6 plugin.
The history is that I’ve created the implementation so that it works as a tiddlywiki editor and another user forked it and extended it impressively.

The last days I’ve been working on fixing some bugs, updating the library and adding supported languages like python or rust.

Here is my codemirror 6 plugin:
https://burningtreec.github.io/tiddlywiki-codemirror-6/

And here’s its GitHub page:


I really don’t know what the upsides of the other implementation are because I’m using mine and I like it.
If me and the other developer could work together in creating ONE implementation that would probably be the best thing for the community.

BUT there could surely be a THIRD implementation :grin:


Lange Rede kurzer Sinn (long story short) - I’m back to development for this plugin and if you have bug reports and ideas, please let me know!

Thank you,
Simon

5 Likes

Perhaps we/you could name your release?, in a way that suites your design sensibility. eg “CodeMirror 6 trim”, this would at least allow us to refer to it without needing to provide a paragraph to differentiate.

Thanks for you contribution @BurningTreeC

Will this have a tab in the control panel for settings, as previous versions did?
Thank you!

I wish you luck and great success, Simon/BTC.

As you may recall, I tried the other one… I wish I never had. It’s hard to be kind about it after the mess it made trying to uninstall it. Partly my fault for thinking it was way better than it actually was which led me to making wide changes to adopt it… and when I tried to back out (after months)… I’d forgotten “all the bits” I’d changed. Nightmare.

So, BIGGEST reason for backtracking (I reverted to CM5) was that Esc key problem in the find dialog. I failed to (re)train my fingers to reach for the mouse to cancel out of it. If I had just opened the tiddler, then immediately began with a search, and then hit escape, it closed the damn tiddler. I mention this because over in that thread, you said your code had the same problem.

2nd reason: the TW mode (syntax highlighting) is awful. Essentially, so random, I just got sick of looking at it.

Example

;this semicolon causes bold in TiddlyWiki <-- perfectly fine

;And it's bold in the other plugin <-- perfectly fine, too

But then you decide to write a semicolon mid-sentence; AND THIS IS BOLD TOO and everything after it

And some other text decided to suddenly use italics mid-paragraph. I never did find what caused it. Drove me crazy.

So, Yeah. The mode. It’s gotta be solid.

So… GOOD LUCK!

Hi @CodaCoder

In my current version the escape key should always close the search panel
One problem is still open, which is the X button of the search panel not deleting a state tiddler I want it to delete…

About TW mode… that’s a BIG task!
I once tried recreating the markdown mode and see where I can go from there but it’s a really big task…
If there’s somebody with knowledge how to start, I would appreciate help!

Thank you,
Simon

And a big ASK, I know. But the issues with the other offering were so bad… made it unusable.

I did one way too long ago to be of any use. It was for a DSL implemented using a JSON-based lang. Even with a basic JavaScript mode as a starting point, it was a mammoth task. And, of course, not much commonality with TW.

So yes, I’m well aware of the task beset you. Hence, good luck.

To be clear: even if it’s basic and incomplete as in “less than ideal”, it just needs to be SOLID.

Hi @CodaCoder

I’m not saying that I’m working on tiddlywiki syntax highlighting here, to be clear.
I don’t remember, but I believe even codemirror 5 doesn’t have it.
So what’s the problem at the moment with text/vnd.tiddlywiki and codemirror 6?

Thank you,
Simon

This is now fixed in version 0.2.6

Hmm. There’s a good chance I’m muddying the waters.

99.9% correct. It has things like bracket-matching done very nicely (but even that is a sub-plugin, i think).

To be clear, I wasn’t talking about your implementation, but the other one. It tries to implement both code highlighting (for TW macros et al) AND give you WYSIWYG for TW code in the editor (not just when the tiddler is rendered). So you get //weird stuff like this//   ‘‘and this’’. And like I said, when it breaks (often!) you get stuff appearing in italics for no reason. Weirdly, it doesn’t render like that, just appears randomly in the editor. Makes for a very “noisy” editing experience. Like I said, I got sick of looking at it.

I’ll shut up now and let you get on. When I get a time window to try yours, I grab it and let you know how it goes.

One thing I’d :heart: LOVE :heart: to have is…

A macro (or whatever - could be an AHK macro) to automagically take a selection string like…

my-procedure(

AND pass it to the CM search box, AND hit enter for me. Call it “Jump to definition”.

What’s missing is that final step, hit enter for me.

So, 1.select the text, 2.pass it to find dialog, 3.hit enter – triggered by a kbd macro, Ctrl-Alt-F, perhaps.

And if I could do that from OUTSIDE the editor (first find the tiddler, then find the text itself) that would be fantastic.

Hi @CodaCoder

That will probably never come in my plugin … I wouldn’t know how to implement this


Another thing: The plugin probably needs an update now that the core has updated the text-editor operations. I will look into this and update the plugin accordingly.

Best wishes,
Simon

1 Like

Hi all,

I have updated the text-operations so that they are up-to-date with the tiddlywiki core.


I would like to gather some ideas for sensible Codemirror actions (actions triggered by typed character sequences from within the editor) that could be included in the plugin.
Do you have some input? Some ideas? Would be great :slight_smile:

Thank you,
Simon

I have a bunch of AHK things that you could probably incorporate…

xIF ==> 
<% if [] %>\n
\n
<% else %>\n
\n
<% endif %>\n

xLIST ==>
<%list filter="[]" variable=item>\n
\n
<<item>>\n
</$list>\n

I could add more, but you get the idea.

And if you provided a facility where we could add our own… :heart_eyes:

Hi @CodaCoder

The facility to add your own is already built in.
The description is on the demo page.
Basically you create tiddlers tagged $:/tags/CodeMirror/Action and put the actions inside

1 Like

I assigned that to string:xLIST and when I type “xLIST”, the editor deletes it.

Hi @CodaCoder

Yes, that’s the current behavior. The string gets deleted and an action gets triggered

I have to provide an action… I see.

Yes, like a text-editor-operation

I’m not familiar with those - never use them. Okay… I’ll be back later (brunch is calling me :wink: )