minor: Remove old TODOs

pull/349/head
Blaž Hrastnik 3 years ago
parent e0fd08d6df
commit 20f33ead67

@ -1,8 +1,3 @@
- Refactor tree-sitter-highlight to work like the atom one, recomputing partial tree updates.
------
as you type completion!
- tree sitter: - tree sitter:
- lua - lua
@ -15,20 +10,16 @@ as you type completion!
- clojure - clojure
- erlang - erlang
as you type completion!
- [ ] use signature_help_provider and completion_provider trigger characters in - [ ] use signature_help_provider and completion_provider trigger characters in
a hook to trigger signature help text / autocompletion a hook to trigger signature help text / autocompletion
- [ ] document.on_type provider triggers - [ ] document.on_type provider triggers
- [ ] completion isIncomplete support - [ ] completion isIncomplete support
- [ ] scroll wheel support
- [ ] matching bracket highlight
1 1
- [ ] respect view fullscreen flag - [ ] respect view fullscreen flag
- [ ] Implement marks (superset of Selection/Range) - [ ] Implement marks (superset of Selection/Range)
- [ ] nixos packaging
- [ ] = for auto indent line/selection - [ ] = for auto indent line/selection
- [ ] :x for closing buffers - [ ] :x for closing buffers
@ -37,25 +28,19 @@ as you type completion!
- [] jump to alt buffer - [] jump to alt buffer
- [ ] lsp: signature help - [ ] lsp: signature help
- [x] lsp: hover
- [ ] lsp: document symbols (nested/vec)
- [ ] lsp: code actions - [ ] lsp: code actions
- [ ] lsp: formatting - [ ] lsp: formatting
- [x] lsp: goto
- [ ] search: smart case by default: insensitive unless upper detected - [ ] search: smart case by default: insensitive unless upper detected
- [ ] move Compositor into tui - [ ] move Compositor into tui
2 2
- [ ] surround bindings (select + surround ( wraps selection in parens )
- [ ] macro recording - [ ] macro recording
- [ ] extend selection (treesitter select parent node) (replaces viw, vi(, va( etc ) - [ ] extend selection (treesitter select parent node) (replaces viw, vi(, va( etc )
- [x] bracket pairs
- [x] comment block (gcc)
- [ ] selection align - [ ] selection align
- [ ] store some state between restarts: file positions, prompt history - [ ] store some state between restarts: file positions, prompt history
- [ ] highlight matched characters in completion - [ ] highlight matched characters in picker
3 3
- [ ] diff mode with highlighting? - [ ] diff mode with highlighting?

@ -1,7 +0,0 @@
window -> buffer -> text
\-> contains "view", a viewport into the buffer
view
\-> selections etc
-> cursor

@ -229,7 +229,6 @@ impl Application {
None => return, None => return,
}; };
// TODO: parse should return Result/Option
match notification { match notification {
Notification::PublishDiagnostics(params) => { Notification::PublishDiagnostics(params) => {
let path = Some(params.uri.to_file_path().unwrap()); let path = Some(params.uri.to_file_path().unwrap());
@ -298,7 +297,6 @@ impl Application {
.collect(); .collect();
doc.set_diagnostics(diagnostics); 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) => { Notification::ShowMessage(params) => {

@ -446,8 +446,6 @@ fn extend_next_word_end(cx: &mut Context) {
#[inline] #[inline]
fn find_char_impl<F>(cx: &mut Context, search_fn: F, inclusive: bool, extend: bool) fn find_char_impl<F>(cx: &mut Context, search_fn: F, inclusive: bool, extend: bool)
where 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, 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. // 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 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 { view.first_line = match direction {
Forward => view.first_line + offset, Forward => view.first_line + offset,
Backward => view.first_line.saturating_sub(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); 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) { fn search_impl(doc: &mut Document, view: &mut View, contents: &str, regex: &Regex, extend: bool) {
let text = doc.text(); let text = doc.text();
let selection = doc.selection(view.id); 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) Selection::single(start, head)
}; };
// TODO: (first_match, regex) stuff in register?
doc.set_selection(view.id, selection); doc.set_selection(view.id, selection);
align_view(doc, view, Align::Center); align_view(doc, view, Align::Center);
}; };
@ -905,12 +891,6 @@ fn search_selection(cx: &mut Context) {
search_next(cx); 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) { fn extend_line(cx: &mut Context) {
let count = cx.count(); let count = cx.count();
let (view, doc) = current!(cx.editor); 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)); 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) { fn delete_selection_impl(reg: &mut Register, doc: &mut Document, view_id: ViewId) {
// first yank the selection // first yank the selection
let values: Vec<String> = doc let values: Vec<String> = doc
@ -1568,9 +1546,6 @@ mod cmd {
} }
fn command_mode(cx: &mut Context) { 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( let mut prompt = Prompt::new(
":".to_owned(), ":".to_owned(),
|input: &str| { |input: &str| {
@ -2522,7 +2497,6 @@ fn redo(cx: &mut Context) {
// Yank / Paste // Yank / Paste
fn yank(cx: &mut Context) { fn yank(cx: &mut Context) {
// TODO: should selections be made end inclusive?
let (view, doc) = current!(cx.editor); let (view, doc) = current!(cx.editor);
let values: Vec<String> = doc let values: Vec<String> = doc
.selection(view.id) .selection(view.id)
@ -2703,16 +2677,6 @@ fn replace_selections_with_clipboard(cx: &mut Context) {
replace_selections_with_clipboard_impl(&mut cx.editor); 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) { fn paste_after(cx: &mut Context) {
let reg_name = cx.selected_register.name(); let reg_name = cx.selected_register.name();
let (view, doc) = current!(cx.editor); 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) { fn hover(cx: &mut Context) {

@ -8,11 +8,6 @@ use anyhow::{Context, Result};
fn setup_logging(logpath: PathBuf, verbosity: u64) -> Result<()> { fn setup_logging(logpath: PathBuf, verbosity: u64) -> Result<()> {
let mut base_config = fern::Dispatch::new(); 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 { base_config = match verbosity {
0 => base_config.level(log::LevelFilter::Warn), 0 => base_config.level(log::LevelFilter::Warn),
1 => base_config.level(log::LevelFilter::Info), 1 => base_config.level(log::LevelFilter::Info),

@ -68,7 +68,7 @@ impl menu::Item for CompletionItem {
/// Wraps a Menu. /// Wraps a Menu.
pub struct Completion { pub struct Completion {
popup: Popup<Menu<CompletionItem>>, // TODO: Popup<Menu> need to be able to access contents. popup: Popup<Menu<CompletionItem>>,
trigger_offset: usize, trigger_offset: usize,
// TODO: maintain a completioncontext with trigger kind & trigger char // TODO: maintain a completioncontext with trigger kind & trigger char
} }
@ -82,28 +82,10 @@ impl Completion {
// let items: Vec<CompletionItem> = Vec::new(); // let items: Vec<CompletionItem> = Vec::new();
let mut menu = Menu::new(items, move |editor: &mut Editor, item, event| { let mut menu = Menu::new(items, move |editor: &mut Editor, item, event| {
match event { match event {
PromptEvent::Abort => { PromptEvent::Abort => {}
// revert state
// let id = editor.view().doc;
// let doc = &mut editor.documents[id];
// doc.state = snapshot.clone();
}
PromptEvent::Validate => { PromptEvent::Validate => {
let (view, doc) = current!(editor); 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 // always present here
let item = item.unwrap(); let item = item.unwrap();
@ -143,7 +125,6 @@ impl Completion {
doc.apply(&transaction, view.id); doc.apply(&transaction, view.id);
// TODO: merge edit with additional_text_edits
if let Some(additional_edits) = &item.additional_text_edits { if let Some(additional_edits) = &item.additional_text_edits {
// gopls uses this to add extra imports // gopls uses this to add extra imports
if !additional_edits.is_empty() { if !additional_edits.is_empty() {
@ -226,7 +207,7 @@ impl Component for Completion {
fn render(&self, area: Rect, surface: &mut Surface, cx: &mut Context) { fn render(&self, area: Rect, surface: &mut Surface, cx: &mut Context) {
self.popup.render(area, surface, cx); 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() { if let Some(option) = self.popup.contents().selection() {
// need to render: // need to render:
// option.detail // option.detail

@ -123,8 +123,6 @@ impl EditorView {
}; };
// TODO: range doesn't actually restrict source, just highlight range // 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() { let highlights: Vec<_> = match doc.syntax() {
Some(syntax) => { Some(syntax) => {
syntax syntax

@ -42,7 +42,6 @@ pub fn regex_prompt(
move |editor: &mut Editor, input: &str, event: PromptEvent| { move |editor: &mut Editor, input: &str, event: PromptEvent| {
match event { match event {
PromptEvent::Abort => { PromptEvent::Abort => {
// TODO: also revert text
let (view, doc) = current!(editor); let (view, doc) = current!(editor);
doc.set_selection(view.id, snapshot.clone()); doc.set_selection(view.id, snapshot.clone());
} }
@ -61,7 +60,6 @@ pub fn regex_prompt(
let registers = &mut editor.registers; let registers = &mut editor.registers;
// revert state to what it was before the last update // revert state to what it was before the last update
// TODO: also revert text
doc.set_selection(view.id, snapshot.clone()); doc.set_selection(view.id, snapshot.clone());
fun(view, doc, registers, regex); fun(view, doc, registers, regex);

@ -256,8 +256,6 @@ impl<T: 'static> Component for Picker<T> {
let inner = block.inner(area); let inner = block.inner(area);
block.render(area, surface); 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: // -- Render the input bar:

Loading…
Cancel
Save