Fork me on GitHub
#parinfer
<
2024-04-01
>
mauricio.szabo01:04:23

Hi, @shaunlebron. I just saw this info at the Readme of parinfer: > Editors simply are not yet designed to allow an ideal version of Parinfer to exist > So... now that Atom is dead and the one keeping a fork of it is me, maybe I can design some API for this ideal version to exist? What do you think is needed?

🙏 1
👌 1
chrisoakman16:04:50

I can probably be of some assistance here. I should do a write-up of exactly what API calls Parinfer needs in order to be implemented 100% in editors.

chrisoakman17:04:52

Incidentally, this would be the same write-up as "why VS Code does not support Parinfer Smart Mode"

mauricio.szabo17:04:54

These API calls would be really useful - we are already adding new API, meaning that we're already "our own thing", not limited by what Atom used to offer only 🙂

mauricio.szabo17:04:02

Thanks for the help!

mauricio.szabo20:04:20

Also, I remember seeing the write-up about VSCode, but unfortunately I'm not finding it - can you link it to me, so I can see if the same problems exist in Pulsar too?

Tarjei Skjærset22:04:03

Could someone link me that post as well? I too am curious (although I'm into neovim, but would love to know what's missing).

shaunlebron19:08:41

Hi @U3Y18N0UC, coming back to this, I think the third paragraph of the section you quoted from has the most details about what Smart Mode requires from an editor: https://github.com/parinfer/parinfer.js?tab=readme-ov-file#status-update-2019-smart-mode

shaunlebron22:08:49

I might try a Dumb Mode actually: 1. Add two file hooks: • Format on open: when opening a file, run clojurefmt with https://github.com/oakmac/clojurefmt-js/blob/d221663d6386312a1e6c4c198b2bebc152194c7a/test_format/format.eno#L265-L328Unformat on save: when saving a file, run parstager on it to undo formatting on top-level forms when possible 2. Override tab and shift+tab: • Indent to tab-stops: when indenting a line or selection of lines, snap to structural tab-stops 3. Add two hotkeys for “infer” or “format”: • Infer on command: run Indent Mode on command (not every time you type) • Format on command: auto-format with clojurefmt, which runs on command

mauricio.szabo13:08:50

Looking at this, it seems that the problem in Pulsar is copy/paste and buffer refreshes from changes on disk - these indeed are not implemented. If I'm not mistaken, it's possible to get every change from every cursor using the change callback; still, it might have some trouble in case of some "API text change" (which is something I am experimenting on a different plug-in I'm writing)

mauricio.szabo14:08:41

Also, this 3 version might be interesting for very big files that might add latency too thinking-face

shaunlebron22:08:49

I might try a Dumb Mode actually: 1. Add two file hooks: • Format on open: when opening a file, run clojurefmt with https://github.com/oakmac/clojurefmt-js/blob/d221663d6386312a1e6c4c198b2bebc152194c7a/test_format/format.eno#L265-L328Unformat on save: when saving a file, run parstager on it to undo formatting on top-level forms when possible 2. Override tab and shift+tab: • Indent to tab-stops: when indenting a line or selection of lines, snap to structural tab-stops 3. Add two hotkeys for “infer” or “format”: • Infer on command: run Indent Mode on command (not every time you type) • Format on command: auto-format with clojurefmt, which runs on command