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
onetom 2020-04-18T06:49:37.252600Z

@ahmed1hsn @mauricio.szabo i can highly recommend using https://www.zerotier.com/ to access REPLs running on non-transient infrastructure, eg on office machines. for example i have beefy dev machine (8cores i9, 80GB RAM) in an office on a gigabit internet connection and running zerotier. i have this nREPL config:

% cat .nrepl.edn
{:bind "0.0.0.0" :port 5555}
so anyone in the office can connect to my REPL. i run zerotier on my home dev machines, which places them virtually onto the office network. this way i can just ssh or connect with an nrepl client to my machine with: ssh -A -t my-office-machine.local or lein repl --connect my-office-machine.local:5555 the cool thing about this is that these commands work regardless being physically on the office network or elsewhere, because these *.local hostnames are resolved via multi-cast DNS, which is enabled by default on macOS and zerotier does not disrupt this protocol! u might need to wait a minute though before it starts to work after changing your internet connection, but sudo pkill mDNSResponder might speed it up. on linux u need some avahi daemon for mdns to work. i only set it up under nixos and iirc i had to change some of the default options to make sure that the hostname is discoverable.

👍 1
onetom 2020-04-18T06:55:10.257800Z

now since im using the cursive / remote repl / nrepl run configurations to connect to my office repl, when i do a load file (cmd-shift-l) or sync changed files (cmd-shift-m), it seems to use the files on my my nrepl-client machine, so it works as i expected it. i was a bit surprised to see that chlorine is actually reading files from the filesystem of the nrepl-server. it doesn't seem to be a very useful feature to me. i've used this setup just by myself alone, so i guess a collaborative use of 1 repl process might cause a lot of tricky issues. still, during the current pandemic, when many of us are recommended to work from home, it's good to know how to have such a convenient setup

mauricio.szabo 2020-04-19T20:51:15.259100Z

By the way, I forgot to ask: how do you think we could change this behavior? How to make it better to work in a remote environment, considering you're editing the code locally and sending it to another server? 🙂

onetom 2020-04-25T06:37:08.306500Z

The way - as I described above - how Cursive works makes sense to me at the moment, BUT I'm not confident that my workflow is a good approach, so I would rather not propose any change, but revise my workflow instead and use either individual form evaluations, or I can just always Select All, then eval. It results in some extra output (like the names of vars being defined) on the REPL, but I don't mind that too much. What's more concerning is that certain editors - including Atom - forgets the current cursor position when I do a Select All operation, so I can't just press Esc afterwards...

mauricio.szabo 2020-04-25T17:23:12.306700Z

It is quite simple to add a "Send editor contents to REPL" with custom commands, to be honest...

mauricio.szabo 2020-04-25T17:28:42.306900Z

Here's the full documentation: https://github.com/mauricioszabo/atom-chlorine/blob/master/docs/extending.md On init.js, you could for example add the following snippet:

atom.packages.activatePackage('chlorine').then(package => {
  const pkg = package.mainModule
  atom.commands.add('atom-text-editor', 'chlorine:send-editor-contents-to-repl', () => {
    const txt = atom.workspace.getActiveTextEditor.getText()
    pkg.ext.evaluate_and_present(txt, pkg.ext.get_block().range)
  })
})

👍 1
mauricio.szabo 2020-04-18T18:35:29.258600Z

Well, Load file just uses the built-in function (load-file ...) of Clojure, so that's the reason is reading from the filesystem the current REPL is running

👍 1