Implement ra_proc_macro client logic

This commit is contained in:
Edwin Cheng
2020-03-27 04:26:34 +08:00
parent fa3c7742af
commit 503cbd3f4b
11 changed files with 827 additions and 23 deletions

View File

@@ -58,6 +58,7 @@ pub struct Config {
pub rustfmt_args: Vec<String>,
pub check: CheckConfig,
pub vscode_lldb: bool,
pub proc_macro_srv: Option<String>,
}
/// `WorldState` is the primary mutable state of the language server
@@ -167,8 +168,23 @@ impl WorldState {
vfs_file.map(|f| FileId(f.0))
};
let proc_macro_client =
ProcMacroClient::extern_process(std::path::Path::new("ra_proc_macro_srv"));
let proc_macro_client = match &options.proc_macro_srv {
None => ProcMacroClient::dummy(),
Some(srv) => {
let path = Path::new(&srv);
match ProcMacroClient::extern_process(path) {
Ok(it) => it,
Err(err) => {
log::error!(
"Fail to run ra_proc_macro_srv from path {}, error : {}",
path.to_string_lossy(),
err
);
ProcMacroClient::dummy()
}
}
}
};
workspaces
.iter()