Skip to content

Commit

Permalink
Add configurable proc-macro-srv path for diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
jneem committed Jun 7, 2023
1 parent cdab350 commit ad2a0d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/rust-analyzer/src/cli/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ impl flags::Diagnostics {
pub fn run(self) -> anyhow::Result<()> {
let mut cargo_config = CargoConfig::default();
cargo_config.sysroot = Some(RustLibSource::Discover);
let with_proc_macro_server = if let Some(p) = &self.proc_macro_srv {
let path = vfs::AbsPathBuf::assert(std::env::current_dir()?.join(&p));
ProcMacroServerChoice::Explicit(path)
} else {
ProcMacroServerChoice::Sysroot
};
let load_cargo_config = LoadCargoConfig {
load_out_dirs_from_check: !self.disable_build_scripts,
with_proc_macro_server: ProcMacroServerChoice::Sysroot,
with_proc_macro_server,
prefill_caches: false,
};
let (host, _vfs, _proc_macro) =
Expand Down
3 changes: 3 additions & 0 deletions crates/rust-analyzer/src/cli/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ xflags::xflags! {
optional --disable-build-scripts
/// Don't use expand proc macros.
optional --disable-proc-macros
/// Run a custom proc-macro-srv binary.
optional --proc-macro-srv path: PathBuf
}

cmd ssr {
Expand Down Expand Up @@ -189,6 +191,7 @@ pub struct Diagnostics {

pub disable_build_scripts: bool,
pub disable_proc_macros: bool,
pub proc_macro_srv: Option<PathBuf>,
}

#[derive(Debug)]
Expand Down

0 comments on commit ad2a0d1

Please sign in to comment.