aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/main_loop/handlers.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-05-21 13:26:44 +0100
committerAleksey Kladov <[email protected]>2020-05-21 14:08:03 +0100
commit4b495da368162a5b373d078be4ff51e55bffdf69 (patch)
treec35bf74905b9f03343fc10d834926e3457bc181c /crates/rust-analyzer/src/main_loop/handlers.rs
parenta4e6963a2313971fe7bbec97d03bc67266ef68a9 (diff)
Transition OnEnter to WorkspaceSnippetEdit
This also changes our handiling of snippet edits on the client side. `editor.insertSnippet` unfortunately forces indentation, which we really don't want to have to deal with. So, let's just implement our manual hacky way of dealing with a simple subset of snippets we actually use in rust-analyzer
Diffstat (limited to 'crates/rust-analyzer/src/main_loop/handlers.rs')
-rw-r--r--crates/rust-analyzer/src/main_loop/handlers.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs
index be6a0aece..fcf08cd79 100644
--- a/crates/rust-analyzer/src/main_loop/handlers.rs
+++ b/crates/rust-analyzer/src/main_loop/handlers.rs
@@ -159,12 +159,12 @@ pub fn handle_join_lines(
159pub fn handle_on_enter( 159pub fn handle_on_enter(
160 world: WorldSnapshot, 160 world: WorldSnapshot,
161 params: lsp_types::TextDocumentPositionParams, 161 params: lsp_types::TextDocumentPositionParams,
162) -> Result<Option<lsp_ext::SourceChange>> { 162) -> Result<Option<lsp_ext::SnippetWorkspaceEdit>> {
163 let _p = profile("handle_on_enter"); 163 let _p = profile("handle_on_enter");
164 let position = from_proto::file_position(&world, params)?; 164 let position = from_proto::file_position(&world, params)?;
165 match world.analysis().on_enter(position)? { 165 match world.analysis().on_enter(position)? {
166 None => Ok(None), 166 None => Ok(None),
167 Some(source_change) => to_proto::source_change(&world, source_change).map(Some), 167 Some(source_change) => to_proto::snippet_workspace_edit(&world, source_change).map(Some),
168 } 168 }
169} 169}
170 170