michaelb / sniprun

A neovim plugin to run lines/blocs of code (independently of the rest of the file), supporting multiples languages
MIT License
1.43k stars 46 forks source link

(no output) for elixir file #288

Closed cassepipe closed 2 months ago

cassepipe commented 2 months ago

Trying to evaluate a line in a elixir (.ex or .exs) file shows (no output)

echo "x = 42" > file.ex1
lvim -c "normal V" -c ":SnipRun" file.ex 

I expected a 42 as iex would output

The plugin is functional and has the expected behaviour for a python file

LunarVim 1.4 Fedora 40

michaelb commented 2 months ago

iex is the REPL interpreter for Elixir right ? Sniprun uses iex when the REPL mode is enabled in for elixir ( repl_enable = {"Elixir_original"} ), in which case your example does output 42.

Otherwise, sniprun uses elixir under the hood, which doesn't outputs 42 when it runs a file containing the shown code..

Python may behave differently ofc (printing on stdout the result of the last assignment is a choice made by the interpreter's authors, not me)

cassepipe commented 2 months ago

Haaa it all makes sense now. I expected iex to be the default.

Also I probably read the documentation poorly because I have tried repl_enable = {"iex"} and repl_enable = {"elixir"}

Thanks for taking the time to reply. (And for crafting this plugin)