on master help sign in
minor: Remove some outdated comments
commit0062af6a19d96e0a4c3f94e3e44c179230e005b9 authorBlaž Hrastnik <blaz@mxxn.io> dateThu 3 Mar 2022, 17:18 (5 years ago) parent737282d
5 files changed+6−108
helix-term/src/application.rs+1−15 helix-term/src/commands.rs+5−44 helix-term/src/ui/completion.rs−12 helix-term/src/ui/editor.rs−14 helix-view/src/tree.rs−23
helix-term/src/application.rs+1−15
@@ -42,16 +42,11 @@ pub struct Application {
4242 compositor: Compositor,
4343 editor: Editor,
4444
45− // TODO should be separate to take only part of the config
45+ // TODO: share an ArcSwap with Editor?
4646 config: Config,
4747
48− // Currently never read from. Remove the `allow(dead_code)` when
49− // that changes.
5048 #[allow(dead_code)]
5149 theme_loader: Arc<theme::Loader>,
52−
53− // Currently never read from. Remove the `allow(dead_code)` when
54− // that changes.
5550 #[allow(dead_code)]
5651 syn_loader: Arc<syntax::Loader>,
5752
@@ -719,15 +714,6 @@ impl Application {
719714 Some(call) => call,
720715 None => {
721716 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− // );
731717 return;
732718 }
733719 };
helix-term/src/commands.rs+5−44
@@ -1492,7 +1492,7 @@ fn search_impl(
14921492 let selection = doc.selection(view.id);
14931493
14941494 // 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.
14961496 let start = match direction {
14971497 Direction::Forward => text.char_to_byte(graphemes::next_grapheme_boundary(
14981498 text,
@@ -1504,10 +1504,10 @@ fn search_impl(
15041504 )),
15051505 };
15061506
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
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.
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
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.
15111511 let mut offset = 0;
15121512
15131513 // use find_at to find the next match after the cursor, loop around the end
@@ -4352,9 +4352,6 @@ pub mod insert {
43524352
43534353// Undo / Redo
43544354
4355−// TODO: each command could simply return a Option<transaction>, then the higher level handles
4356−// storing it?
4357−
43584355fn undo(cx: &mut Context) {
43594356 let count = cx.count();
43604357 let (view, doc) = current!(cx.editor);
@@ -4930,42 +4927,6 @@ fn remove_primary_selection(cx: &mut Context) {
49304927pub fn completion(cx: &mut Context) {
49314928 use helix_lsp::{lsp, util::pos_to_lsp_pos};
49324929
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−
49694930 let (view, doc) = current!(cx.editor);
49704931
49714932 let language_server = match doc.language_server() {
helix-term/src/ui/completion.rs−12
@@ -280,18 +280,6 @@ impl Completion {
280280 }
281281}
282282
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−
295283impl Component for Completion {
296284 fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
297285 // let the Editor handle Esc instead
helix-term/src/ui/editor.rs−14
@@ -522,7 +522,6 @@ impl EditorView {
522522 let info = theme.get("info");
523523 let hint = theme.get("hint");
524524
525− // Vec::with_capacity(diagnostics.len()); // rough estimate
526525 let mut lines = Vec::new();
527526 for diagnostic in diagnostics {
528527 let text = Text::styled(
@@ -637,19 +636,6 @@ impl EditorView {
637636 base_style,
638637 ));
639638
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−
653639 // Position
654640 let pos = coords_at_pos(
655641 doc.text().slice(..),
helix-view/src/tree.rs−23
@@ -45,8 +45,6 @@ impl Node {
4545 }
4646}
4747
48−// TODO: screen coord to container + container coordinate helpers
49−
5048#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5149pub enum Layout {
5250 Horizontal,
@@ -515,27 +513,6 @@ impl Tree {
515513 // For now that's okay though, since it's unlikely you'll be able to open a large enough
516514 // number of splits to notice.
517515
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−
539516 let mut views = self
540517 .traverse()
541518 .skip_while(|&(id, _view)| id != self.focus)