diff options
Diffstat (limited to 'crates/server/src')
-rw-r--r-- | crates/server/src/main_loop/handlers.rs | 42 | ||||
-rw-r--r-- | crates/server/src/req.rs | 2 |
2 files changed, 1 insertions, 43 deletions
diff --git a/crates/server/src/main_loop/handlers.rs b/crates/server/src/main_loop/handlers.rs index 583af0900..ee4072084 100644 --- a/crates/server/src/main_loop/handlers.rs +++ b/crates/server/src/main_loop/handlers.rs | |||
@@ -135,48 +135,6 @@ pub fn handle_code_action( | |||
135 | res.push(cmd); | 135 | res.push(cmd); |
136 | } | 136 | } |
137 | } | 137 | } |
138 | for runnable in libeditor::runnables(&file) { | ||
139 | if !contains_offset_nonstrict(runnable.range, offset) { | ||
140 | continue; | ||
141 | } | ||
142 | |||
143 | #[derive(Serialize)] | ||
144 | struct ProcessSpec { | ||
145 | bin: String, | ||
146 | args: Vec<String>, | ||
147 | env: HashMap<String, String>, | ||
148 | } | ||
149 | |||
150 | let spec = ProcessSpec { | ||
151 | bin: "cargo".to_string(), | ||
152 | args: match runnable.kind { | ||
153 | libeditor::RunnableKind::Test { name } => { | ||
154 | vec![ | ||
155 | "test".to_string(), | ||
156 | "--".to_string(), | ||
157 | name, | ||
158 | "--nocapture".to_string(), | ||
159 | ] | ||
160 | } | ||
161 | libeditor::RunnableKind::Bin => vec!["run".to_string()] | ||
162 | }, | ||
163 | env: { | ||
164 | let mut m = HashMap::new(); | ||
165 | m.insert( | ||
166 | "RUST_BACKTRACE".to_string(), | ||
167 | "short".to_string(), | ||
168 | ); | ||
169 | m | ||
170 | } | ||
171 | }; | ||
172 | |||
173 | let cmd = Command { | ||
174 | title: "Run ...".to_string(), | ||
175 | command: "libsyntax-rust.run".to_string(), | ||
176 | arguments: Some(vec![to_value(spec).unwrap()]), | ||
177 | }; | ||
178 | res.push(cmd); | ||
179 | } | ||
180 | 138 | ||
181 | for (diag, quick_fix) in world.analysis().diagnostics(file_id)? { | 139 | for (diag, quick_fix) in world.analysis().diagnostics(file_id)? { |
182 | let quick_fix = match quick_fix { | 140 | let quick_fix = match quick_fix { |
diff --git a/crates/server/src/req.rs b/crates/server/src/req.rs index e4138abba..269246dff 100644 --- a/crates/server/src/req.rs +++ b/crates/server/src/req.rs | |||
@@ -142,7 +142,7 @@ pub enum Runnables {} | |||
142 | impl Request for Runnables { | 142 | impl Request for Runnables { |
143 | type Params = RunnablesParams; | 143 | type Params = RunnablesParams; |
144 | type Result = Vec<Runnable>; | 144 | type Result = Vec<Runnable>; |
145 | const METHOD: &'static str = "m/joinLines"; | 145 | const METHOD: &'static str = "m/runnables"; |
146 | } | 146 | } |
147 | 147 | ||
148 | #[derive(Deserialize, Debug)] | 148 | #[derive(Deserialize, Debug)] |