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

Integrate parinfer functionality #1155

Closed
extesy opened this issue Nov 11, 2015 · 56 comments
Closed

Integrate parinfer functionality #1155

extesy opened this issue Nov 11, 2015 · 56 comments
Labels
released Marks issues which have had the fixes released in a stable build
Milestone

Comments

@extesy
Copy link

extesy commented Nov 11, 2015

Take a look at examples on https://shaunlebron.github.io/parinfer/index.html - this is pure magic. I really would like cursive to be able to do that.

@aadrian
Copy link

aadrian commented Nov 11, 2015

+1
even the docs are great :).

IMHO this should be the default edit mode for Cursive, since it's much more efficient for new users.

@cursive-ide
Copy link
Owner

Yes, this looks very nice indeed.

@wilkerlucio
Copy link

Interesting, I would like to see that landing on Cursive at some point.

@jhalterman
Copy link

👍 👍 👍 👍 👍

I agree with @extesy this is magic. Getting basic paredit without having to use hotkeys is just great

@mking
Copy link

mking commented Nov 17, 2015

👍 This would be great to have as an option. One of the things I like about Cursive is that the learning curve isn't too steep (unlike, say, Emacs), and I think this would be an improvement in that direction.

@yusefnapora
Copy link

👍

I'd love to have parinfer available in Cursive. Using it in Atom actually makes me feel like I'm better at writing clojure, since the bit of "syntactic friction" is removed & I'm not dragged out of my mental model of the code by formatting concerns. It's not enough to make me pick Atom over Cursive, but it's the one thing I miss.

Just wanted to point out that the "official" parinfer implementation was just split out into a standalone library, with the codemirror stuff in a separate namespace. So that should make it simpler to integrate if you're planning to use the reference implementation. I'm not sure how nicely that would play with the existing structural editing in Cursive, but if you want to treat them as separate mutually exclusive modes, you could probably use the reference implementation and just let it operate on the raw text of the document.

@simax
Copy link

simax commented Nov 26, 2015

I too would really love to see parinfer in Cursive. 👍 👍 👍 👍 👍 👍

@pbaille
Copy link

pbaille commented Dec 1, 2015

👍

3 similar comments
@alphaone
Copy link

alphaone commented Dec 1, 2015

👍

@squest
Copy link

squest commented Dec 2, 2015

👍

@d-r
Copy link

d-r commented Dec 4, 2015

👍

@vincent-dm
Copy link

+1 (since I hate working in Atom but like Parinfer's mode better than the existing one in Cursive).

Ideally the REPL input would also use it...

@qwtel
Copy link

qwtel commented Dec 7, 2015

Hard to switch back after getting used to it in atom.

@NeCkEr
Copy link

NeCkEr commented Dec 7, 2015

+1

@CmdrDats
Copy link

👍 definitely would love to see this integrated!

@erichmond
Copy link

👍 Would be great

@SerCeMan
Copy link

👍

@damassi
Copy link

damassi commented Dec 24, 2015

@shaunlebron and @oakmac - I'm sure you're both already aware of this issue but wanted to ping you just in case. What an awesome combo this would be.

@shaunlebron
Copy link

I want to mention a few recent developments that may make integration easier:

  • parinfer is now a single, imperative JS file (see parinfer.js), which should be much simpler to port to Java for use in Cursive
  • test code is very short since the test cases are represented in json, so it should be easy to test/verify a Java port
  • benchmarks show that our new imperative implementation can parse about ~50 lines/ms on Node, so performance may be similar on the JVM.

@cursive-ide
Copy link
Owner

Thanks @shaunlebron, that's very helpful. I'll take a look at the JS implementation - I'll probably have to modify it a bit to work in Cursive since Cursive already has its own lexer but it'll be a good base to start from.

@avocade
Copy link

avocade commented Dec 26, 2015

+1

1 similar comment
@dhruvbhatia
Copy link

👍

@ghost
Copy link

ghost commented Jan 3, 2016

Want :D 👍

@joshhill
Copy link

joshhill commented Jan 5, 2016

+1

2 similar comments
@colinyip
Copy link

colinyip commented Jan 5, 2016

+1

@akovantsev
Copy link

👍

@dl1ely
Copy link

dl1ely commented Jan 7, 2016

The only thing that keeps me on Atom. Please make it happen in Cursive!

@yeonsh
Copy link

yeonsh commented Jan 31, 2016

👍

@oakmac
Copy link

oakmac commented Feb 2, 2016

Hi folks :)

I just wrote a JVM port of Parinfer. Should help make this task much easier.

@tuhlmann
Copy link

tuhlmann commented Feb 5, 2016

👍

@damassi
Copy link

damassi commented Feb 5, 2016

@cursive-ide - do you have any plans on integrating this in? Or is it still in the "nice-to-have" category? I know there are a lot of +1's here, but Parinfer is really a delight to work with and I feel will help advance the adoption of Clojure quite significantly if fully appreciated.

@cursive-ide
Copy link
Owner

@damassi Yes, I'm actually working on this now but it's a little tricky to integrate into IntelliJ. It should be in the next release.

@damassi
Copy link

damassi commented Feb 6, 2016

