aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/application.rs16
-rw-r--r--helix-term/src/commands.rs49
-rw-r--r--helix-term/src/ui/completion.rs12
-rw-r--r--helix-term/src/ui/editor.rs14
4 files changed, 6 insertions, 85 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 9f95fa93..1b8aba6a 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -42,16 +42,11 @@ pub struct Application {
compositor: Compositor,
editor: Editor,
- // TODO should be separate to take only part of the config
+ // TODO: share an ArcSwap with Editor?
config: Config,
- // Currently never read from. Remove the `allow(dead_code)` when
- // that changes.
#[allow(dead_code)]
theme_loader: Arc<theme::Loader>,
-
- // Currently never read from. Remove the `allow(dead_code)` when
- // that changes.
#[allow(dead_code)]
syn_loader: Arc<syntax::Loader>,
@@ -719,15 +714,6 @@ impl Application {
Some(call) => call,
None => {
error!("Method not found {}", method);
- // language_server.reply(
- // call.id,
- // // TODO: make a Into trait that can cast to Err(jsonrpc::Error)
- // Err(helix_lsp::jsonrpc::Error {
- // code: helix_lsp::jsonrpc::ErrorCode::MethodNotFound,
- // message: "Method not found".to_string(),
- // data: None,
- // }),
- // );
return;
}
};
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 936954c0..39a8df53 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1492,7 +1492,7 @@ fn search_impl(
let selection = doc.selection(view.id);
// Get the right side of the primary block cursor for forward search, or the
- //grapheme before the start of the selection for reverse search.
+ // grapheme before the start of the selection for reverse search.
let start = match direction {
Direction::Forward => text.char_to_byte(graphemes::next_grapheme_boundary(
text,
@@ -1504,10 +1504,10 @@ fn search_impl(
)),
};
- //A regex::Match returns byte-positions in the str. In the case where we
- //do a reverse search and wraparound to the end, we don't need to search
- //the text before the current cursor position for matches, but by slicing
- //it out, we need to add it back to the position of the selection.
+ // A regex::Match returns byte-positions in the str. In the case where we
+ // do a reverse search and wraparound to the end, we don't need to search
+ // the text before the current cursor position for matches, but by slicing
+ // it out, we need to add it back to the position of the selection.
let mut offset = 0;
// use find_at to find the next match after the cursor, loop around the end
@@ -4352,9 +4352,6 @@ pub mod insert {
// Undo / Redo
-// TODO: each command could simply return a Option<transaction>, then the higher level handles
-// storing it?
-
fn undo(cx: &mut Context) {
let count = cx.count();
let (view, doc) = current!(cx.editor);
@@ -4930,42 +4927,6 @@ fn remove_primary_selection(cx: &mut Context) {
pub fn completion(cx: &mut Context) {
use helix_lsp::{lsp, util::pos_to_lsp_pos};
- // trigger on trigger char, or if user calls it
- // (or on word char typing??)
- // after it's triggered, if response marked is_incomplete, update on every subsequent keypress
- //
- // lsp calls are done via a callback: it sends a request and doesn't block.
- // when we get the response similarly to notification, trigger a call to the completion popup
- //
- // language_server.completion(params, |cx: &mut Context, _meta, response| {
- // // called at response time
- // // compositor, lookup completion layer
- // // downcast dyn Component to Completion component
- // // emit response to completion (completion.complete/handle(response))
- // })
- //
- // typing after prompt opens: usually start offset is tracked and everything between
- // start_offset..cursor is replaced. For our purposes we could keep the start state (doc,
- // selection) and revert to them before applying. This needs to properly reset changes/history
- // though...
- //
- // company-mode does this by matching the prefix of the completion and removing it.
-
- // ignore isIncomplete for now
- // keep state while typing
- // the behavior should be, filter the menu based on input
- // if items returns empty at any point, remove the popup
- // if backspace past initial offset point, remove the popup
- //
- // debounce requests!
- //
- // need an idle timeout thing.
- // https://github.com/company-mode/company-mode/blob/master/company.el#L620-L622
- //
- // "The idle delay in seconds until completion starts automatically.
- // The prefix still has to satisfy `company-minimum-prefix-length' before that
- // happens. The value of nil means no idle completion."
-
let (view, doc) = current!(cx.editor);
let language_server = match doc.language_server() {
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs
index abed2846..1ee4a01a 100644
--- a/helix-term/src/ui/completion.rs
+++ b/helix-term/src/ui/completion.rs
@@ -280,18 +280,6 @@ impl Completion {
}
}
-// need to:
-// - trigger on the right trigger char
-// - detect previous open instance and recycle
-// - update after input, but AFTER the document has changed
-// - if no more matches, need to auto close
-//
-// missing bits:
-// - a more robust hook system: emit to a channel, process in main loop
-// - a way to find specific layers in compositor
-// - components register for hooks, then unregister when terminated
-// ... since completion is a special case, maybe just build it into doc/render?
-
impl Component for Completion {
fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
// let the Editor handle Esc instead
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 3d2e4298..f9c5e55e 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -522,7 +522,6 @@ impl EditorView {
let info = theme.get("info");
let hint = theme.get("hint");
- // Vec::with_capacity(diagnostics.len()); // rough estimate
let mut lines = Vec::new();
for diagnostic in diagnostics {
let text = Text::styled(
@@ -637,19 +636,6 @@ impl EditorView {
base_style,
));
- // let indent_info = match doc.indent_style {
- // IndentStyle::Tabs => "tabs",
- // IndentStyle::Spaces(1) => "spaces:1",
- // IndentStyle::Spaces(2) => "spaces:2",
- // IndentStyle::Spaces(3) => "spaces:3",
- // IndentStyle::Spaces(4) => "spaces:4",
- // IndentStyle::Spaces(5) => "spaces:5",
- // IndentStyle::Spaces(6) => "spaces:6",
- // IndentStyle::Spaces(7) => "spaces:7",
- // IndentStyle::Spaces(8) => "spaces:8",
- // _ => "indent:ERROR",
- // };
-
// Position
let pos = coords_at_pos(
doc.text().slice(..),