diff options
Diffstat (limited to 'crates/server/src/main_loop/handlers.rs')
-rw-r--r-- | crates/server/src/main_loop/handlers.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/crates/server/src/main_loop/handlers.rs b/crates/server/src/main_loop/handlers.rs index b47cbc0fc..ae362ddaa 100644 --- a/crates/server/src/main_loop/handlers.rs +++ b/crates/server/src/main_loop/handlers.rs | |||
@@ -3,7 +3,7 @@ use std::collections::HashMap; | |||
3 | use languageserver_types::{ | 3 | use languageserver_types::{ |
4 | Diagnostic, DiagnosticSeverity, Url, DocumentSymbol, | 4 | Diagnostic, DiagnosticSeverity, Url, DocumentSymbol, |
5 | Command, TextDocumentIdentifier, WorkspaceEdit, | 5 | Command, TextDocumentIdentifier, WorkspaceEdit, |
6 | SymbolInformation, Position, Location, | 6 | SymbolInformation, Position, Location, TextEdit, |
7 | }; | 7 | }; |
8 | use libanalysis::{Query}; | 8 | use libanalysis::{Query}; |
9 | use libeditor; | 9 | use libeditor; |
@@ -58,6 +58,18 @@ pub fn handle_find_matching_brace( | |||
58 | Ok(res) | 58 | Ok(res) |
59 | } | 59 | } |
60 | 60 | ||
61 | pub fn handle_join_lines( | ||
62 | world: ServerWorld, | ||
63 | params: req::JoinLinesParams, | ||
64 | ) -> Result<Vec<TextEdit>> { | ||
65 | let file_id = params.text_document.try_conv_with(&world)?; | ||
66 | let file = world.analysis().file_syntax(file_id)?; | ||
67 | let line_index = world.analysis().file_line_index(file_id)?; | ||
68 | let range = params.range.conv_with(&line_index); | ||
69 | let res = libeditor::join_lines(&file, range); | ||
70 | Ok(res.edit.conv_with(&line_index)) | ||
71 | } | ||
72 | |||
61 | pub fn handle_document_symbol( | 73 | pub fn handle_document_symbol( |
62 | world: ServerWorld, | 74 | world: ServerWorld, |
63 | params: req::DocumentSymbolParams, | 75 | params: req::DocumentSymbolParams, |