protorepl

puzzler 2016-12-11T04:53:50.000250Z

I have two subdirectories under the src directory: MyProject/src/MyProject and MyProject/src/utils and the utils one isn't getting picked up. I am using lein, and it says it is using lein from the correct directory which stores the project.clj file (the top MyProject directory). It works fine from a manually-launched lein repl, but not from atom.

martinklepsch 2016-12-11T10:30:02.000251Z

So I just closed the Clojure REPL window and now I'm wondering how I can get it back 😄 toggling it brings up a new window but it doesn't have the same "state" as in no previous evaluations and no connection

martinklepsch 2016-12-11T10:30:41.000252Z

(I started an nREPL port manually and connected to it if that matters)

martinklepsch 2016-12-11T10:31:53.000253Z

Also one general concern: when connecting to a REPL proto repl reloads and potentially loads namespaces that I haven't loaded but that are on the classpath. In this case it tried to load+run my migrations which failed because the DB wasn't running.

martinklepsch 2016-12-11T10:33:49.000254Z

This problem has occurred in another project I'm involved with as well where it was solved like this: https://github.com/hashobject/perun/pull/104/commits/4251802e36c720a2680d298f2789b0d2744a51c0 (if you should consider changing that behavior)

jasongilman 2016-12-11T10:35:07.000256Z

You can disable the automatic refresh when the REPL starts in the settings.

jasongilman 2016-12-11T10:35:51.000257Z

For the time being when you close the REPL it closes the connection.

martinklepsch 2016-12-11T10:35:57.000258Z

@jasongilman ah that's cool. Still changing the default to only refresh already loaded namespaces seems sensible to me.

martinklepsch 2016-12-11T10:36:08.000259Z

@jasongilman ok, thanks

jasongilman 2016-12-11T10:36:29.000260Z

Yeah I didn't know you could do that.

jasongilman 2016-12-11T10:36:54.000261Z

Is that something that could be manually setup in user.clj?

martinklepsch 2016-12-11T10:37:11.000262Z

Really excited to see Atom getting better and better. Tried it again and again and really wanted to use it but the indentation issue just was a blocker.

martinklepsch 2016-12-11T10:37:46.000263Z

@jasongilman the refresh logic?

jasongilman 2016-12-11T10:38:12.000264Z

yes

jasongilman 2016-12-11T10:38:48.000265Z

@martinklepsch: Did you get past your indentation issues?

martinklepsch 2016-12-11T10:39:12.000266Z

@jasongilman yeah, with the help of your Atom setup Gist. Using the paredit thing now.

jasongilman 2016-12-11T10:39:36.000267Z

Cool, I'll be back later. I have to head out.

martinklepsch 2016-12-11T10:45:11.000268Z

Sure, thanks!

martinklepsch 2016-12-11T10:45:21.000269Z

Btw, this loading indicator when evaluating stuff that takes longer is super cool 👍

jasongilman 2016-12-11T11:28:58.000270Z

I like that too. That's a feature from contributor @carocad

denik 2016-12-11T17:05:20.000272Z

I have an atom noobie question: I’ve tried finding project that use atom (electron) to run web apps inside atom. Like a browser tab. I’m interested in this for the same statement @jasongilman made at the conj: separation between program development and output is undesirable. Especially devtools seem to be in the wrong app (the browser) instead of the editor. And why the divide, anyway? Devtools should be in your editor, you want the debugger in your editor, you want to see breakpoints there, and the program output. And it seems that electron should be able to do all of that?

denik 2016-12-11T17:12:26.000273Z

And what about inline devcards?

lspector 2016-12-11T17:45:13.000275Z

@puzzler: you asked "Have you tried leaving parinfer in paren mode?"... but I don't know what that means or how to do it. Perhaps you could spell it out?

cjmurphy 2016-12-11T17:58:41.000276Z

I'm trying to get a lein repl going for an existing project. I've discovered developer mode and setting a project directory. My project has the proto-repl dependency. I find if the project.clj is the current file I can get a local repl going (rather than the default one). I'm getting the message Starting REPL with lein in /home/chris/IdeaProjects/advent-of-code. In this advent-of-code directory there is a user.clj file. Perhaps that's the wrong place for it, because as the repl is starting up it gives an error with the cause 'Could not locate user__init.class or user.clj on classpath'. This setup worked with IDEA. I'll experiment with the project directory now...

cjmurphy 2016-12-11T18:25:56.000277Z

Stuck - tried putting user.clj in various places to no avail. Even changed permissions to 777 just in case that's the reason this file can't be found.

cjmurphy 2016-12-11T18:39:10.000278Z

I fixed the problem. Noticed that project.clj has :source-paths ["dev/server"]. So I put user.clj in there. It seems that somehow IDEA was less strict about this.

robert-stuttaford 2016-12-11T18:46:26.000279Z

try simply :source-paths [”dev”] @cjmurphy

cjmurphy 2016-12-11T18:47:48.000280Z

thanks, will do :simple_smile:

puzzler 2016-12-11T20:08:49.000281Z

@lspector Parinfer has two modes, "Indent mode" and "Paren mode". In ProtoREPL, you can toggle by clicking on the place where it displays the mode at the bottom. I'm not sure how you'd toggle in Nightcode, but there is likely a way to do it. In any case, indent mode is probably the mode that annoys you, in which it tries to infer the parens from the indenting. If you toggle over to the other mode, it lets you do whatever you want with the parens and adjusts the indenting to match the parens, which is likely what you want.

jasongilman 2016-12-11T20:23:06.000282Z

It takes a while to get used to it but I like indent mode for most work and switching to paren mode when pasting in code. There are keybindings you can see in the Parinfer package settings

lspector 2016-12-11T20:43:55.000283Z

@puzzler: Ah! What I had been missing was even simpler but that led me to it -- I was in Plain Text mode and had to switch to Clojure by clicking on the mode in the lower right corner. I just hadn't noticed that. Now command-shift-i re-indents, which is exactly what I wanted. So that's great. FWIW I definitely don't want what you're calling "indent mode," which I think of as "parinfer," and I also don't want what I've seen called "strict paredit mode," where it prevents you from adding/deleting brackets in some places. I assume the "strict" switch in the mode line is about the latter, and is the lambda switch about the former? In any event, I find that I generally get what I consider reasonable behavior with the lambda lit up and the "strict" not lit up... which is good, but I also find that when I play with these and also type (including mismatched brackets) I get

Uncaught TypeError: Cannot read property 'start' of undefined
/Users/leespector/.atom/init.coffee:57
Show Stack Trace
This is likely a bug in Atom. You can help by creating an issue. Please explain what actions triggered this error.

lspector 2016-12-11T20:51:51.000286Z

If I type (de I get a popup offering completion of def and defn. Nice. But if I select defn, for example, it does't just autocomplete to defn, if inserts a template for an entire definition. In addition, it puts this definition in an extra set of parentheses, giving:

((defn name
  [params]
  body))
Is this intentional? Typing (co and autocompleting conj works as I'd expect, but (if does the same nested template thing as (defn. I see a mix of these behaviors with other things I try, and nothing at all for some core functions like filter.