From 20f33ead67f5adf895e899945ea569e2c89a4d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 22 Jun 2021 23:26:34 +0900 Subject: [PATCH] minor: Remove old TODOs --- TODO.md | 19 ++------------- helix-term/README.md | 7 ------ helix-term/src/application.rs | 2 -- helix-term/src/commands.rs | 42 --------------------------------- helix-term/src/main.rs | 5 ---- helix-term/src/ui/completion.rs | 25 +++----------------- helix-term/src/ui/editor.rs | 2 -- helix-term/src/ui/mod.rs | 2 -- helix-term/src/ui/picker.rs | 2 -- 9 files changed, 5 insertions(+), 101 deletions(-) delete mode 100644 helix-term/README.md diff --git a/TODO.md b/TODO.md index d1b49b9b7..2354bef97 100644 --- a/TODO.md +++ b/TODO.md @@ -1,8 +1,3 @@ -- Refactor tree-sitter-highlight to work like the atom one, recomputing partial tree updates. - ------- - -as you type completion! - tree sitter: - lua @@ -15,20 +10,16 @@ as you type completion! - clojure - erlang +as you type completion! - [ ] use signature_help_provider and completion_provider trigger characters in a hook to trigger signature help text / autocompletion - [ ] document.on_type provider triggers - [ ] completion isIncomplete support -- [ ] scroll wheel support -- [ ] matching bracket highlight - 1 - [ ] respect view fullscreen flag - [ ] Implement marks (superset of Selection/Range) -- [ ] nixos packaging - - [ ] = for auto indent line/selection - [ ] :x for closing buffers @@ -37,25 +28,19 @@ as you type completion! - [] jump to alt buffer - [ ] lsp: signature help -- [x] lsp: hover -- [ ] lsp: document symbols (nested/vec) - [ ] lsp: code actions - [ ] lsp: formatting -- [x] lsp: goto - [ ] search: smart case by default: insensitive unless upper detected - [ ] move Compositor into tui 2 -- [ ] surround bindings (select + surround ( wraps selection in parens ) - [ ] macro recording - [ ] extend selection (treesitter select parent node) (replaces viw, vi(, va( etc ) -- [x] bracket pairs -- [x] comment block (gcc) - [ ] selection align - [ ] store some state between restarts: file positions, prompt history -- [ ] highlight matched characters in completion +- [ ] highlight matched characters in picker 3 - [ ] diff mode with highlighting? diff --git a/helix-term/README.md b/helix-term/README.md deleted file mode 100644 index abefa6fdd..000000000 --- a/helix-term/README.md +++ /dev/null @@ -1,7 +0,0 @@ - -window -> buffer -> text -\-> contains "view", a viewport into the buffer - -view -\-> selections etc --> cursor diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 7c954c1e1..6f2f824be 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -229,7 +229,6 @@ impl Application { None => return, }; - // TODO: parse should return Result/Option match notification { Notification::PublishDiagnostics(params) => { let path = Some(params.uri.to_file_path().unwrap()); @@ -298,7 +297,6 @@ impl Application { .collect(); doc.set_diagnostics(diagnostics); - // TODO: we want to process all the events in queue, then render. publishDiagnostic tends to send a whole bunch of events } } Notification::ShowMessage(params) => { diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 6281cfe44..c31c97fa4 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -446,8 +446,6 @@ fn extend_next_word_end(cx: &mut Context) { #[inline] fn find_char_impl(cx: &mut Context, search_fn: F, inclusive: bool, extend: bool) where - // TODO: make an options struct for and abstract this Fn into a searcher type - // use the definition for w/b/e too F: Fn(RopeSlice, char, usize, usize, bool) -> Option + 'static, { // TODO: count is reset to 1 before next key so we move it into the closure here. @@ -652,10 +650,6 @@ fn scroll(cx: &mut Context, offset: usize, direction: Direction) { let scrolloff = PADDING.min(view.area.height as usize / 2); // TODO: user pref - // cursor visual offset - // TODO: only if dragging via mouse? - // let cursor_off = cursor.row - view.first_line; - view.first_line = match direction { Forward => view.first_line + offset, Backward => view.first_line.saturating_sub(offset), @@ -812,13 +806,6 @@ fn split_selection_on_newline(cx: &mut Context) { doc.set_selection(view.id, selection); } -// search: searches for the first occurence in file, provides a prompt -// search_next: reuses the last search regex and searches for the next match. The next match becomes the main selection. -// -> we always search from after the cursor.head -// TODO: be able to use selection as search query (*/alt *) -// I'd probably collect all the matches right now and store the current index. The cache needs -// wiping if input happens. - fn search_impl(doc: &mut Document, view: &mut View, contents: &str, regex: &Regex, extend: bool) { let text = doc.text(); let selection = doc.selection(view.id); @@ -847,7 +834,6 @@ fn search_impl(doc: &mut Document, view: &mut View, contents: &str, regex: &Rege Selection::single(start, head) }; - // TODO: (first_match, regex) stuff in register? doc.set_selection(view.id, selection); align_view(doc, view, Align::Center); }; @@ -905,12 +891,6 @@ fn search_selection(cx: &mut Context) { search_next(cx); } -// TODO: N -> search_prev -// need to loop around buffer also and show a message -// same for no matches - -// - fn extend_line(cx: &mut Context) { let count = cx.count(); let (view, doc) = current!(cx.editor); @@ -931,8 +911,6 @@ fn extend_line(cx: &mut Context) { doc.set_selection(view.id, Selection::single(start, end)); } -// heuristic: append changes to history after each command, unless we're in insert mode - fn delete_selection_impl(reg: &mut Register, doc: &mut Document, view_id: ViewId) { // first yank the selection let values: Vec = doc @@ -1568,9 +1546,6 @@ mod cmd { } fn command_mode(cx: &mut Context) { - // TODO: completion items should have a info section that would get displayed in - // a popup above the prompt when items are tabbed over - let mut prompt = Prompt::new( ":".to_owned(), |input: &str| { @@ -2522,7 +2497,6 @@ fn redo(cx: &mut Context) { // Yank / Paste fn yank(cx: &mut Context) { - // TODO: should selections be made end inclusive? let (view, doc) = current!(cx.editor); let values: Vec = doc .selection(view.id) @@ -2703,16 +2677,6 @@ fn replace_selections_with_clipboard(cx: &mut Context) { replace_selections_with_clipboard_impl(&mut cx.editor); } -// alt-p => paste every yanked selection after selected text -// alt-P => paste every yanked selection before selected text -// R => replace selected text with yanked text -// alt-R => replace selected text with every yanked text -// -// append => insert at next line -// insert => insert at start of line -// replace => replace -// default insert - fn paste_after(cx: &mut Context) { let reg_name = cx.selected_register.name(); let (view, doc) = current!(cx.editor); @@ -3019,12 +2983,6 @@ fn completion(cx: &mut Context) { }; }, ); - // TODO: Server error: content modified - - // // TODO!: when iterating over items, show the docs in popup - - // // language server client needs to be accessible via a registry of some sort - //} } fn hover(cx: &mut Context) { diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index ef912480b..506e49ce0 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -8,11 +8,6 @@ use anyhow::{Context, Result}; fn setup_logging(logpath: PathBuf, verbosity: u64) -> Result<()> { let mut base_config = fern::Dispatch::new(); - // Let's say we depend on something which whose "info" level messages are too - // verbose to include in end-user output. If we don't need them, - // let's not include them. - // .level_for("overly-verbose-target", log::LevelFilter::Warn) - base_config = match verbosity { 0 => base_config.level(log::LevelFilter::Warn), 1 => base_config.level(log::LevelFilter::Info), diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index 80f7d5902..855436104 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -68,7 +68,7 @@ impl menu::Item for CompletionItem { /// Wraps a Menu. pub struct Completion { - popup: Popup>, // TODO: Popup need to be able to access contents. + popup: Popup>, trigger_offset: usize, // TODO: maintain a completioncontext with trigger kind & trigger char } @@ -82,28 +82,10 @@ impl Completion { // let items: Vec = Vec::new(); let mut menu = Menu::new(items, move |editor: &mut Editor, item, event| { match event { - PromptEvent::Abort => { - // revert state - // let id = editor.view().doc; - // let doc = &mut editor.documents[id]; - // doc.state = snapshot.clone(); - } + PromptEvent::Abort => {} PromptEvent::Validate => { let (view, doc) = current!(editor); - // revert state to what it was before the last update - // doc.state = snapshot.clone(); - - // extract as fn(doc, item): - - // TODO: need to apply without composing state... - // TODO: need to update lsp on accept/cancel by diffing the snapshot with - // the final state? - // -> on update simply update the snapshot, then on accept redo the call, - // finally updating doc.changes + notifying lsp. - // - // or we could simply use doc.undo + apply when changing between options - // always present here let item = item.unwrap(); @@ -143,7 +125,6 @@ impl Completion { doc.apply(&transaction, view.id); - // TODO: merge edit with additional_text_edits if let Some(additional_edits) = &item.additional_text_edits { // gopls uses this to add extra imports if !additional_edits.is_empty() { @@ -226,7 +207,7 @@ impl Component for Completion { fn render(&self, area: Rect, surface: &mut Surface, cx: &mut Context) { self.popup.render(area, surface, cx); - // TODO: if we have a selection, render a markdown popup on top/below with info + // if we have a selection, render a markdown popup on top/below with info if let Some(option) = self.popup.contents().selection() { // need to render: // option.detail diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 44f331ff0..4f1b4bcac 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -123,8 +123,6 @@ impl EditorView { }; // TODO: range doesn't actually restrict source, just highlight range - // TODO: cache highlight results - // TODO: only recalculate when state.doc is actually modified let highlights: Vec<_> = match doc.syntax() { Some(syntax) => { syntax diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index c062bffe3..f60152c94 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -42,7 +42,6 @@ pub fn regex_prompt( move |editor: &mut Editor, input: &str, event: PromptEvent| { match event { PromptEvent::Abort => { - // TODO: also revert text let (view, doc) = current!(editor); doc.set_selection(view.id, snapshot.clone()); } @@ -61,7 +60,6 @@ pub fn regex_prompt( let registers = &mut editor.registers; // revert state to what it was before the last update - // TODO: also revert text doc.set_selection(view.id, snapshot.clone()); fun(view, doc, registers, regex); diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 0aec98947..a3fe5e61b 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -256,8 +256,6 @@ impl Component for Picker { let inner = block.inner(area); block.render(area, surface); - // TODO: abstract into a clear(area) fn - // surface.set_style(inner, Style::default().bg(Color::Rgb(150, 50, 0))); // -- Render the input bar: