File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,9 @@ config_data! {
105105 /// ```
106106 /// .
107107 cargo_buildScripts_overrideCommand: Option <Vec <String >> = "null" ,
108+ /// rerun proc-macros building/build-scripts running when proc-macro
109+ /// or build-script sources change and are saved.
110+ cargo_buildScripts_rebuildOnSave: bool = "false" ,
108111 /// Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to
109112 /// avoid checking unnecessary things.
110113 cargo_buildScripts_useRustcWrapper: bool = "true" ,
@@ -1368,6 +1371,10 @@ impl Config {
13681371 self . data . checkOnSave
13691372 }
13701373
1374+ pub fn script_rebuild_on_save ( & self ) -> bool {
1375+ self . data . cargo_buildScripts_rebuildOnSave
1376+ }
1377+
13711378 pub fn runnables ( & self ) -> RunnablesConfig {
13721379 RunnablesConfig {
13731380 override_cargo : self . data . runnables_command . clone ( ) ,
Original file line number Diff line number Diff line change @@ -351,6 +351,10 @@ impl GlobalState {
351351
352352 crates. iter ( ) . any ( |& krate| crate_graph[ krate] . is_proc_macro )
353353 } ) ;
354+ if self . proc_macro_changed && self . config . script_rebuild_on_save ( ) {
355+ self . fetch_build_data_queue
356+ . request_op ( format ! ( "proc-macro or build script source changed" ) , ( ) )
357+ }
354358 }
355359
356360 true
You can’t perform that action at this time.
0 commit comments