Fork me on GitHub
#chlorine-clover
<
2021-05-11
>
fabrao09:05:39

now I see there is something going to be connect! in https://github.com/mauricioszabo/atom-chlorine/issues/94 . Sorry about that

fabrao14:05:29

is 0.11.2 available?

mauricio.szabo14:05:44

Not yet, just waiting for the CI to run

fabrao14:05:30

with this, I think I can manage many repls as I want, thank you

mauricio.szabo14:05:15

yes, but you still can only be connected in one at a time, but at least it's easier to switch between them

fabrao15:05:14

is it will take too long? 🙂

mauricio.szabo15:05:27

It's published now

fabrao15:05:02

ahahahahaha, I saw it now 😱

fabrao15:05:44

I´m checking it now

fabrao15:05:00

worked !!!

fabrao15:05:08

why didn´t you expose the disconnect?

fabrao15:05:55

my happiness took only 5 minutes 😞

mauricio.szabo15:05:14

Because you can run it without needing to be exposed

mauricio.szabo15:05:17

atom.commands.dispatch(atom.views.getView(atom.workspace.getActiveTextEditor()), 'chlorine:disconnect')

mauricio.szabo15:05:43

(replace 'chlorine:disconnect' or any other command from Chlorine or any other package)

fabrao16:05:48

# This waits for the package to load
atom.packages.activatePackage('chlorine').then (pkg) ->
  # This picks up the "main module" of the package
  Cl = pkg.mainModule
  
  # Conectar sem pop-up
  atom.commands.add 'atom-text-editor', 'fabrao:connect-direct', ->
    editor = atom.workspace.getActiveTextEditor()
    atom.commands.dispatch(atom.views.getView(editor), 'chlorine:disconnect')
  	Cl.connect_socket 'localhost', 5555
What am I doing wrong?

mauricio.szabo16:05:20

What's happening, exactly? Some error, or the command does not appear on the command pallete?

fabrao16:05:03

Cl is not defined -> after evaluate , but if I run it, only disconnect, not connect

fabrao16:05:27

is it an async process?

mauricio.szabo16:05:48

BTW, I think all commands on Atom are async, so you may have to await a little bit for everything to get settled up. Maybe something like:

atom.packages.activatePackage('chlorine').then (pkg) ->
  # This picks up the "main module" of the package
  Cl = pkg.mainModule
  # Conectar sem pop-up
  atom.commands.add 'atom-text-editor', 'chlo:connect-direct', () ->
    editor = atom.workspace.getActiveTextEditor()
    atom.commands.dispatch(atom.views.getView(editor), 'chlorine:disconnect')
    setTimeout(
        -> Cl.connect_socket 'localhost', 5555
      , 200
    )

mauricio.szabo16:05:14

(I have no idea if the setTimeout syntax is right... too much time without having to handle coffeescript, thankfully)

mauricio.szabo16:05:39

Fixed the syntax

fabrao16:05:07

I was trying to fix it

fabrao16:05:46

is it worked for you?

mauricio.szabo16:05:48

Ok, did another fix on the script. the -> needs an extra space so setTimeout will undestand that 200 is the second parameter, and not part of Cl.connect

mauricio.szabo16:05:31

BTW, I highly suggest you to rename your init.coffee to init.js and use Javascript only... CoffeeScript is terrible because of these small issues

seancorfield16:05:26

I was certainly very happy to remove as much of my init.coffee as possible and switch over to the config.cljs that Chlorine uses for customization 🙂

fabrao17:05:50

is that possible to use all those scripts in config.cljs?

metehan18:05:07

hi I am "r" 🙂

👋 6
mauricio.szabo18:05:11

@fabrao not really. config.cljs is mostly a way to configure evaluations results and other things. It relies on some state that only exist when you're connected to a REPL, so that's why it's not (yet) possible 🙂

mauricio.szabo18:05:16

@m373h4n we were talking about clojerl over the meetup. I think that the latest version of Clojerl (0.7.0) have a bug on the Socket REPL implementation, so you may want to use the master branch. If you use rebar3 to start your Clojerl project there's a config to use the branch instead of the version

metehan18:05:27

thank you for the tip I'll use the master branch 🍺🙂

mauricio.szabo18:05:53

Nice, any problems ping me 🙂.

metehan18:05:49

ofc I'll 🙂 very nice beard btw I like it 😄

3