diff options
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/completion.rs | 14 | ||||
-rw-r--r-- | helix-term/src/ui/editor.rs | 3 | ||||
-rw-r--r-- | helix-term/src/ui/mod.rs | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index a804b5f2..7a8413f8 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -26,7 +26,11 @@ pub struct Completion { } impl Completion { - pub fn new(items: Vec<CompletionItem>, trigger_offset: usize) -> Self { + pub fn new( + items: Vec<CompletionItem>, + offset_encoding: helix_lsp::OffsetEncoding, + trigger_offset: usize, + ) -> Self { // let items: Vec<CompletionItem> = Vec::new(); let mut menu = Menu::new( items, @@ -99,8 +103,12 @@ impl Completion { doc.apply(&remove, view.id); } - let transaction = - util::generate_transaction_from_edits(doc.text(), vec![edit]); + use helix_lsp::OffsetEncoding; + let transaction = util::generate_transaction_from_edits( + doc.text(), + vec![edit], + offset_encoding, // TODO: should probably transcode in Client + ); doc.apply(&transaction, view.id); } _ => (), diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 8879612c..227ccdaa 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -517,10 +517,11 @@ impl EditorView { pub fn set_completion( &mut self, items: Vec<helix_lsp::lsp::CompletionItem>, + offset_encoding: helix_lsp::OffsetEncoding, trigger_offset: usize, size: Rect, ) { - let mut completion = Completion::new(items, trigger_offset); + let mut completion = Completion::new(items, offset_encoding, trigger_offset); // TODO : propagate required size on resize to completion too completion.required_size((size.width, size.height)); self.completion = Some(completion); diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index d9a05a9c..105ba7ad 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -20,7 +20,7 @@ pub use tui::layout::Rect; pub use tui::style::{Color, Modifier, Style}; use helix_core::regex::Regex; -use helix_view::{View, Document, Editor}; +use helix_view::{Document, Editor, View}; use std::path::{Path, PathBuf}; |