Add a "Debug ItemTree" LSP request
This commit is contained in:
@@ -117,6 +117,16 @@ pub(crate) fn handle_view_hir(
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
pub(crate) fn handle_view_item_tree(
|
||||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::ViewItemTreeParams,
|
||||
) -> Result<String> {
|
||||
let _p = profile::span("handle_view_item_tree");
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let res = snap.analysis.view_item_tree(file_id)?;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
pub(crate) fn handle_view_crate_graph(snap: GlobalStateSnapshot, (): ()) -> Result<String> {
|
||||
let _p = profile::span("handle_view_crate_graph");
|
||||
let dot = snap.analysis.view_crate_graph()??;
|
||||
|
||||
@@ -70,6 +70,20 @@ impl Request for ViewCrateGraph {
|
||||
const METHOD: &'static str = "rust-analyzer/viewCrateGraph";
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ViewItemTreeParams {
|
||||
pub text_document: TextDocumentIdentifier,
|
||||
}
|
||||
|
||||
pub enum ViewItemTree {}
|
||||
|
||||
impl Request for ViewItemTree {
|
||||
type Params = ViewItemTreeParams;
|
||||
type Result = String;
|
||||
const METHOD: &'static str = "rust-analyzer/viewItemTree";
|
||||
}
|
||||
|
||||
pub enum ExpandMacro {}
|
||||
|
||||
impl Request for ExpandMacro {
|
||||
|
||||
@@ -514,6 +514,7 @@ impl GlobalState {
|
||||
.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::ViewItemTree>(handlers::handle_view_item_tree)
|
||||
.on::<lsp_ext::ExpandMacro>(handlers::handle_expand_macro)
|
||||
.on::<lsp_ext::ParentModule>(handlers::handle_parent_module)
|
||||
.on::<lsp_ext::Runnables>(handlers::handle_runnables)
|
||||
|
||||
Reference in New Issue
Block a user