chlorine-clover

About Chlorine for Atom and Clover for VS Code: https://atom.io/packages/chlorine and https://marketplace.visualstudio.com/items?itemName=mauricioszabo.clover
seancorfield 2021-04-05T19:19:57.040900Z

@mauricio.szabo I just upgraded to the latest Clover and hoped to try out the socket file detection and got this:

seancorfield 2021-04-05T19:22:11.042600Z

dev=> (slurp ".socket-repl-port")
"5000"
So the file is in the root of where the REPL was started although I don’t know how Clover searches for the file? It’s not in the overall project root — Would it search up the tree from the file that is open when I try to connect to a REPL?

mauricio.szabo 2021-04-05T19:28:14.043600Z

Clover searches for all project directories for this file. It's strange that this < is happening tho...

seancorfield 2021-04-05T19:31:02.043900Z

What do you mean by “all project directories”?

seancorfield 2021-04-05T19:31:56.044800Z

My project is setup like this:

repo/
    clojure/
      .socket-repl-port
      subproject-a/
      subproject-b/

seancorfield 2021-04-05T19:32:24.045400Z

Source files are under subprojects. VS Code is opened at repo/. Would Clover find that file?

mauricio.szabo 2021-04-05T19:40:35.045900Z

In this case, theres' a single project directory: repo.

mauricio.szabo 2021-04-05T19:41:26.046400Z

You can add multiple directories to the workspace, and Clover will try to search all of then

seancorfield 2021-04-05T19:54:53.047Z

So Clover won’t find the file because it’s not in the (root) of the project directory?

seancorfield 2021-04-05T19:57:01.047700Z

I’ll test it some more later, but I’m also getting “Port must be a number” sometimes…

mauricio.szabo 2021-04-06T13:30:26.060300Z

Great! The are some tricks to not stop auto-detection if you don't change the port from the connection popup, so if you find that Clover keeps the old port instead of detecting a new one when you restart the REPL, please let me know 🙂

mauricio.szabo 2021-04-06T13:30:40.060500Z

(I also know that you keep REPLs open for weeks, so maybe this can be a non-issue for you 😄)

seancorfield 2021-04-06T17:10:05.060700Z

Yeah, I just saw that issue: I started a REPL, connected from Clover and it prompted with the correct port. I quit and restarted the REPL (which got a different port) and when I went to connect, Clover prompted with the old port instead of re-reading the file. I did “Reload Window” and it picked up the new port.

seancorfield 2021-04-06T17:11:00.060900Z

I’m not likely to follow that workflow: I’m much more likely to quit and restart VS Code between sessions (of work) and keep the REPL running all the time. But it may be weird/confusing for other people.

mauricio.szabo 2021-04-06T17:12:39.061100Z

On my tests, sometimes it kept the old port, sometimes it didn't. I'll revisit this code....

mauricio.szabo 2021-04-05T22:07:48.048Z

I'll check these "Port must be a number" also. See what's wrong

mauricio.szabo 2021-04-05T22:08:57.049100Z

Also, yes, Clover won't find the file. It's the same problem with an issue that exist for some time (https://github.com/mauricioszabo/atom-chlorine/issues/205), because it's hard to know where to look and how deep to go to check for the port files

seancorfield 2021-04-05T22:11:17.050200Z

Perhaps check up the tree from where the currently open file is up to the project root folder?

seancorfield 2021-04-05T22:11:26.050500Z

That seems to be what a lot of tools do. Like .gitignore and several other dot files.

mauricio.szabo 2021-04-05T22:12:07.051200Z

This can work. I'll look at this issue 🙂

seancorfield 2021-04-05T22:14:42.052300Z

Thanks @mauricio.szabo! I really like that it is defaulting to the socket I used in most of my projects now. Only my work project has .socket-repl-port at the “wrong” level and that’s because our repo has a clojure tree and a build tree…

seancorfield 2021-04-05T22:15:13.053Z

(for now I put a symlink from <repo>/clojure/.socket-repl-port to <repo>/.socket-repl-port so it “works”)

seancorfield 2021-04-05T22:16:10.053900Z

I’ve recently changed my dev setup so I use port zero which opens a socket REPL on a random available port, and now Clover reads the file, so I don’t have to remember which port it chose! 🙂

💯 1
mauricio.szabo 2021-04-05T22:18:26.054300Z

BTW, what's not to love about vscode right? Version 1.51.1-1605051630

mauricio.szabo 2021-04-05T22:18:39.054700Z

Version 1.55.0-1617120720

2
mauricio.szabo 2021-04-05T22:40:52.055200Z

Well, reported the bug 😄 https://github.com/microsoft/vscode/issues/120593

2021-04-05T22:55:11.055700Z

Wow, thank you so much. I was wondering how to open multiple connections without having to keep track of the open ports. Didn’t know about the 0 trick.

seancorfield 2021-04-05T23:07:04.056300Z

I have SOCKET_REPL_PORT=0 in my .profile 🙂

seancorfield 2021-04-05T23:08:31.056500Z

I start a REPL like this:

(! 1004)-> clojure -M:rebel:reveal:test:dev:dev/repl
Downloading: vlaaad/reveal/maven-metadata.xml from clojars
Downloading: com/bhauman/rebel-readline/maven-metadata.xml from clojars
Downloading: vlaaad/reveal/1.3.199/reveal-1.3.199.pom from clojars
Downloading: vlaaad/reveal/1.3.199/reveal-1.3.199.jar from clojars
Selected port 55961 for the Socket REPL...
Starting Reveal+Rebel Readline as the REPL...
Clojure 1.10.3
dev=> 

2021-04-05T23:11:57.057Z

The thing is that I mostly deal with lein projects - but yeah, I’m doing something kinda equivalent, just adding this JVM option to my lein profile. But good to know.

seancorfield 2021-04-05T23:26:07.057200Z

Ah, we haven’t used lein at work for years…

👍 1