on master help sign in
minor: Remove some outdated comments
0062af6Blaž Hrastnik
helix-term/src/application.rs+1−15
@@ -42,16 +42,11 @@ pub struct Application {
42 compositor: Compositor,
42 compositor: Compositor,
43 editor: Editor,
43 editor: Editor,
44
44
45− // TODO should be separate to take only part of the config
45+ // TODO: share an ArcSwap with Editor?
46 config: Config,
46 config: Config,
47
47
48− // Currently never read from. Remove the `allow(dead_code)` when
49− // that changes.
50 #[allow(dead_code)]
48 #[allow(dead_code)]
51 theme_loader: Arc<theme::Loader>,
49 theme_loader: Arc<theme::Loader>,
52−
53− // Currently never read from. Remove the `allow(dead_code)` when
54− // that changes.
55 #[allow(dead_code)]
50 #[allow(dead_code)]
56 syn_loader: Arc<syntax::Loader>,
51 syn_loader: Arc<syntax::Loader>,
57
52
@@ -719,15 +714,6 @@ impl Application {
719 Some(call) => call,
714 Some(call) => call,
720 None => {
715 None => {
721 error!("Method not found {}", method);
716 error!("Method not found {}", method);
722− // language_server.reply(
723− // call.id,
724− // // TODO: make a Into trait that can cast to Err(jsonrpc::Error)
725− // Err(helix_lsp::jsonrpc::Error {
726− // code: helix_lsp::jsonrpc::ErrorCode::MethodNotFound,
727− // message: "Method not found".to_string(),
728− // data: None,
729− // }),
730− // );
731 return;
717 return;
732 }
718 }
733 };
719 };
helix-term/src/commands.rs+5−44
@@ -1492,7 +1492,7 @@ fn search_impl(
1492 let selection = doc.selection(view.id);
1492 let selection = doc.selection(view.id);
1493
1493
1494 // Get the right side of the primary block cursor for forward search, or the
1494 // Get the right side of the primary block cursor for forward search, or the
1495− //grapheme before the start of the selection for reverse search.
1495+ // grapheme before the start of the selection for reverse search.
1496 let start = match direction {
1496 let start = match direction {
1497 Direction::Forward => text.char_to_byte(graphemes::next_grapheme_boundary(
1497 Direction::Forward => text.char_to_byte(graphemes::next_grapheme_boundary(
1498 text,
1498 text,
@@ -1504,10 +1504,10 @@ fn search_impl(
1504 )),
1504 )),
1505 };
1505 };
1506
1506
1507− //A regex::Match returns byte-positions in the str. In the case where we
1507+ // A regex::Match returns byte-positions in the str. In the case where we
1508− //do a reverse search and wraparound to the end, we don't need to search
1508+ // do a reverse search and wraparound to the end, we don't need to search
1509− //the text before the current cursor position for matches, but by slicing
1509+ // the text before the current cursor position for matches, but by slicing
1510− //it out, we need to add it back to the position of the selection.
1510+ // it out, we need to add it back to the position of the selection.
1511 let mut offset = 0;
1511 let mut offset = 0;
1512
1512
1513 // use find_at to find the next match after the cursor, loop around the end
1513 // use find_at to find the next match after the cursor, loop around the end
@@ -4352,9 +4352,6 @@ pub mod insert {
4352
4352
4353// Undo / Redo
4353// Undo / Redo
4354
4354
4355−// TODO: each command could simply return a Option<transaction>, then the higher level handles
4356−// storing it?
4357−
4358fn undo(cx: &mut Context) {
4355fn undo(cx: &mut Context) {
4359 let count = cx.count();
4356 let count = cx.count();
4360 let (view, doc) = current!(cx.editor);
4357 let (view, doc) = current!(cx.editor);
@@ -4930,42 +4927,6 @@ fn remove_primary_selection(cx: &mut Context) {
4930pub fn completion(cx: &mut Context) {
4927pub fn completion(cx: &mut Context) {
4931 use helix_lsp::{lsp, util::pos_to_lsp_pos};
4928 use helix_lsp::{lsp, util::pos_to_lsp_pos};
4932
4929
4933− // trigger on trigger char, or if user calls it
4934− // (or on word char typing??)
4935− // after it's triggered, if response marked is_incomplete, update on every subsequent keypress
4936− //
4937− // lsp calls are done via a callback: it sends a request and doesn't block.
4938− // when we get the response similarly to notification, trigger a call to the completion popup
4939− //
4940− // language_server.completion(params, |cx: &mut Context, _meta, response| {
4941− // // called at response time
4942− // // compositor, lookup completion layer
4943− // // downcast dyn Component to Completion component
4944− // // emit response to completion (completion.complete/handle(response))
4945− // })
4946− //
4947− // typing after prompt opens: usually start offset is tracked and everything between
4948− // start_offset..cursor is replaced. For our purposes we could keep the start state (doc,
4949− // selection) and revert to them before applying. This needs to properly reset changes/history
4950− // though...
4951− //
4952− // company-mode does this by matching the prefix of the completion and removing it.
4953−
4954− // ignore isIncomplete for now
4955− // keep state while typing
4956− // the behavior should be, filter the menu based on input
4957− // if items returns empty at any point, remove the popup
4958− // if backspace past initial offset point, remove the popup
4959− //
4960− // debounce requests!
4961− //
4962− // need an idle timeout thing.
4963− // https://github.com/company-mode/company-mode/blob/master/company.el#L620-L622
4964− //
4965− // "The idle delay in seconds until completion starts automatically.
4966− // The prefix still has to satisfy `company-minimum-prefix-length' before that
4967− // happens. The value of nil means no idle completion."
4968−
4969 let (view, doc) = current!(cx.editor);
4930 let (view, doc) = current!(cx.editor);
4970
4931
4971 let language_server = match doc.language_server() {
4932 let language_server = match doc.language_server() {
helix-term/src/ui/completion.rs−12
@@ -280,18 +280,6 @@ impl Completion {
280 }
280 }
281}
281}
282
282
283−// need to:
284−// - trigger on the right trigger char
285−// - detect previous open instance and recycle
286−// - update after input, but AFTER the document has changed
287−// - if no more matches, need to auto close
288−//
289−// missing bits:
290−// - a more robust hook system: emit to a channel, process in main loop
291−// - a way to find specific layers in compositor
292−// - components register for hooks, then unregister when terminated
293−// ... since completion is a special case, maybe just build it into doc/render?
294−
295impl Component for Completion {
283impl Component for Completion {
296 fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
284 fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
297 // let the Editor handle Esc instead
285 // let the Editor handle Esc instead
helix-term/src/ui/editor.rs−14
@@ -522,7 +522,6 @@ impl EditorView {
522 let info = theme.get("info");
522 let info = theme.get("info");
523 let hint = theme.get("hint");
523 let hint = theme.get("hint");
524
524
525− // Vec::with_capacity(diagnostics.len()); // rough estimate
526 let mut lines = Vec::new();
525 let mut lines = Vec::new();
527 for diagnostic in diagnostics {
526 for diagnostic in diagnostics {
528 let text = Text::styled(
527 let text = Text::styled(
@@ -637,19 +636,6 @@ impl EditorView {
637 base_style,
636 base_style,
638 ));
637 ));
639
638
640− // let indent_info = match doc.indent_style {
641− // IndentStyle::Tabs => "tabs",
642− // IndentStyle::Spaces(1) => "spaces:1",
643− // IndentStyle::Spaces(2) => "spaces:2",
644− // IndentStyle::Spaces(3) => "spaces:3",
645− // IndentStyle::Spaces(4) => "spaces:4",
646− // IndentStyle::Spaces(5) => "spaces:5",
647− // IndentStyle::Spaces(6) => "spaces:6",
648− // IndentStyle::Spaces(7) => "spaces:7",
649− // IndentStyle::Spaces(8) => "spaces:8",
650− // _ => "indent:ERROR",
651− // };
652−
653 // Position
639 // Position
654 let pos = coords_at_pos(
640 let pos = coords_at_pos(
655 doc.text().slice(..),
641 doc.text().slice(..),
helix-view/src/tree.rs−23
@@ -45,8 +45,6 @@ impl Node {
45 }
45 }
46}
46}
47
47
48−// TODO: screen coord to container + container coordinate helpers
49−
50#[derive(Debug, Clone, Copy, PartialEq, Eq)]
48#[derive(Debug, Clone, Copy, PartialEq, Eq)]
51pub enum Layout {
49pub enum Layout {
52 Horizontal,
50 Horizontal,
@@ -515,27 +513,6 @@ impl Tree {
515 // For now that's okay though, since it's unlikely you'll be able to open a large enough
513 // For now that's okay though, since it's unlikely you'll be able to open a large enough
516 // number of splits to notice.
514 // number of splits to notice.
517
515
518− // current = focus
519− // let found = loop do {
520− // node = focus.parent;
521− // let found = node.next_sibling_of(current)
522− // if some {
523− // break found;
524− // }
525− // // else
526− // if node == root {
527− // return first child of root;
528− // };
529− // current = parent;
530− // }
531− // }
532− //
533− // use found next sibling
534− // loop do {
535− // if found = view -> focus = found, return
536− // if found = container -> found = first child
537− // }
538−
539 let mut views = self
516 let mut views = self
540 .traverse()
517 .traverse()
541 .skip_while(|&(id, _view)| id != self.focus)
518 .skip_while(|&(id, _view)| id != self.focus)