reddit / emacs

rustic 3.3: new command that looks up missing dependencies and adds them to Cargo.toml

brotzeitmacher · 2022-08-18 11:49
thevoidzero · 2022-08-18 15:41
So I can just `use` something and I don't need to edit toml? That'd be ideal for small projects
brotzeitmacher · 2022-08-19 10:05
Exactly, but the command relies on lsp.
thevoidzero · 2022-08-19 13:25
I'm already using lsp so it's fine. Is there a way to make it a variable which if true it'll be added automatically? I think lsp in C adds headers automatically when you use a function from un-included libraries.
brotzeitmacher · 2022-08-19 13:50
We would have to check if there are unresolved import errors. When would you want this to happen automatically, when saving ? I think it would be too much to perform this check on every change in the buffer.
thevoidzero · 2022-08-19 13:55
Ideally when you do `use <something>;` just on that line. I think. Can't currently remember how lsp provides completions on use. But if we can modify it, the completions could be made with already available crates on top and also crates that can be added to Toml so if they're chosen it activates the add to toml function. Might have to use/update a list of available crates from cargo locally for that though.
brotzeitmacher · 2022-08-19 13:59
Can you please open an issue with your thoughts.
thevoidzero · 2022-08-19 14:01
Will do. Thank you for listening.
brotzeitmacher · 2022-08-20 17:04
In case somebody else is interested in adding missing crates automatically https://github.com/brotzeit/rustic/pull/429