Modifying edits in-flight


I looked into implementing some more advanced tooling for Clojure/Script development. In order to test the capabilities of Nova, I started with what I presumed would be the hardest part: structural editing.

I made an experimental Parinfer plugin (which can be found here: Henrik Eneroth / parinfer-nova · GitLab). If you are unfamiliar with Parinfer, it’s essentially a way to treat S-expressions for what they actually are; a data structure. The point and purpose of Parinfer is explained here: Parinfer - simpler Lisp editing

In order to support structural editing such as this, I would need to be able to amend an edit “in flight”, before it reaches the undo stack (as is done in Atom, Emacs, IntelliJ, Vim, VS Code, Sublime Text, etc. where Parinfer currently is available).

Additionally, being able to retrieve and set the cursor by column and row as opposed to by the number of characters into the buffer would help a lot.

Hopefully this is something you might consider adding.

(Parinfer is run as a WASM module, and is very, very fast. It has no perceptible impact on performance.)

You may need to describe more of what you mean of editing in flight? Do you mean modifying what the user is typing before it’s committed to the undo stack?

Yes, exactly. Sorry if that wasn’t clear.

You have the chain user edit -> parinfer -> commit. If user edit and parinfer are two separate commits, undo will revert to the state just after user edit, causing parinfer to run and (re)produce the state after parinfer, which is not the intention of the user.

I. e., both edits need to be treated as one unit on the undo stack, even while one edit is a function of the other.


Has there been any progress on this in the last year?

There has not. So far, we’ve only received one request for this (yours), so we haven’t prioritized it. I can definitely bump it, though!

A few months back I built a basic Clojure syntax highlighter & project symbol completion extension. I recently took another look with Nova’s LSP support and built a clojure-lsp extension (which I haven’t quite published yet; needs a little more polish first).

Having parinfer support would be the one other must-have for me to use Nova as my Clojure editor. So consider this another request for @eneroth’s in-flight edit modification support!


Thanks for responding, Logan!

Yeah, I think this is a chicken/egg type of problem. I don’t think many clojurists will be interested if the support isn’t there, which will axiomatically validate your point of view that there’s little interest. I know for a fact that I’m not the only one who like fast, native editors. From my point of view, if I (or Captain Morgan, or someone else), builds an environment for themselves, others will come.

Also, Parinfer in particular needs this capability, but I’m sure that Parinfer isn’t the only application for such an extension hook. If you think about it purely from the abstract point of view, this is a very powerful way of extending editor capabilities within specific contexts.

1 Like