feat: add proc-macro rebuild on save option
Signed-off-by: ClSlaid <cailue@bupt.edu.cn>
This commit is contained in:
parent
e402c494b7
commit
b21d68cd2a
@ -105,6 +105,9 @@ config_data! {
|
||||
/// ```
|
||||
/// .
|
||||
cargo_buildScripts_overrideCommand: Option<Vec<String>> = "null",
|
||||
/// rerun proc-macros building/build-scripts running when proc-macro
|
||||
/// or build-script sources change and are saved.
|
||||
cargo_buildScripts_rebuildOnSave: bool = "false",
|
||||
/// Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to
|
||||
/// avoid checking unnecessary things.
|
||||
cargo_buildScripts_useRustcWrapper: bool = "true",
|
||||
@ -1368,6 +1371,10 @@ impl Config {
|
||||
self.data.checkOnSave
|
||||
}
|
||||
|
||||
pub fn script_rebuild_on_save(&self) -> bool {
|
||||
self.data.cargo_buildScripts_rebuildOnSave
|
||||
}
|
||||
|
||||
pub fn runnables(&self) -> RunnablesConfig {
|
||||
RunnablesConfig {
|
||||
override_cargo: self.data.runnables_command.clone(),
|
||||
|
@ -351,6 +351,10 @@ impl GlobalState {
|
||||
|
||||
crates.iter().any(|&krate| crate_graph[krate].is_proc_macro)
|
||||
});
|
||||
if self.proc_macro_changed && self.config.script_rebuild_on_save() {
|
||||
self.fetch_build_data_queue
|
||||
.request_op(format!("proc-macro or build script source changed"), ())
|
||||
}
|
||||
}
|
||||
|
||||
true
|
||||
|
Loading…
x
Reference in New Issue
Block a user