New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parinfer breaks map when indentation changes #1303
Comments
Parinfer in IntelliJ only implements indent mode, not paren mode. See the parinfer website for details, but basically indent mode moves your parens around according to the current indentation (what you're seeing), and paren mode maintains indentation according to your parens. There's a growing consensus that indent mode is the only really useful mode for editing, since indentation is actually surprisingly tricky and paren mode only modifies it enough to maintain the invariants of parinfer, not how a user would actually want to indent. I'm planning to make a modification to Cursive to try to maintain indentation in a similar manner to paren mode for when structural editing is off, or in paredit mode. |
BTW I love the issue report with the animations, thanks - it makes it totally clear what you mean. |
We run into this issue quite often as well. One source of frustration is that Parinfer in Cursive automatically "fixes" commented blocks in existing code :
turns into
which breaks compilation. Would love to hear any solutions or workarounds! |
+1 Preserve indentation mode would be great to have. |
The absence of paren-mode breaks files, created by the other people. I revert a lot of code after opening and navigating files in the project. |
What? O_O No please don't leave paren mode. When I programmed with Light Table and Parinfer plugin it was really comfortable and easy to switch between indent and paren mode with Ctrl+P (just my shortcut). For example we have such code: (defn foo [f] (f 1))
(defn foobar [f] (f 2))
(foo #(+ (* % 2)
(/ % 10))) And if we want to change called function to foobar (with parinfer indent mode) we'll get this: (foobar #(+ (* % 2))
(/ % 10)) In this case we need for additional editing. But if we can switch to paren mode just for this operation this will be more easy and comfortable coding. This example is too easy but we can have 10 levels of such indented code and lack of paren mode will be crucial in that case. |
These cases are automatically handled by the new v3 of parinfer, which I'm integrating right now for testing. It's still experimental and there's lots of discussion still happening, but we're optimistic that it may completely make paren mode obsolete. |
Wew sounds great! Good luck then =) |
+1 for integrating latest parinfer after seeing how it's progressed in the recent Conj talk. Glad to see you've been working on integrating it! Will it be ready for release soon? Thanks! |
@pangloss Unfortunately there are some outstanding issues (here, here and here) which currently make it fairly difficult to use in common cases. I've tried to fix them myself but I really need to work with @shaunlebron on them and he's been busy leading up to the conj. Hopefully we can get them resolved soon, v3 is really nice when it works! |
I was very curious how well preserve indentation works so it was the first thing I tried. And then it broke my maps:
With parinfer (closing curly brace moves from line 3 to line 1):
Without parinfer (curly braces stay where they are, as expected):
I'm not used to structural editing mode so there's a chance I'm just using it wrong but at the very least this behavior doesn't really match my intuition.
The text was updated successfully, but these errors were encountered: