aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_proc_macro_srv/src/cli.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_proc_macro_srv/src/cli.rs')
-rw-r--r--crates/ra_proc_macro_srv/src/cli.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_proc_macro_srv/src/cli.rs b/crates/ra_proc_macro_srv/src/cli.rs
index 7282e5b9b..1437794c9 100644
--- a/crates/ra_proc_macro_srv/src/cli.rs
+++ b/crates/ra_proc_macro_srv/src/cli.rs
@@ -1,15 +1,17 @@
1//! Driver for proc macro server 1//! Driver for proc macro server
2 2
3use crate::{expand_task, list_macros}; 3use crate::ProcMacroSrv;
4use ra_proc_macro::msg::{self, Message}; 4use ra_proc_macro::msg::{self, Message};
5use std::io; 5use std::io;
6 6
7pub fn run() -> io::Result<()> { 7pub fn run() -> io::Result<()> {
8 let mut srv = ProcMacroSrv::default();
9
8 while let Some(req) = read_request()? { 10 while let Some(req) = read_request()? {
9 let res = match req { 11 let res = match req {
10 msg::Request::ListMacro(task) => Ok(msg::Response::ListMacro(list_macros(&task))), 12 msg::Request::ListMacro(task) => srv.list_macros(&task).map(msg::Response::ListMacro),
11 msg::Request::ExpansionMacro(task) => { 13 msg::Request::ExpansionMacro(task) => {
12 expand_task(&task).map(msg::Response::ExpansionMacro) 14 srv.expand(&task).map(msg::Response::ExpansionMacro)
13 } 15 }
14 }; 16 };
15 17