as a user of parinfer in first emacs and now atom, the only time I switch to Paren mode is when I need to re-indent something because its place in the tree changed
though I’ve found atom’s lisp-paredit easier to grok than emacs’s, and so I’m using raise/splice/etc more often
I can't get correct indentation on atom, I have lisp-paredit installed, but that not help. when I press enter, sometimes the indentation is correct, sometimes not.
If you go into the lisp-paredit
settings, you can set your list of indentation forms, maybe that will help?
For example, if hello
is in your indentation forms, then you get:
(hello :there
|)
...and if it's not, then you get:
(hello :there
|)
@mattly Is that true with smart mode as well, or with the current indent mode?
re: paren mode, that is.
I guess I should clarify... that "unable to delete" issue is actually an issue with having forceBalance
set to "off", so it's not a problem with Smart Mode exactly (and atom-parinfer has forceBalance
set to "on" by default)
forceBalance
is the new feature which flags an error when it finds an unmatched close paren instead of correcting it, is that right?
it’s a blanket option for a couple things
but when it’s on, you’re signaling that you want balanced parens no matter what
v2 dialed back the aggression on unmatched close-parens and leading close-parens
- unmatched close-parens are flagged rather than removed - leading close-parens are allowed by running Paren Mode when they are present
since both behaviors allow temporary imbalance, they are not used when forceBalance
is enabled
for example, for leading close-parens:
(foo
|) bar
if you reach the above state after pressing enter or deleting a word in Indent Mode, surprising things can happenso the leading close-paren => Paren Mode behavior was the best I could come up with.
and since Paren Mode allows imbalance, this behavior can’t be used with forceBalance
does that make sense?
leading close-paren => Paren Mode needed => possible imbalance => cannot use when forceBalance
d
i’ll have to make a forceBalance
section on the new page then
Or just remove it entirely 😉
if I removed it, I’d have to fork atom-parinfer 🙂
So Shaun has asked this a few times in the GitHub issue... does anyone have a good idea about what should be the result if the user presses "delete" in this situation?
(def m {:a 1
|} bar)
I'd personally favor
(def m {:a 1|} bar)
...viewing delete as meaning "undo what I just typed"BTW, is there a 500-feet-up description of what the difference between smart mode and indent mode is (understanding that it's still a WIP) anywhere?
My original guess is that maybe you'd end up like this:
(def m {:a 1
|} bar)
...and then when you move your cursor away, you'd be reformatted to:
(def m {:a 1}
bar)
...but honestly, I like Tim's idea if it pans out@timgilbert In my opinion, the biggest change is that expressions under you hold their shape: https://www.youtube.com/watch?v=9iZfdfsoC5o
Thanks @rgdelato, will check that out
so hopefully as a user, you'll never need to switch to Paren Mode anymore. From a more technical standpoint, Smart Mode takes a list of changes as well as the current state of the document to make decisions
Pressing delete twice might be surprising here if it joins the two lines, since it doesn’t constitute “undo what I typed”:
(def m {:a 1
x|} bar)