Skip to content
This repository has been archived by the owner on Apr 24, 2021. It is now read-only.

Can't enter newline in REPL #213

Open
esuomi opened this issue Jan 16, 2017 · 1 comment
Open

Can't enter newline in REPL #213

esuomi opened this issue Jan 16, 2017 · 1 comment

Comments

@esuomi
Copy link

esuomi commented Jan 16, 2017

If I type the following to REPL within Nightcode:

(loop [x 0

This gets autocompleted to

(loop [x 0])

This is good. However if I place my caret as indicated by pipe:

(loop [x 0|])

and hit enter, the expression is evaluated as it's already a full expression. This is bad.

The full snippet I have is simply

(loop [x 0]
  (println x)
  (if (< x 3)
    (recur (inc x))))

which is rather obvious on what it does but with the autocompletion I am unable to type it to REPL within Nightcode. Major difference of course is that in REPL the (println x) actually produces visible output while InstREPL doesn't as it only shows the return value, nil in this case.

As suggestions for fixing this, I'd like to

  1. be able to disable the autocompletion for REPL or
  2. let that caret positioning be indication that I want a newline instead or
  3. push this request to Leiningen developers so that they could actually implement this as REPL option for us weirdos who like to format their REPL throwaway snippets :)
@joinr
Copy link

joinr commented Sep 14, 2017

Since I'm digging into NC for an embedded swing repl (older 1.3.2 version, but may still apply to 2+), I ran into this same usability issue. I'm a "weirdo" who typically copy-and-pastes from buffer to repl (even in emacs gasp). It's just hardwired into me....instead of using shortcuts and the like.

When I went to extend the embedded repl-interaction capabilities for nightclub [not using lein], I ran into a similar usability issue. Parinfer is cool, but it gets in the way at times, particularly when copying and pasting multi-line declarations. Case in point: a multi-line NS declaration gets inferred (at least in the version of parinfer I'm using) to be multiple independent forms. As a quick workaround, I hacked the default paste behavior and added some supplemental state to detect if we're pasting. The user has the ability to toggle on/of parinfer globally, and [soon] to copy/paste literally. This seems to balance out the best of both worlds: inference when I want it, literal multi-line forms when I'm copying / pasting, and the ability to gank parinfer totally if it's getting in the way. Perhaps it's something NC master can look at....

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

No branches or pull requests

2 participants