mirror of https://github.com/helix-editor/helix
minor: Remove some outdated comments
parent
737282d0e9
commit
0062af6a19
|
@ -42,16 +42,11 @@ pub struct Application {
|
||||||
compositor: Compositor,
|
compositor: Compositor,
|
||||||
editor: Editor,
|
editor: Editor,
|
||||||
|
|
||||||
// TODO should be separate to take only part of the config
|
// TODO: share an ArcSwap with Editor?
|
||||||
config: Config,
|
config: Config,
|
||||||
|
|
||||||
// Currently never read from. Remove the `allow(dead_code)` when
|
|
||||||
// that changes.
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
theme_loader: Arc<theme::Loader>,
|
theme_loader: Arc<theme::Loader>,
|
||||||
|
|
||||||
// Currently never read from. Remove the `allow(dead_code)` when
|
|
||||||
// that changes.
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
syn_loader: Arc<syntax::Loader>,
|
syn_loader: Arc<syntax::Loader>,
|
||||||
|
|
||||||
|
@ -719,15 +714,6 @@ impl Application {
|
||||||
Some(call) => call,
|
Some(call) => call,
|
||||||
None => {
|
None => {
|
||||||
error!("Method not found {}", method);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1492,7 +1492,7 @@ fn search_impl(
|
||||||
let selection = doc.selection(view.id);
|
let selection = doc.selection(view.id);
|
||||||
|
|
||||||
// Get the right side of the primary block cursor for forward search, or the
|
// 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 {
|
let start = match direction {
|
||||||
Direction::Forward => text.char_to_byte(graphemes::next_grapheme_boundary(
|
Direction::Forward => text.char_to_byte(graphemes::next_grapheme_boundary(
|
||||||
text,
|
text,
|
||||||
|
@ -1504,10 +1504,10 @@ fn search_impl(
|
||||||
)),
|
)),
|
||||||
};
|
};
|
||||||
|
|
||||||
//A regex::Match returns byte-positions in the str. In the case where we
|
// 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
|
// 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
|
// 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.
|
// it out, we need to add it back to the position of the selection.
|
||||||
let mut offset = 0;
|
let mut offset = 0;
|
||||||
|
|
||||||
// use find_at to find the next match after the cursor, loop around the end
|
// use find_at to find the next match after the cursor, loop around the end
|
||||||
|
@ -4352,9 +4352,6 @@ pub mod insert {
|
||||||
|
|
||||||
// Undo / Redo
|
// Undo / Redo
|
||||||
|
|
||||||
// TODO: each command could simply return a Option<transaction>, then the higher level handles
|
|
||||||
// storing it?
|
|
||||||
|
|
||||||
fn undo(cx: &mut Context) {
|
fn undo(cx: &mut Context) {
|
||||||
let count = cx.count();
|
let count = cx.count();
|
||||||
let (view, doc) = current!(cx.editor);
|
let (view, doc) = current!(cx.editor);
|
||||||
|
@ -4930,42 +4927,6 @@ fn remove_primary_selection(cx: &mut Context) {
|
||||||
pub fn completion(cx: &mut Context) {
|
pub fn completion(cx: &mut Context) {
|
||||||
use helix_lsp::{lsp, util::pos_to_lsp_pos};
|
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 (view, doc) = current!(cx.editor);
|
||||||
|
|
||||||
let language_server = match doc.language_server() {
|
let language_server = match doc.language_server() {
|
||||||
|
|
|
@ -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 {
|
impl Component for Completion {
|
||||||
fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
|
fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
|
||||||
// let the Editor handle Esc instead
|
// let the Editor handle Esc instead
|
||||||
|
|
|
@ -522,7 +522,6 @@ impl EditorView {
|
||||||
let info = theme.get("info");
|
let info = theme.get("info");
|
||||||
let hint = theme.get("hint");
|
let hint = theme.get("hint");
|
||||||
|
|
||||||
// Vec::with_capacity(diagnostics.len()); // rough estimate
|
|
||||||
let mut lines = Vec::new();
|
let mut lines = Vec::new();
|
||||||
for diagnostic in diagnostics {
|
for diagnostic in diagnostics {
|
||||||
let text = Text::styled(
|
let text = Text::styled(
|
||||||
|
@ -637,19 +636,6 @@ impl EditorView {
|
||||||
base_style,
|
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
|
// Position
|
||||||
let pos = coords_at_pos(
|
let pos = coords_at_pos(
|
||||||
doc.text().slice(..),
|
doc.text().slice(..),
|
||||||
|
|
|
@ -45,8 +45,6 @@ impl Node {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: screen coord to container + container coordinate helpers
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum Layout {
|
pub enum Layout {
|
||||||
Horizontal,
|
Horizontal,
|
||||||
|
@ -515,27 +513,6 @@ impl Tree {
|
||||||
// For now that's okay though, since it's unlikely you'll be able to open a large enough
|
// For now that's okay though, since it's unlikely you'll be able to open a large enough
|
||||||
// number of splits to notice.
|
// number of splits to notice.
|
||||||
|
|
||||||
// current = focus
|
|
||||||
// let found = loop do {
|
|
||||||
// node = focus.parent;
|
|
||||||
// let found = node.next_sibling_of(current)
|
|
||||||
// if some {
|
|
||||||
// break found;
|
|
||||||
// }
|
|
||||||
// // else
|
|
||||||
// if node == root {
|
|
||||||
// return first child of root;
|
|
||||||
// };
|
|
||||||
// current = parent;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// use found next sibling
|
|
||||||
// loop do {
|
|
||||||
// if found = view -> focus = found, return
|
|
||||||
// if found = container -> found = first child
|
|
||||||
// }
|
|
||||||
|
|
||||||
let mut views = self
|
let mut views = self
|
||||||
.traverse()
|
.traverse()
|
||||||
.skip_while(|&(id, _view)| id != self.focus)
|
.skip_while(|&(id, _view)| id != self.focus)
|
||||||
|
|
Loading…
Reference in New Issue