internal: add "Shuffle Crate Graph" command

This commit is contained in:
Jonas Schievink
2021-12-07 15:38:12 +01:00
parent 9ae3158292
commit deb5c1426d
10 changed files with 106 additions and 0 deletions

View File

@@ -97,6 +97,11 @@ pub(crate) fn handle_memory_usage(state: &mut GlobalState, _: ()) -> Result<Stri
Ok(out)
}
pub(crate) fn handle_shuffle_crate_graph(state: &mut GlobalState, _: ()) -> Result<()> {
state.analysis_host.shuffle_crate_graph();
Ok(())
}
pub(crate) fn handle_syntax_tree(
snap: GlobalStateSnapshot,
params: lsp_ext::SyntaxTreeParams,

View File

@@ -31,6 +31,14 @@ impl Request for MemoryUsage {
const METHOD: &'static str = "rust-analyzer/memoryUsage";
}
pub enum ShuffleCrateGraph {}
impl Request for ShuffleCrateGraph {
type Params = ();
type Result = ();
const METHOD: &'static str = "rust-analyzer/shuffleCrateGraph";
}
pub enum ReloadWorkspace {}
impl Request for ReloadWorkspace {

View File

@@ -567,6 +567,7 @@ impl GlobalState {
Ok(())
})?
.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)?
.on_sync::<lsp_ext::OnEnter>(handlers::handle_on_enter)?
.on_sync::<lsp_types::request::SelectionRangeRequest>(handlers::handle_selection_range)?