Incredible. Thanks so much @cursive-ide, @oakmac and @shaunlebron!

@lucian303
Copy link

👍

1 similar comment
@vincentjames501
Copy link

+1

@neverfox
Copy link

Oh wow, this is the best news.

@vincent-dm
Copy link

@cursive-ide any idea when the next release will be?

@cursive-ide
Copy link
Owner

@vincent-dm Hopefully within a week or so, it's been trickier than I expected.

@cursive-ide cursive-ide added this to the 1.1.1 milestone Mar 7, 2016
@extesy
Copy link
Author

extesy commented Mar 20, 2016

@cursive-ide Parinfer integration looks great, thanks for adding it! I see that you have not included paren mode, but I found it useful for preserving identation like in the 5th example on https://shaunlebron.github.io/parinfer/ page. Could you please add an exception for at least that one case?

@cursive-ide
Copy link
Owner

@extesy Yes, I'm going to try to make an indentation preserving mode which will work in both paredit mode and with structural editing totally off.

@johanhaleby
Copy link

Do you have to enable parinfer in Cursive in any other way than just switching it on here:

image

I don't notice any difference to "off"? How can I check if it's working? I've seen the animations on parinfer's website but Cursive doesn't behave like that? For example the "Preserve indentation" example doesn't work for me.

@cursive-ide
Copy link
Owner

No, that should be it, although a few people have reported having to toggle it twice for some reason.

Note that Cursive only implements indent mode, not paren mode (which maintains indentation). So as you indent and dedent code, you should see the parentheses being moved around. See the first example here: http://shaunlebron.github.io/parinfer/

@ghost
Copy link

ghost commented Mar 21, 2016

Doesn't work for me as well.
It does the initial indentation, but then behaves just like no structural editing.

Indentation doesn't cause parenthesis to move,
and deletion takes the content after the caret to the line above once one deletes past the recommended indentation point.

On 21 Mar 2016, at 10:02, Colin Fleming [email protected] wrote:

No, that should be it, although a few people have reported having to toggle it twice for some reason.

Note that Cursive only implements indent mode, not paren mode (which maintains indentation). So as you indent and dedent code, you should see the parentheses being moved around. See the first example here: http://shaunlebron.github.io/parinfer/ http://shaunlebron.github.io/parinfer/

You are receiving this because you commented.
Reply to this email directly or view it on GitHub #1155 (comment)

@pbaille
Copy link

pbaille commented Mar 21, 2016

👍

@cursive-ide
Copy link
Owner

@johanhaleby @j-pb I've just found a bug where parinfer doesn't work correctly in the REPL editor. Were you trying to use it in the REPL editor when it didn't work?

@cursive-ide
Copy link
Owner

Actually, I have found at least one case where parinfer broke existing code (shaunlebron/parinfer#106). In this case, parinfer appeared to do nothing because Cursive is not correctly reporting the parinfer error cases. I'll fix that so at least it's obvious why things aren't working.

@johanhaleby
Copy link

I think my REPL was open when I switched to parinfer but I haven't tried using it in the REPL.

@pbaille
Copy link

pbaille commented Mar 22, 2016

@cursive-ide just to know, have you planed to implement paren mode in the future?

@ghost
Copy link

ghost commented Mar 22, 2016

No. Just the plain editor.

cheers Jan

On 22 Mar 2016, at 04:36, Colin Fleming [email protected] wrote:

@johanhaleby @j-pb I've just found a bug where parinfer doesn't work correctly in the REPL editor. Were you trying to use it in the REPL editor when it didn't work?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@cursive-ide
Copy link
Owner

@pbaille I hadn't, since I believed that indent mode is the only useful mode for actually editing - paren mode is still used internally. However there's some doubt about this now, and in fact there's some doubt about it in general (see here for an example).

For non-indent mode editing modes (paredit, and no structural editing at all), I'm planning to implement a paren-mode lite which will maintain indentation as well as it can. I believe this is the main benefit of paren mode.

@neverfox
Copy link

neverfox commented Mar 23, 2016

Yes, paren is an essential part of parinfer usability from what I can tell. With just indent mode you end up in trouble in fairly common cases:

Indent mode

|(d/q '[:find ?e
        :where [?e ?a ?v]]
      db)

Now start trying to wrap in a (take n coll):

(take 5 (d/q '[:find ?e])
        :where [?e ?a ?v]
      db)

To fix this, you'd have to adjust the indentation on all the subsequent lines manually so that indent mode will kick in (and auto-format isn't going to do the right thing because it can't know what you really want).

@patrickmesana
Copy link

+1

@theronic
Copy link

How to use indent mode in Cursive?

@achikin
Copy link

achikin commented Sep 18, 2016

@pate I came here with the same question. Looks like Cursive only implements indent mode, so switching Structural style to 'Parinfier' gives you intent mode.

@binarykitchen
Copy link

@cursive-ide is there a github ticket for the lite paren-mode? keen to subscribe to it ...

@Cka3
Copy link

Cka3 commented Mar 11, 2017

@binarykitchen #1303

@cursive-ide cursive-ide added the released Marks issues which have had the fixes released in a stable build label Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Marks issues which have had the fixes released in a stable build
Projects
None yet
Development

No branches or pull requests