Add lsp command for rebuilding proc macros

This commit is contained in:
Lukas Wirth 2023-03-25 16:47:41 +01:00
parent d154ea88f9
commit e9fb2ffe45
7 changed files with 27 additions and 1 deletions

View file

@ -52,6 +52,14 @@ pub(crate) fn handle_workspace_reload(state: &mut GlobalState, _: ()) -> Result<
Ok(())
}
pub(crate) fn handle_proc_macros_reload(state: &mut GlobalState, _: ()) -> Result<()> {
state.proc_macro_clients.clear();
state.proc_macro_changed = false;
state.fetch_build_data_queue.request_op("reload proc macros request".to_string());
Ok(())
}
pub(crate) fn handle_cancel_flycheck(state: &mut GlobalState, _: ()) -> Result<()> {
let _p = profile::span("handle_stop_flycheck");
state.flycheck.iter().for_each(|flycheck| flycheck.cancel());

View file

@ -51,6 +51,14 @@ impl Request for ReloadWorkspace {
const METHOD: &'static str = "rust-analyzer/reloadWorkspace";
}
pub enum ReloadProcMacros {}
impl Request for ReloadProcMacros {
type Params = ();
type Result = ();
const METHOD: &'static str = "rust-analyzer/reloadProcMacros";
}
pub enum SyntaxTree {}
impl Request for SyntaxTree {

View file

@ -633,6 +633,7 @@ impl GlobalState {
dispatcher
.on_sync_mut::<lsp_ext::ReloadWorkspace>(handlers::handle_workspace_reload)
.on_sync_mut::<lsp_ext::ReloadProcMacros>(handlers::handle_proc_macros_reload)
.on_sync_mut::<lsp_ext::MemoryUsage>(handlers::handle_memory_usage)
.on_sync_mut::<lsp_ext::ShuffleCrateGraph>(handlers::handle_shuffle_crate_graph)
.on_sync::<lsp_ext::JoinLines>(handlers::handle_join_lines)