diff options
Diffstat (limited to 'helix-lsp/src')
-rw-r--r-- | helix-lsp/src/client.rs | 4 | ||||
-rw-r--r-- | helix-lsp/src/lib.rs | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index d27beea8..52cd85c1 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -303,7 +303,7 @@ impl Client { new_pos += i; } Delete(_) => { - let start = pos_to_lsp_pos(&new_text, new_pos); + let start = pos_to_lsp_pos(new_text, new_pos); let end = traverse(start, old_text.slice(old_pos..old_end)); // deletion @@ -314,7 +314,7 @@ impl Client { }); } Insert(s) => { - let start = pos_to_lsp_pos(&new_text, new_pos); + let start = pos_to_lsp_pos(new_text, new_pos); new_pos += s.chars().count(); diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index b0c84ff5..a51a11fc 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -30,12 +30,12 @@ pub mod util { use super::*; use helix_core::{RopeSlice, State, Transaction}; - pub fn lsp_pos_to_pos(doc: &RopeSlice, pos: lsp::Position) -> usize { + pub fn lsp_pos_to_pos(doc: RopeSlice, pos: lsp::Position) -> usize { let line = doc.line_to_char(pos.line as usize); let line_start = doc.char_to_utf16_cu(line); doc.utf16_cu_to_char(pos.character as usize + line_start) } - pub fn pos_to_lsp_pos(doc: &RopeSlice, pos: usize) -> lsp::Position { + pub fn pos_to_lsp_pos(doc: RopeSlice, pos: usize) -> lsp::Position { let line = doc.char_to_line(pos); let line_start = doc.char_to_utf16_cu(doc.line_to_char(line)); let col = doc.char_to_utf16_cu(pos) - line_start; @@ -58,8 +58,8 @@ pub mod util { None }; - let start = lsp_pos_to_pos(&doc, edit.range.start); - let end = lsp_pos_to_pos(&doc, edit.range.end); + let start = lsp_pos_to_pos(doc, edit.range.start); + let end = lsp_pos_to_pos(doc, edit.range.end); (start, end, replacement) }), ) |