on master help sign in
minor: Remove old TODOs
commit20f33ead67f5adf895e899945ea569e2c89a4d7f authorBlaž Hrastnik <blaz@mxxn.io> dateTue 22 Jun 2021, 23:26 (5 years ago) parente0fd08d
9 files changed+5−101
TODO.md+2−17 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+3−22 helix-term/src/ui/editor.rs−2 helix-term/src/ui/mod.rs−2 helix-term/src/ui/picker.rs−2
TODO.md+2−17
@@ -1,8 +1,3 @@
1−- Refactor tree-sitter-highlight to work like the atom one, recomputing partial tree updates.
2−
3−------
4−
5−as you type completion!
61
72- tree sitter:
83 - lua
@@ -15,20 +10,16 @@ as you type completion!
1510 - clojure
1611 - erlang
1712
13+as you type completion!
1814- [ ] use signature_help_provider and completion_provider trigger characters in
1915 a hook to trigger signature help text / autocompletion
2016- [ ] document.on_type provider triggers
2117- [ ] completion isIncomplete support
2218
23−- [ ] scroll wheel support
24−- [ ] matching bracket highlight
25−
26191
2720- [ ] respect view fullscreen flag
2821- [ ] Implement marks (superset of Selection/Range)
2922
30−- [ ] nixos packaging
31−
3223- [ ] = for auto indent line/selection
3324- [ ] :x for closing buffers
3425
@@ -37,25 +28,19 @@ as you type completion!
3728- [] jump to alt buffer
3829
3930- [ ] lsp: signature help
40−- [x] lsp: hover
41−- [ ] lsp: document symbols (nested/vec)
4231- [ ] lsp: code actions
4332- [ ] lsp: formatting
44−- [x] lsp: goto
4533
4634- [ ] search: smart case by default: insensitive unless upper detected
4735
4836- [ ] move Compositor into tui
4937
50382
51−- [ ] surround bindings (select + surround ( wraps selection in parens )
5239- [ ] macro recording
5340- [ ] extend selection (treesitter select parent node) (replaces viw, vi(, va( etc )
54−- [x] bracket pairs
55−- [x] comment block (gcc)
5641- [ ] selection align
5742- [ ] store some state between restarts: file positions, prompt history
58−- [ ] highlight matched characters in completion
43+- [ ] highlight matched characters in picker
5944
60453
6146- [ ] diff mode with highlighting?
helix-term/README.mddeleted−7
@@ -1,7 +0,0 @@
1−
2−window -> buffer -> text
3−\-> contains "view", a viewport into the buffer
4−
5−view
6−\-> selections etc
7−-> cursor
helix-term/src/application.rs−2
@@ -229,7 +229,6 @@ impl Application {
229229 None => return,
230230 };
231231
232− // TODO: parse should return Result/Option
233232 match notification {
234233 Notification::PublishDiagnostics(params) => {
235234 let path = Some(params.uri.to_file_path().unwrap());
@@ -298,7 +297,6 @@ impl Application {
298297 .collect();
299298
300299 doc.set_diagnostics(diagnostics);
301− // TODO: we want to process all the events in queue, then render. publishDiagnostic tends to send a whole bunch of events
302300 }
303301 }
304302 Notification::ShowMessage(params) => {
helix-term/src/commands.rs−42
@@ -446,8 +446,6 @@ fn extend_next_word_end(cx: &mut Context) {
446446#[inline]
447447fn find_char_impl<F>(cx: &mut Context, search_fn: F, inclusive: bool, extend: bool)
448448where
449− // TODO: make an options struct for and abstract this Fn into a searcher type
450− // use the definition for w/b/e too
451449 F: Fn(RopeSlice, char, usize, usize, bool) -> Option<usize> + 'static,
452450{
453451 // 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) {
652650
653651 let scrolloff = PADDING.min(view.area.height as usize / 2); // TODO: user pref
654652
655− // cursor visual offset
656− // TODO: only if dragging via mouse?
657− // let cursor_off = cursor.row - view.first_line;
658−
659653 view.first_line = match direction {
660654 Forward => view.first_line + offset,
661655 Backward => view.first_line.saturating_sub(offset),
@@ -812,13 +806,6 @@ fn split_selection_on_newline(cx: &mut Context) {
812806 doc.set_selection(view.id, selection);
813807}
814808
815−// search: searches for the first occurence in file, provides a prompt
816−// search_next: reuses the last search regex and searches for the next match. The next match becomes the main selection.
817−// -> we always search from after the cursor.head
818−// TODO: be able to use selection as search query (*/alt *)
819−// I'd probably collect all the matches right now and store the current index. The cache needs
820−// wiping if input happens.
821−
822809fn search_impl(doc: &mut Document, view: &mut View, contents: &str, regex: &Regex, extend: bool) {
823810 let text = doc.text();
824811 let selection = doc.selection(view.id);
@@ -847,7 +834,6 @@ fn search_impl(doc: &mut Document, view: &mut View, contents: &str, regex: &Rege
847834 Selection::single(start, head)
848835 };
849836
850− // TODO: (first_match, regex) stuff in register?
851837 doc.set_selection(view.id, selection);
852838 align_view(doc, view, Align::Center);
853839 };
@@ -905,12 +891,6 @@ fn search_selection(cx: &mut Context) {
905891 search_next(cx);
906892}
907893
908−// TODO: N -> search_prev
909−// need to loop around buffer also and show a message
910−// same for no matches
911−
912−//
913−
914894fn extend_line(cx: &mut Context) {
915895 let count = cx.count();
916896 let (view, doc) = current!(cx.editor);
@@ -931,8 +911,6 @@ fn extend_line(cx: &mut Context) {
931911 doc.set_selection(view.id, Selection::single(start, end));
932912}
933913
934−// heuristic: append changes to history after each command, unless we're in insert mode
935−
936914fn delete_selection_impl(reg: &mut Register, doc: &mut Document, view_id: ViewId) {
937915 // first yank the selection
938916 let values: Vec<String> = doc
@@ -1568,9 +1546,6 @@ mod cmd {
15681546}
15691547
15701548fn command_mode(cx: &mut Context) {
1571− // TODO: completion items should have a info section that would get displayed in
1572− // a popup above the prompt when items are tabbed over
1573−
15741549 let mut prompt = Prompt::new(
15751550 ":".to_owned(),
15761551 |input: &str| {
@@ -2522,7 +2497,6 @@ fn redo(cx: &mut Context) {
25222497// Yank / Paste
25232498
25242499fn yank(cx: &mut Context) {
2525− // TODO: should selections be made end inclusive?
25262500 let (view, doc) = current!(cx.editor);
25272501 let values: Vec<String> = doc
25282502 .selection(view.id)
@@ -2703,16 +2677,6 @@ fn replace_selections_with_clipboard(cx: &mut Context) {
27032677 replace_selections_with_clipboard_impl(&mut cx.editor);
27042678}
27052679
2706−// alt-p => paste every yanked selection after selected text
2707−// alt-P => paste every yanked selection before selected text
2708−// R => replace selected text with yanked text
2709−// alt-R => replace selected text with every yanked text
2710−//
2711−// append => insert at next line
2712−// insert => insert at start of line
2713−// replace => replace
2714−// default insert
2715−
27162680fn paste_after(cx: &mut Context) {
27172681 let reg_name = cx.selected_register.name();
27182682 let (view, doc) = current!(cx.editor);
@@ -3019,12 +2983,6 @@ fn completion(cx: &mut Context) {
30192983 };
30202984 },
30212985 );
3022− // TODO: Server error: content modified
3023−
3024− // // TODO!: when iterating over items, show the docs in popup
3025−
3026− // // language server client needs to be accessible via a registry of some sort
3027− //}
30282986}
30292987
30302988fn hover(cx: &mut Context) {
helix-term/src/main.rs−5
@@ -8,11 +8,6 @@ use anyhow::{Context, Result};
88fn setup_logging(logpath: PathBuf, verbosity: u64) -> Result<()> {
99 let mut base_config = fern::Dispatch::new();
1010
11− // Let's say we depend on something which whose "info" level messages are too
12− // verbose to include in end-user output. If we don't need them,
13− // let's not include them.
14− // .level_for("overly-verbose-target", log::LevelFilter::Warn)
15−
1611 base_config = match verbosity {
1712 0 => base_config.level(log::LevelFilter::Warn),
1813 1 => base_config.level(log::LevelFilter::Info),
helix-term/src/ui/completion.rs+3−22
@@ -68,7 +68,7 @@ impl menu::Item for CompletionItem {
6868
6969/// Wraps a Menu.
7070pub struct Completion {
71− popup: Popup<Menu<CompletionItem>>, // TODO: Popup<Menu> need to be able to access contents.
71+ popup: Popup<Menu<CompletionItem>>,
7272 trigger_offset: usize,
7373 // TODO: maintain a completioncontext with trigger kind & trigger char
7474}
@@ -82,28 +82,10 @@ impl Completion {
8282 // let items: Vec<CompletionItem> = Vec::new();
8383 let mut menu = Menu::new(items, move |editor: &mut Editor, item, event| {
8484 match event {
85− PromptEvent::Abort => {
86− // revert state
87− // let id = editor.view().doc;
88− // let doc = &mut editor.documents[id];
89− // doc.state = snapshot.clone();
90− }
85+ PromptEvent::Abort => {}
9186 PromptEvent::Validate => {
9287 let (view, doc) = current!(editor);
9388
94− // revert state to what it was before the last update
95− // doc.state = snapshot.clone();
96−
97− // extract as fn(doc, item):
98−
99− // TODO: need to apply without composing state...
100− // TODO: need to update lsp on accept/cancel by diffing the snapshot with
101− // the final state?
102− // -> on update simply update the snapshot, then on accept redo the call,
103− // finally updating doc.changes + notifying lsp.
104− //
105− // or we could simply use doc.undo + apply when changing between options
106−
10789 // always present here
10890 let item = item.unwrap();
10991
@@ -143,7 +125,6 @@ impl Completion {
143125
144126 doc.apply(&transaction, view.id);
145127
146− // TODO: merge edit with additional_text_edits
147128 if let Some(additional_edits) = &item.additional_text_edits {
148129 // gopls uses this to add extra imports
149130 if !additional_edits.is_empty() {
@@ -226,7 +207,7 @@ impl Component for Completion {
226207 fn render(&self, area: Rect, surface: &mut Surface, cx: &mut Context) {
227208 self.popup.render(area, surface, cx);
228209
229− // TODO: if we have a selection, render a markdown popup on top/below with info
210+ // if we have a selection, render a markdown popup on top/below with info
230211 if let Some(option) = self.popup.contents().selection() {
231212 // need to render:
232213 // option.detail
helix-term/src/ui/editor.rs−2
@@ -123,8 +123,6 @@ impl EditorView {
123123 };
124124
125125 // TODO: range doesn't actually restrict source, just highlight range
126− // TODO: cache highlight results
127− // TODO: only recalculate when state.doc is actually modified
128126 let highlights: Vec<_> = match doc.syntax() {
129127 Some(syntax) => {
130128 syntax
helix-term/src/ui/mod.rs−2
@@ -42,7 +42,6 @@ pub fn regex_prompt(
4242 move |editor: &mut Editor, input: &str, event: PromptEvent| {
4343 match event {
4444 PromptEvent::Abort => {
45− // TODO: also revert text
4645 let (view, doc) = current!(editor);
4746 doc.set_selection(view.id, snapshot.clone());
4847 }
@@ -61,7 +60,6 @@ pub fn regex_prompt(
6160 let registers = &mut editor.registers;
6261
6362 // revert state to what it was before the last update
64− // TODO: also revert text
6563 doc.set_selection(view.id, snapshot.clone());
6664
6765 fun(view, doc, registers, regex);
helix-term/src/ui/picker.rs−2
@@ -256,8 +256,6 @@ impl<T: 'static> Component for Picker<T> {
256256 let inner = block.inner(area);
257257
258258 block.render(area, surface);
259− // TODO: abstract into a clear(area) fn
260− // surface.set_style(inner, Style::default().bg(Color::Rgb(150, 50, 0)));
261259
262260 // -- Render the input bar:
263261