emacs-devel
[Top][All Lists]
Advanced

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

Inline completion preview


From: Eshel Yaron
Subject: Inline completion preview
Date: Thu, 26 Oct 2023 20:11:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Hi,

I want to propose adding an inline completion preview mechanism to Emacs.

By inline completion preview, I mean an overlay that pop ups after point
showing one of the candidates for at-point completion.  You can view
this mechanism as giving you a hint or suggesting a certain completion.

Of course, there are a few Emacs packages that provide such a facility
already.  Namely, I found and played around with the following packages:

- `company` includes three variants of such a preview frontend, one of
  them enabled by default, that show a completion candidate provided by
  `company`'s backends.  See [0].
- `fancy-dabbrev` does something similar for `dabbrev` abbreviations.
  See [1].
- `mono-complete` provides such a completion preview frontend with
  several pluggable backends, including `completion-at-point` and
  `dabbrev`.  See [2].
- `corfu-candidate-overlay` implements such a preview for
  `completion-at-point` candidates that relies on the `corfu` in-buffer
  completion interface.  See [3].

IIUC similar features exist in other editors and go by names such as
"suggestion preview" and "ghost text".

I like this completion preview concept and I think it may be interesting
for Emacs to provide it.  ISTM that the best approach is a simple
library that uses only `completion-at-point` as a backend, because
`completion-at-point` is already extensible enough to support a variety
of completion backends.

I'm attaching below a draft for a simple `completion-preview.el` for
your consideration, I've been testing it in several major modes with
different `completion-at-point` backends, including LSP-based.

WDYT?


Eshel

[0] http://company-mode.github.io/manual/Frontends.html#Preview-Frontends
[1] https://github.com/jrosdahl/fancy-dabbrev
[2] https://codeberg.org/ideasman42/emacs-mono-complete
[3] https://code.bsdgeek.org/adam/corfu-candidate-overlay

Attachment: completion-preview.el
Description: application/emacs-lisp


reply via email to

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