bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66948: [PATCH] Add Completion Preview mode


From: Philip Kaludercic
Subject: bug#66948: [PATCH] Add Completion Preview mode
Date: Sun, 05 Nov 2023 18:26:24 +0000

Eshel Yaron <me@eshelyaron.com> writes:

> Tags: patch
>
> Following the recent discussion on emacs-devel[0], I'm attaching a patch
> that adds a new Completion Preview minor mode.

I didn't follow the discussion in detail, but is this related to the
capf-autosuggest package?

> I've been testing this patch with different completion backends, and so
> far I'm pretty happy with the results.  I've made some tweaks compared
> to the version I posted on emacs-devel to make the implementation more
> robust, and in particular to accommodate for some peculiarities of
> LSP-based completion, which I've tested mostly with `eglot` but also
> with `lsp-mode`.
>
> In terms of documentation, this patch extends "(emacs)Symbol Completion"
> with a description of Completion Preview mode.  That seemed like a good
> place to discuss this mode, but let me know if somewhere else would be
> preferable.
>
> Another question is whether to have RET/TAB/both accept and insert the
> completion suggestion.  In VS Code, both RET and TAB do that AFAICT.  If
> we want to, we can easily do that too by binding RET/TAB in
> `completion-preview-active-mode-map`.  Alternatively, we can just
> suggest doing so in the documentation.  The current patch binds neither
> RET nor TAB, so to accept the suggestion you complete with C-M-i.
> Personally, I find that convenient enough, but I can imagine that many
> users might expect TAB or RET to work too.

FWIW From a brief test, my main annoyances have been that DEL drops any
completion and that there is no option to cycle between inexact
completions.

>
> [0] https://lists.gnu.org/archive/html/emacs-devel/2023-10/msg00693.html
>
> +  (pcase (bounds-of-thing-at-point 'symbol)

[...]

You can use `pcase-let' here.

> +    (`(,beg . ,end)
> +     (<= completion-preview-minimum-symbol-length (- end beg)))))

-- 
Philip Kaludercic





reply via email to

[Prev in Thread] Current Thread [Next in Thread]