mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-01 12:24:29 +00:00
Clean up
This commit is contained in:
parent
ca957f4f82
commit
2e52aa1615
6 changed files with 41 additions and 6 deletions
|
|
@ -21,8 +21,8 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
use crate::{
|
||||
msg::{
|
||||
flat::serialize_span_data_index_map, ExpandMacro, ExpnGlobals, FlatTree, PanicMessage,
|
||||
HAS_GLOBAL_SPANS, RUST_ANALYZER_SPAN_SUPPORT,
|
||||
deserialize_span_data_index_map, flat::serialize_span_data_index_map, ExpandMacro,
|
||||
ExpnGlobals, FlatTree, PanicMessage, HAS_GLOBAL_SPANS, RUST_ANALYZER_SPAN_SUPPORT,
|
||||
},
|
||||
process::ProcMacroProcessSrv,
|
||||
};
|
||||
|
|
@ -186,6 +186,13 @@ impl ProcMacro {
|
|||
msg::Response::ExpandMacro(it) => {
|
||||
Ok(it.map(|tree| FlatTree::to_subtree_resolved(tree, version, &span_data_table)))
|
||||
}
|
||||
msg::Response::ExpandMacroExtended(it) => Ok(it.map(|resp| {
|
||||
FlatTree::to_subtree_resolved(
|
||||
resp.tree,
|
||||
version,
|
||||
&deserialize_span_data_index_map(&resp.span_data_table),
|
||||
)
|
||||
})),
|
||||
_ => Err(ServerError { message: "unexpected response".to_string(), io: None }),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,14 @@ pub const CURRENT_API_VERSION: u32 = RUST_ANALYZER_SPAN_SUPPORT;
|
|||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum Request {
|
||||
/// Since [`NO_VERSION_CHECK_VERSION`]
|
||||
ListMacros { dylib_path: PathBuf },
|
||||
/// Since [`NO_VERSION_CHECK_VERSION`]
|
||||
ExpandMacro(ExpandMacro),
|
||||
SetSpanMode(SpanMode),
|
||||
/// Since [`VERSION_CHECK_VERSION`]
|
||||
ApiVersionCheck {},
|
||||
/// Since [`RUST_ANALYZER_SPAN_SUPPORT`]
|
||||
SetSpanMode(SpanMode),
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug, Serialize, Deserialize)]
|
||||
|
|
@ -41,11 +45,22 @@ pub enum SpanMode {
|
|||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum Response {
|
||||
/// Since [`NO_VERSION_CHECK_VERSION`]
|
||||
ListMacros(Result<Vec<(String, ProcMacroKind)>, String>),
|
||||
/// Since [`NO_VERSION_CHECK_VERSION`]
|
||||
ExpandMacro(Result<FlatTree, PanicMessage>),
|
||||
ExpandMacroSpans(Result<(FlatTree, Vec<u32>), PanicMessage>),
|
||||
/// Since [`NO_VERSION_CHECK_VERSION`]
|
||||
ApiVersionCheck(u32),
|
||||
/// Since [`RUST_ANALYZER_SPAN_SUPPORT`]
|
||||
SetSpanMode(SpanMode),
|
||||
/// Since [`RUST_ANALYZER_SPAN_SUPPORT`]
|
||||
ExpandMacroExtended(Result<ExpandMacroExtended, PanicMessage>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct ExpandMacroExtended {
|
||||
pub tree: FlatTree,
|
||||
pub span_data_table: Vec<u32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue