Elixir support?
https://hexdocs.pm/elixir/introduction.html#interactive-mode
I'm fiddling with this now (if im honest i vibed it out) and I'm trying to debug it.
It's launching but I'm getting no output so any help would be greatly appreciated of course!
Some suggestions:
- Rename
iex.fnltostdio.fnl.- The naming convention for client modules appears to be
conjure.client.<language>.<transport>. - For example, the Python client uses
stdiofor its transport so its module isconjure.client.python.stdio. - The configuration items for this client are prefixed with
g:conjure#client#python#stdio(vimscript). - I don't think that this is the reason that you are having trouble getting your code working.
- The naming convention for client modules appears to be
- As a first pass, leave out the
Mixproject use case for starting the Elixir REPL (iex).- It seems that the
Mixproject use case can probably be addressed by changing theg:conjure#client#elixir#stdio#commandconfiguration from "iex" to "iex -S mix". I don't use Elixir but have read https://hexdocs.pm/elixir/introduction-to-mix.html.
- It seems that the
- Create a
dev/elixir/sandbox.exsthat includes sample Elixir code that someone might typically want to work with.- This provides a baseline set of Elixir code that anyone could evaluate and get a sense of how well the Elixir client would work for them.
- It is not a test suite but a simple and easy way to tell if things are working well enough.
In fnl/conjure/client/elixir/iex.fnl, this line:
:prompt_pattern "iex(%d+)> "
should be:
:prompt_pattern "iex%(%d+%)> "
The prompt_pattern of the client config is a Lua pattern. So, to get a "(", you need to use "%(". Similarly, to get a ")", you need to use a "%)".
Unfortunately, this little change is not enough to make your client work. You'll also need to fix format-msg.
I tried evaluating some of the examples from:
- https://hexdocs.pm/elixir/basic-types.html
- https://hexdocs.pm/elixir/lists-and-tuples.html
- https://hexdocs.pm/elixir/case-cond-and-if.html
I think some tweaking needs to be done so that error messages are returned without the prompt and the prompt for more is not shown when evaluating multi-line code fragments.
Using your conjure.client.elixir.iex module, I created a conjure.client.elixir.stdio module using the conjure.client.scheme.stdio client as a base. It also worked once the :prompt_pattern was set correctly. But the error messages and return values need tweaking so that the results more closely mirror the examples from the Elixir docs.
You have a good start for an Elixir client. The format-msg function needs some work for things to start working.
Wow thanks a ton, sorry was on a plane flying back home to Tokyo when you commented these.
D'oh that is a dumb error! This is our future in a nutshell: people writing languages they dont know well (for me fnl right now) and making small mistakes like this.
Let me see if I can do this tweaking
As far as mix projects, this is the vast majority of use cases so I think it is easier to keep the check in rather than have any user have to configure that and add a .exrc
@russtoku Just pushed a change with your suggested fixes but I didn't have as much luck as you
As far as mix projects, this is the vast majority of use cases so I think it is easier to keep the check in rather than have any user have to configure that and add a .exrc
Sorry, I'm not an Elixir user. That's good to know.
Thanks again for taking a look, im around but working on some other stuff so I'll get back to it, but if you have any other input just let me know :)
I put up my working client at https://github.com/russtoku/conjure/tree/add-elixir-client. I've included a sandbox.ex file that should be able to be evaluated in the client and produce return values that match what's commented in the file. <localleader>ee (evaluate current form), <localleader>er (evaluate root form), and <localleader>E (evaluate selection or motion) should work on the Elixir examples in sandbox.ex. For the most part, <localleader>ee should work on most of them.
Because I started with the Scheme client, my code differs from your in some ways that I couldn't easily point out why mine works. But I've included a few pieces of your code. Please have a look when you get a chance. I'm not saying mine is better but I tried to get it work closely to what it's like in the interactive iex REPL. Feel free to use whatever make sense to you.
I've moved my add-elixir-client branch to a separate repo. It's now in https://github.com/russtoku/conjurex. The README there tells how to use it.
@aliresool621 and any Elixir fans,
Would you folks be able to try things out using my repo?