summaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/application.rs2
-rw-r--r--helix-term/src/commands.rs42
-rw-r--r--helix-term/src/main.rs5
-rw-r--r--helix-term/src/ui/completion.rs25
-rw-r--r--helix-term/src/ui/editor.rs2
-rw-r--r--helix-term/src/ui/mod.rs2
-rw-r--r--helix-term/src/ui/picker.rs2
7 files changed, 3 insertions, 77 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 7c954c1e..6f2f824b 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 6281cfe4..c31c97fa 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<F>(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<usize> + '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<String> = 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<String> = 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 ef912480..506e49ce 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 80f7d590..85543610 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<Menu<CompletionItem>>, // TODO: Popup<Menu> need to be able to access contents.
+ popup: Popup<Menu<CompletionItem>>,
trigger_offset: usize,
// TODO: maintain a completioncontext with trigger kind & trigger char
}
@@ -82,28 +82,10 @@ impl Completion {
// let items: Vec<CompletionItem> = 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 44f331ff..4f1b4bca 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 c062bffe..f60152c9 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 0aec9894..a3fe5e61 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -256,8 +256,6 @@ impl<T: 'static> Component for Picker<T> {
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: