diff options
author | Mikhail Modin <[email protected]> | 2020-02-10 22:45:38 +0000 |
---|---|---|
committer | Mikhail Modin <[email protected]> | 2020-02-14 21:45:42 +0000 |
commit | f8f454ab5c19c6e7d91b3a4e6bb63fb9bf5f2673 (patch) | |
tree | e80fbf31a2f69916c86b5569da4f673e7818d8ec /crates/ra_lsp_server | |
parent | 6fb36dfdcb91f67c28f51e51514ebe420ec3aa22 (diff) |
Init implementation of structural search replace
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs | 1 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 5 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/req.rs | 13 |
3 files changed, 19 insertions, 0 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index ceff82fda..061383e28 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs | |||
@@ -526,6 +526,7 @@ fn on_request( | |||
526 | .on::<req::CallHierarchyPrepare>(handlers::handle_call_hierarchy_prepare)? | 526 | .on::<req::CallHierarchyPrepare>(handlers::handle_call_hierarchy_prepare)? |
527 | .on::<req::CallHierarchyIncomingCalls>(handlers::handle_call_hierarchy_incoming)? | 527 | .on::<req::CallHierarchyIncomingCalls>(handlers::handle_call_hierarchy_incoming)? |
528 | .on::<req::CallHierarchyOutgoingCalls>(handlers::handle_call_hierarchy_outgoing)? | 528 | .on::<req::CallHierarchyOutgoingCalls>(handlers::handle_call_hierarchy_outgoing)? |
529 | .on::<req::Ssr>(handlers::handle_ssr)? | ||
529 | .finish(); | 530 | .finish(); |
530 | Ok(()) | 531 | Ok(()) |
531 | } | 532 | } |
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 2e598fdcd..72bb48619 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -881,6 +881,11 @@ pub fn handle_document_highlight( | |||
881 | )) | 881 | )) |
882 | } | 882 | } |
883 | 883 | ||
884 | pub fn handle_ssr(world: WorldSnapshot, params: req::SsrParams) -> Result<req::SourceChange> { | ||
885 | let _p = profile("handle_ssr"); | ||
886 | world.analysis().structural_search_replace(¶ms.arg)??.try_conv_with(&world) | ||
887 | } | ||
888 | |||
884 | pub fn publish_diagnostics(world: &WorldSnapshot, file_id: FileId) -> Result<DiagnosticTask> { | 889 | pub fn publish_diagnostics(world: &WorldSnapshot, file_id: FileId) -> Result<DiagnosticTask> { |
885 | let _p = profile("publish_diagnostics"); | 890 | let _p = profile("publish_diagnostics"); |
886 | let line_index = world.analysis().file_line_index(file_id)?; | 891 | let line_index = world.analysis().file_line_index(file_id)?; |
diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs index dc327f53d..7ff7f60b3 100644 --- a/crates/ra_lsp_server/src/req.rs +++ b/crates/ra_lsp_server/src/req.rs | |||
@@ -206,3 +206,16 @@ pub struct InlayHint { | |||
206 | pub kind: InlayKind, | 206 | pub kind: InlayKind, |
207 | pub label: String, | 207 | pub label: String, |
208 | } | 208 | } |
209 | |||
210 | pub enum Ssr {} | ||
211 | |||
212 | impl Request for Ssr { | ||
213 | type Params = SsrParams; | ||
214 | type Result = SourceChange; | ||
215 | const METHOD: &'static str = "rust-analyzer/ssr"; | ||
216 | } | ||
217 | |||
218 | #[derive(Debug, Deserialize, Serialize)] | ||
219 | pub struct SsrParams { | ||
220 | pub arg: String, | ||
221 | } | ||