mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Allow viewing the crate graph in a webview
This commit is contained in:
parent
9fa9d166d8
commit
a85a2c4d15
11 changed files with 125 additions and 0 deletions
|
@ -117,6 +117,12 @@ pub(crate) fn handle_view_hir(
|
|||
Ok(res)
|
||||
}
|
||||
|
||||
pub(crate) fn handle_view_crate_graph(snap: GlobalStateSnapshot, (): ()) -> Result<String> {
|
||||
let _p = profile::span("handle_view_crate_graph");
|
||||
let res = snap.analysis.view_crate_graph()??;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
pub(crate) fn handle_expand_macro(
|
||||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::ExpandMacroParams,
|
||||
|
|
|
@ -61,6 +61,14 @@ impl Request for ViewHir {
|
|||
const METHOD: &'static str = "rust-analyzer/viewHir";
|
||||
}
|
||||
|
||||
pub enum ViewCrateGraph {}
|
||||
|
||||
impl Request for ViewCrateGraph {
|
||||
type Params = ();
|
||||
type Result = String;
|
||||
const METHOD: &'static str = "rust-analyzer/viewCrateGraph";
|
||||
}
|
||||
|
||||
pub enum ExpandMacro {}
|
||||
|
||||
impl Request for ExpandMacro {
|
||||
|
|
|
@ -513,6 +513,7 @@ impl GlobalState {
|
|||
.on::<lsp_ext::AnalyzerStatus>(handlers::handle_analyzer_status)
|
||||
.on::<lsp_ext::SyntaxTree>(handlers::handle_syntax_tree)
|
||||
.on::<lsp_ext::ViewHir>(handlers::handle_view_hir)
|
||||
.on::<lsp_ext::ViewCrateGraph>(handlers::handle_view_crate_graph)
|
||||
.on::<lsp_ext::ExpandMacro>(handlers::handle_expand_macro)
|
||||
.on::<lsp_ext::ParentModule>(handlers::handle_parent_module)
|
||||
.on::<lsp_ext::Runnables>(handlers::handle_runnables)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue