diff options
author | Nathan Vegdahl | 2021-07-02 02:37:28 +0000 |
---|---|---|
committer | Nathan Vegdahl | 2021-07-02 02:37:28 +0000 |
commit | 2224a1527ec9592f16131b0aa3923fc3d37592e7 (patch) | |
tree | 2a08b053cb32cef9dc1db5895778d419ebaebb5b /helix-term/src/ui/completion.rs | |
parent | e725957704274b1ec814a34ddf6f75faf35358e7 (diff) | |
parent | 9f62ad0715240156b512dfc7c584d2d0df05a664 (diff) |
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
Diffstat (limited to 'helix-term/src/ui/completion.rs')
-rw-r--r-- | helix-term/src/ui/completion.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index 74a82dab..be6db42c 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -1,19 +1,16 @@ -use crate::compositor::{Component, Compositor, Context, EventResult}; -use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; +use crate::compositor::{Component, Context, EventResult}; +use crossterm::event::{Event, KeyCode, KeyEvent}; use tui::buffer::Buffer as Surface; use std::borrow::Cow; -use helix_core::{Position, Transaction}; -use helix_view::{ - graphics::{Color, Rect, Style}, - Editor, -}; +use helix_core::Transaction; +use helix_view::{graphics::Rect, Editor}; use crate::commands; use crate::ui::{menu, Markdown, Menu, Popup, PromptEvent}; -use helix_lsp::lsp; +use helix_lsp::{lsp, util}; use lsp::CompletionItem; impl menu::Item for CompletionItem { @@ -79,7 +76,7 @@ impl Completion { trigger_offset: usize, ) -> Self { // let items: Vec<CompletionItem> = Vec::new(); - let mut menu = Menu::new(items, move |editor: &mut Editor, item, event| { + let menu = Menu::new(items, move |editor: &mut Editor, item, event| { match event { PromptEvent::Abort => {} PromptEvent::Validate => { @@ -88,8 +85,6 @@ impl Completion { // always present here let item = item.unwrap(); - use helix_lsp::{lsp, util}; - // if more text was entered, remove it let cursor = doc.selection(view.id).cursor(); if trigger_offset < cursor { @@ -100,7 +95,6 @@ impl Completion { doc.apply(&remove, view.id); } - use helix_lsp::OffsetEncoding; let transaction = if let Some(edit) = &item.text_edit { let edit = match edit { lsp::CompletionTextEdit::Edit(edit) => edit.clone(), |