emacs-devel
[Top][All Lists]
Advanced

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

Re: Inline completion preview


From: Eshel Yaron
Subject: Re: Inline completion preview
Date: Thu, 26 Oct 2023 21:39:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Eshel Yaron <me@eshelyaron.com>
>> Date: Thu, 26 Oct 2023 20:11:17 +0200
>>
>> 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.
>
> I wish people would work on adding to Emacs some a GUI infrastructure
> for showing such completion candidates like other IDEs do, instead of
> once again using overlays with after-string properties.

I'm not sure I know enough about the benefits of other approaches, what
do you envision?

> The result of using overlay strings is simply not visually appealing,

It doesn't seem to me very different from what I see in other editors,
but I guess that's a matter of taste.

> and on top of that it causes quite a few complications for the display
> code.
>

>> 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].
>
> You list those, but don't say why you think we should have yet another
> such facility, and in core on top of that.

Sorry, that might have not been clear enough, I wrote:

    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.

None of the aforementioned packages take that approach, so I wrote
`completion-preview.el` do demonstrate and test this approach.  As to
the question of adding this feature to core, since it's quite a simple
and useful addition, I just think it could be nice to have it OOTB.

> If we want something like that in core, I'd rather include Company,
> not invent something new (and partial).

That works too, of course :)
FWIW My proposal is not really novel, it uses standard techniques that
you find in all the packages I mentioned.  It just does without an
extra level of frontend/backend indirection and targets
`completion-at-point` directly, which makes it a bit simpler.



reply via email to

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