conjure icon indicating copy to clipboard operation
conjure copied to clipboard

Add deps rust

Open DieracDelta opened this issue 1 year ago • 3 comments

Is there a way to add deps for evcxr? Essentially use the :deps command on the current root Cargo.toml would be incredibly useful since it would allow for more complete evaluation. Something like :deps {path = $PWD} or something similar. This would allow actually evaluating of functions from the crate (though refreshing would presumably need to happen often to reflect code changes...).

On a related note, is there a way to directly drop into the evcxr repl from neovim? This would let me run :dep ... so I can evaluate pieces of code from the crate I'm working with.

(Really cool project BTW! I think this could be super useful when doing rust dev)

DieracDelta avatar Aug 29 '22 01:08 DieracDelta

I'm afraid I'm not sure, I didn't write this client and I know nothing about the toolchain other than some Rust basics.

Are these command line arguments? Because I'm sure the config that points to the binary could support that. Either with minimal changes or it may already work.

I'm kinda surprised this Rust REPL doesn't already pick up on your projects dependencies? That seems like a very core feature of a REPL to me. Are you starting the REPL from within your project directory?

And as far as dropping into the REPL goes, no, not right now. The processes Conjure starts for the simple stdio based systems (like this one) are headless. The only frontend is the log buffer. That may change in my future iteration of stdio support, so I'll keep this in mind.

Olical avatar Aug 29 '22 10:08 Olical

@rafaeldelboni do you think this would be possible? Not asking you to do it of course, just interested in your opinion 🙂

Olical avatar Aug 31 '22 18:08 Olical

Evcxr has some "limitations" because it's main mind set is to work more like a Jupyter Notebook instead of a project mind set, so I don't think currently it has a way to read the Cargo.toml, that would be a nice feature we could ask to the reply developer.

Issues like this one made me see this: https://github.com/google/evcxr/issues/70

But what you could do is open a conjure buffer in your nvim session <local leader> l v for example and write a new line on it like :dep rand = { version = "0.7.3" } and evaluate the line or select it and evaluate the selection.

You could even write the above in any file and evaluate the line, like I did in this playground: https://github.com/Olical/conjure/blob/master/dev/rust/sandbox.rs You just need to uncomment the :dep before evaluation.

rafaeldelboni avatar Aug 31 '22 18:08 rafaeldelboni