Fork me on GitHub
#vim
<
2019-09-07
>
mjw15:09:52

For those using vim-parinfer, how have you dealt with parinfer’s automatic reformatting of existing files that are not indented in a way that parinfer expects?

mjw15:09:12

An easy example is the clojure-koan files; in some cases it’s been completely impossible to indent to the desired level of paren nesting.

dave16:09:44

i accept the reformatting as gospel and check the changes into source control 🙂

dave16:09:15

it's not always doable, depending on the dynamics of your team. some people might find it annoying to have their code reformatted

dave16:09:08

i usually give the old "i can't help it, parinfer reformats my code automatically ¯\(ツ)/¯" excuse

dave16:09:46

so far i haven't really run into any resistance on my team. i don't think they care all that much about formatting

dominicm16:09:26

I think parlinter enforces reasonable formatting tbh

dave16:09:50

yeah, i like it

dave16:09:46

one place it can get a little weird is if you open a file where somebody has commented out the final expression in a form, and they wanted it to be easy to comment/uncomment it, so they did something like this:

(...
  (foo 1 2 3)
  (bar 2 3 4)
  ;; (baz 3 4 5)
  )
(note the trailing paren on its own line)

dave16:09:19

parinfer will reformat that as:

(...
  (foo 1 2 3)
  (bar 2 3 4))
  ;; (baz 3 4 5))

dave16:09:39

which works fine for parinfer users, but a non-parinfer user will end up with mismatched parens when they uncomment that line

dave16:09:52

unless they have some other plugin that corrects the parens, i guess

mjw16:09:58

The problem I’ve experienced is when existing indentation results in forms being completely rewritten, so I then have to figure out how every line is supposed to be indented to return the parens to their original positions.

mjw16:09:37

That bit me hard when I had to figure out why every function in a file suddenly stopped working.