From: Eshel Yaron <me@eshelyaron.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Inline completion preview
Date: Fri, 27 Oct 2023 17:43:17 +0200 [thread overview]
Message-ID: <m15y2srrze.fsf@eshelyaron.com> (raw)
In-Reply-To: <838r7ofw8s.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 27 Oct 2023 08:52:03 +0300")
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Eshel Yaron <me@eshelyaron.com>
>> Cc: emacs-devel@gnu.org
>> Date: Thu, 26 Oct 2023 21:39:16 +0200
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> > 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?
>
> Did you see how other IDEs implement this display? That's what I
> mean.
I've used this feature in other editors (e.g. VS Code), but I didn't
dive into the implementation, if that's what you mean. Of course some
IDEs are not open source so gaining such insights into their
implementation is non-trivial :(
>> > 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.
>
> Then maybe you should describe the use case in more details, because
> this could be a misunderstanding of sorts. What are the use case(s)
> where the feature you propose would be useful?
The use case is this: you're editing some code, maybe it's a language
you're not extremely proficient with, and you want your editor (Emacs)
to give you suggestions for code that it would make some sense to write.
Completion preview does that by showing you a completion candidate you
can insert, and displaying it as if you've already inserted it, so you
know exactly what it'll look like (you get a preview). As you are
typing, Emacs updates the suggestion based on your keystrokes. If you
couple that with a good completion backend, you get useful suggestions
with a very low friction interface.
>> 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.
>
> This is an argument from the implementation POV, it basically says
> "let's do it because we can". The question I asked is different: why
> do we need to invent something new when we seem to already have
> similar functionalities that are widely used?
To be clear, I think adding Company to core Emacs instead of my
completion-preview.el or some such is a perfectly viable solution. I do
think there are some considerations in favor of my proposal (see below),
and some against, naturally.
> A response I expected would explain why those existing packages cannot
> support the desired feature, or are too heavy for such a simple
> feature, or have some other issues when used for this functionality.
Alright, let me review the alternatives:
- `fancy-dabbrev` is probably insufficient because it only works with
`dabbrev`. It's also only available on MELPA which might make it
harder to incorporate in core.
- `corfu-candidate-overlay` relies on `corfu`, and I've had a small
issue while testing it that sometimes the overlay lingered after point
moved, but otherwise I think that if `corfu` would be in core this
package would be a fine solution. MELPA-only as well.
- `mono-complete` is quite nice IMO, but it's a larger package that
comes with multiple backends besides `completion-at-point`, including
a bespoke python program that generates word predictions, and I think
that something simpler may be more appropriate. It is also only on MELPA.
- `company` is great, battle tested, fully featured, and on GNU ELPA.
It's an interesting option to explore IMO. It does add an extra level
of complexity with its multiple frontends and backends scheme, that
I'm not sure is needed in core.
- `completion-preview` only provides a completion preview frontend, and
only targets `completion-at-point` as a backend, so it benefits from
tight integration. Obviously, it is does not provide all of the
features that `company` provides, and it isn't very well tested. OTOH
it's less than 150 lines of code, so we could actually even add it to
completion.el instead of having a separate library.
Best,
Eshel
next prev parent reply other threads:[~2023-10-27 15:43 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-26 18:11 Inline completion preview Eshel Yaron
2023-10-26 18:38 ` Eli Zaretskii
2023-10-26 19:39 ` Eshel Yaron
2023-10-27 5:52 ` Eli Zaretskii
2023-10-27 15:43 ` Eshel Yaron [this message]
2023-10-27 17:12 ` Eli Zaretskii
2023-10-27 18:13 ` Eshel Yaron
2023-10-27 20:25 ` chad
2023-10-28 16:47 ` Juri Linkov
2023-10-28 19:01 ` Eshel Yaron
2023-10-29 16:24 ` Alexander Adolf
2023-10-29 23:29 ` João Távora
2023-10-30 9:25 ` Juergen Fenn
2023-10-30 9:36 ` João Távora
2023-10-30 11:04 ` Dmitry Gutov
2023-10-30 12:42 ` Alexander Adolf
2023-10-30 13:01 ` João Távora
2023-10-30 17:32 ` Alexander Adolf
2023-10-30 17:52 ` João Távora
2023-10-30 13:20 ` Dmitry Gutov
2023-10-30 17:43 ` Alexander Adolf
2023-10-30 22:49 ` Dmitry Gutov
2023-10-31 6:50 ` Eshel Yaron
2023-10-31 17:31 ` Alexander Adolf
2023-10-31 17:43 ` Eshel Yaron
2023-10-31 23:29 ` Dmitry Gutov
2023-11-01 8:30 ` Eshel Yaron
2023-11-01 10:11 ` João Távora
2023-11-01 10:44 ` Eshel Yaron
2023-11-01 11:07 ` João Távora
2023-11-01 12:17 ` Eshel Yaron
2023-11-01 12:23 ` Dmitry Gutov
2023-11-01 14:07 ` Juergen Fenn
2023-11-01 19:57 ` Dmitry Gutov
2023-11-01 12:08 ` Dmitry Gutov
2023-11-01 12:14 ` Dmitry Gutov
2023-11-01 12:24 ` Dmitry Gutov
2023-11-01 12:29 ` Eshel Yaron
2023-11-01 12:32 ` Dmitry Gutov
2023-11-01 12:34 ` Eli Zaretskii
2023-11-01 12:36 ` Dmitry Gutov
2023-11-01 13:28 ` Po Lu
2023-11-01 19:49 ` Dmitry Gutov
2023-10-27 8:58 ` Ihor Radchenko
2023-10-27 15:53 ` Eshel Yaron
2023-10-27 11:49 ` João Távora
2023-10-27 11:52 ` João Távora
2023-10-27 12:18 ` Eli Zaretskii
2023-10-27 12:55 ` João Távora
2023-10-27 12:58 ` Eli Zaretskii
2023-10-27 13:05 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m15y2srrze.fsf@eshelyaron.com \
--to=me@eshelyaron.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.