|
|
|
@ -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() {
|
|
|
|
|