Skip to content
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

Closed
flosell opened this issue Mar 20, 2016 · 10 comments
Closed

parinfer breaks map when indentation changes #1303

flosell opened this issue Mar 20, 2016 · 10 comments

Comments

@flosell
Copy link

flosell commented Mar 20, 2016

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):
hqdfsctgoe

Without parinfer (curly braces stay where they are, as expected):
mif7q4u2qr

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.

@cursive-ide cursive-ide modified the milestone: 1.2.2 Mar 20, 2016
@cursive-ide
Copy link
Owner

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.

@cursive-ide cursive-ide removed this from the 1.2.2 milestone Mar 20, 2016
@cursive-ide
Copy link
Owner

BTW I love the issue report with the animations, thanks - it makes it totally clear what you mean.

@yayitswei
Copy link

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 :

#_(defn do-something [x]
  (->> x f g h))

turns into

#_(defn do-something [x])
  (->> x f g h)

which breaks compilation. Would love to hear any solutions or workarounds!

@Cka3
Copy link

Cka3 commented Mar 11, 2017

+1 Preserve indentation mode would be great to have.

@achikin
Copy link

achikin commented May 10, 2017

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.

@Defake
Copy link

Defake commented Jul 15, 2017

There's a growing consensus that indent mode is the only really useful mode for editing

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.

@cursive-ide
Copy link
Owner

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.

@Defake
Copy link

Defake commented Jul 16, 2017

Wew sounds great! Good luck then =)

@pangloss
Copy link

+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!

@cursive-ide
Copy link
Owner

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants