mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Add rust-analyzer-span server feature equivalent to the ID server
This commit is contained in:
parent
3ce35931db
commit
a892237ed4
17 changed files with 1159 additions and 558 deletions
|
@ -39,10 +39,17 @@ fn run() -> io::Result<()> {
|
|||
msg::Request::ListMacros { dylib_path } => {
|
||||
msg::Response::ListMacros(srv.list_macros(&dylib_path))
|
||||
}
|
||||
msg::Request::ExpandMacro(task) => msg::Response::ExpandMacro(srv.expand(task)),
|
||||
msg::Request::ExpandMacro(task) => match srv.span_mode() {
|
||||
msg::SpanMode::Id => msg::Response::ExpandMacro(srv.expand(task).map(|(it, _)| it)),
|
||||
msg::SpanMode::RustAnalyzer => msg::Response::ExpandMacroSpans(srv.expand(task)),
|
||||
},
|
||||
msg::Request::ApiVersionCheck {} => {
|
||||
msg::Response::ApiVersionCheck(proc_macro_api::msg::CURRENT_API_VERSION)
|
||||
}
|
||||
msg::Request::SetSpanMode(span_mode) => {
|
||||
srv.set_span_mode(span_mode);
|
||||
msg::Response::SetSpanMode(span_mode)
|
||||
}
|
||||
};
|
||||
write_response(res)?
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue