Fork me on GitHub

Not really, there's an open issue for that... but I still didn't find a way to make it work reliably (one of the problems is that Atom only start up the package when you issue a command, or you can make the package start together with Atom, which is not ideal because makes startup slower)


Can´t I create some atom.commands.add 'atom-text-editor', 'fabrao:start-repl', -> and interact with Chlorine? Like starting the repl connection?


Yes, you can create a command on (or init.js). But then you'll have to run a Chlorine command - and that's not possible (yet?) because there's no way to run a command in a package that's no loaded. And the way to load Chlorine today is to run Connect Socket REPL command.


But, maybe there's a way. I just need to think a little bit on how to run this command and somehow pass a parameter to it


can´t you use Cl.ext.evaluate_and_present ?


with something like chlorine:connect-socket-repl?


Tangentially related beginners question - why can’t I use Chlorine commands without being connected? Seems like go to definition and things could work... ? 🙂


Not really, @mattias504, all commands use the REPL in some way or the other


Go to definition, for example, gets the meta, pick up the filename / row from there, and sometimes searches the files on the java classpath to get the full filename + directory


Ok, makes sense! Just my limited understanding playing tricks. Thanks!


I'm studying some syntax analysis to go with Chlorine. The hard part is that I'm aiming for a "no external dependencies" approach. I've tried to port clojure-lsp to ClojureScript and use it internally, but it's quite hard. Tried other approaches like clindex, but it also depends on the JVM. Both of these libraries can be slow (the first time they run) and memory-hungry, so by porting to ClojureScript will make it even slower 😞


(and it can also make Atom slow because JS runtime is single-threaded, so that's another problem too 😅)


@mattias504 Cursive (for IntelliJ) is the only Clojure editor that can do much without a REPL because it has a whole static analysis engine built-in -- but that's a lot of work since it has to duplicate a lot of what Clojure itself does to parse and figure out definitions etc. Clojure development is inherently REPL-driven so having a REPL should always be a given (I usually have two REPLs running -- one for my main work and one for "scratch" stuff such as helping beginners -- and my REPLs run for days, sometimes even weeks).


Thanks for the thoughtful explanations. I wanted to, but haven’t taken the time to dive into how the repl thing actually works behind the pretty slick scene 😀


I just start a REPL from the command-line, with an alias to start a Socket REPL. No magic. That could be just clj -A:test:socket with the right alias (from my dot-clojure repo). Then connect Chlorine to localhost/`50505` (the port is hardcoded in the alias in deps.edn). Everything is just code evaluation from that point on.


Clojure's REPL has everything needed for loading/finding definitions, getting completions, etc. Some editor integrations just build some smarts over the top of that.


@seancorfield I created this

atom.commands.add 'atom-text-editor', 'fabrao:run-selection', ->
  editor = atom.workspace.getActiveTextEditor()
  caminhoArquivo = editor.getPath()
  texto = editor.getLastSelection().getText()
  projetos = atom.project.rootDirectories.filter (projeto) -> caminhoArquivo.indexOf(projeto.realPath) isnt -1
  if projetos.length
    comando_executar = '"cd ' + projetos[0].realPath + " ; " + texto
    spawn("powershell.exe", ["-Command", comando_executar], {shell: true, detached: true})
    alert("Clojure Project not found")
and bind it to F8


and if I want to run clj -A:dev, I select it and press F8