sigmaSd / IRust

Cross Platform Rust Repl

Home Page:https://crates.io/crates/irust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a warning about optional dependecies

sigmaSd opened this issue · comments

IRust when used the first time, should check if rustfmt cargo-edit racer and feature optional dependencies and issue a one time warning about them being missing

In order to implement this, we may need to use a config file (which is probably fine since we may want to add extra config options in the future anyway). One question: is rustfmt used within IRust itself (i.e. to format the user’s REPL code)? Reason I ask is because we shouldn’t need to check for it if it’s only used when we format IRust’s code, but I don’t know if IRust itself uses it.

Also, @sigmaSd your link to cargo-edit doesn’t go to the cargo-edit page for me ATM.

@smolck we already have a configuration file! (just read the README :P )
Yes cargo fmt is used to beautify the code outputed with :show
will edit the link, good catch!

@smolck we already have a configuration file! (just read the README :P )

I really should check these things 🤣

Now that I know that, I think we just need to insert a check (in main.rs or such) for a certain option in the config file that lets us know if we’ve shown the warning (it doesn’t necessarily need to be a new option: just one that wouldn’t be there at first, but that would appear after the first time starting IRust). If the option isn’t there, show the warning: if it is there, don’t.

We can as you suggested add an option "show optional dependencies warning" = false, to do that we need to modify 2 places ( I think):

1 - add the option to Options struct https://github.com/sigmaSd/IRust/blob/master/src/irust/options.rs#L8
2 - parse it with the Options parser https://github.com/sigmaSd/IRust/blob/master/src/irust/options/parser.rs
3 - check for the option at start https://github.com/sigmaSd/IRust/blob/master/src/irust.rs#L90 and respond correctly
4 - at exit make the option true

(that's more than 2 I guess)

Fixed in 8e43fdb