This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-01
Channels
- # announcements (14)
- # beginners (6)
- # biff (6)
- # calva (3)
- # cider (7)
- # clojure (79)
- # clojure-europe (5)
- # clojure-norway (9)
- # cursive (9)
- # data-science (20)
- # datomic (3)
- # fulcro (9)
- # graalvm (15)
- # integrant (2)
- # introduce-yourself (2)
- # jobs (1)
- # lsp (7)
- # malli (5)
- # off-topic (130)
- # parinfer (11)
- # pedestal (11)
- # portal (1)
- # practicalli (4)
- # releases (3)
- # remote-jobs (1)
- # ring (8)
- # ring-swagger (30)
- # shadow-cljs (9)
- # sql (10)
- # tools-deps (8)
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?
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.
Incidentally, this would be the same write-up as "why VS Code does not support Parinfer Smart Mode"
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 🙂
Thanks for the help!
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?
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).
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
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-L328
• Unformat 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
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)
Also, this 3
version might be interesting for very big files that might add latency too
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-L328
• Unformat 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