From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#61066: [PATCH] Add inlay hint support to eglot Date: Thu, 26 Jan 2023 12:30:55 +0000 Message-ID: References: <83a625g66p.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000001f7bc205f329e641" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5895"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Dimitri Belopopsky , 61066@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 26 13:30:14 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pL1OP-0001M8-ES for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Jan 2023 13:30:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pL1OH-0002sd-JV; Thu, 26 Jan 2023 07:30:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pL1OF-0002sG-Nc for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 07:30:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pL1OF-0000VV-7i for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 07:30:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pL1OE-0007M0-Pz for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 07:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Jan 2023 12:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61066 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 61066-submit@debbugs.gnu.org id=B61066.167473617128209 (code B ref 61066); Thu, 26 Jan 2023 12:30:02 +0000 Original-Received: (at 61066) by debbugs.gnu.org; 26 Jan 2023 12:29:31 +0000 Original-Received: from localhost ([127.0.0.1]:60934 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pL1Nj-0007Kv-6C for submit@debbugs.gnu.org; Thu, 26 Jan 2023 07:29:31 -0500 Original-Received: from mail-oa1-f46.google.com ([209.85.160.46]:35711) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pL1Nh-0007Kh-BE for 61066@debbugs.gnu.org; Thu, 26 Jan 2023 07:29:29 -0500 Original-Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-15085b8a2f7so2188833fac.2 for <61066@debbugs.gnu.org>; Thu, 26 Jan 2023 04:29:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=L9HHKHSq6Wa7wTLj3TTHeScU2oHbsaN7J4Jrk0TrGvQ=; b=FT1SrbDJ/L2HEsRoD9b2u9xPu4uj/BT7+dvzK3KyPee/VBeWuYL9Nq373erXhqRWLZ JpB5JeoHKnvx5wHkljzzUBItvqNdkpY1lx4E8hwvK8FApKndQojZcNQEsjAA9VqkY1g/ ONADrAzWOQ1KbZCKU/xbCDVCFaV1UsUhVX/dQoWGRYg9IE+rVhWmNnjSv5JYkGhhuj/Q aibWWxEDegIyVxaql1hSrqGBzcwVl9kUhUM9kg3XhqdtSi5sCyfx7Hki6KE6GqhkI9by faI8qUaC4fch4JgKvnn+JPY9vQk23n9HWkqhomn9M0VXS1jxEzbtJKASP5OD5gKzMO/A o9Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=L9HHKHSq6Wa7wTLj3TTHeScU2oHbsaN7J4Jrk0TrGvQ=; b=vjxA4/RlhWz6fhG2SUGEOW4Lf3yzN5OQ4BjsLjFDY+T9ujggeJcQmN68k4ZwdvYZBP PY7jpSyKtbGsdqrAznLbknYf86ZRC578Zx9HF++XP5ZDFT0k1kPL3j4n7aTpGXK4uOuJ XKfv9VX1yUvJkLbJ550DEHRFyJytm6rFKxCbwYc1ExC3GM5Hafc9XDwsVjJ1POUx+95Z E4zMIeW+P2Z8IyfJbrJ0/xA1WLLRjTcEKYTS0TWkb3t5/BvGShU95fEophdZbYjiC2Eq Bz+ICc1BLbctgzuLVkXSrGbYLxC3dQapV36VSy+5vXa0ra/BD7HzXGnEbnmoE4ndmRK4 KggQ== X-Gm-Message-State: AFqh2krXjdEXxqPzapdD7WYrJ+zdV5txGhZpIQqoPEpOvlwsMlRlY2nx I5eNQ0KYXoo6z1A0w+i8w5A26sOcfIzg5cqtPy4= X-Google-Smtp-Source: AMrXdXv9poGdQtwuPIbchJTU4CrLfGweWRdnYjbi9cXwTWpmXMjbhhYhW/AVspguO6SyOnWWYTWM5G3HJI2PiXpxfzw= X-Received: by 2002:a05:6870:9d92:b0:15f:2ddd:80cf with SMTP id pv18-20020a0568709d9200b0015f2ddd80cfmr2323815oab.171.1674736163583; Thu, 26 Jan 2023 04:29:23 -0800 (PST) In-Reply-To: <83a625g66p.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:254204 Archived-At: --0000000000001f7bc205f329e641 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 26, 2023 at 6:28 AM Eli Zaretskii wrote: > > From: Dimitri Belopopsky > > Date: Wed, 25 Jan 2023 23:34:02 +0100 > > > > I've been working on adding support for inlay hints inside eglot using > overlays. > > Here is a working patch, but I'm still missing a few things: > > > > - I can't figure out a way to show the hints on a document without > causing lags or timeouts from the lsp > > server > > - I'm currently updating the hints by sending the whole file each time > (to make sure all hints get updated > > correctly). I'm not sure on how to make this more efficient (or if it > even necessary). > > > > On the implementation side: > > - implemented with overlays as a minor model, enabled by default > > - shows all hints supported by the protocol > > - there is a customisation to disable the minor mode if the user doesn'= t > want the feature > > > > I'd love to get a few points to finish this patch, and of course any > ideas and feedbacks are welcome! > > Thank you for working on this important feature. > > AFAIU, inlay hints provide information of the same kind as ElDoc and > in similar manner from the display and UX POV. So I think this > feature should work via ElDoc, not as a separate from-the-scratch > implementation. ElDoc is already capable of using Eglot-supplied > information, so perhaps the only feature we need to add is the > capability of ElDoc to (optionally) display the information in > overlays near point. (I thought we already had such a capability in > eldoc.el, but it looks like I was dreaming, because I cannot find it > there.) > > The advantage of basing this on ElDoc is that then we will be able to > provide similar features from information sources other than Eglot. > > Jo=C3=A3o, WDYT? > I think you're mostly right in your analysis. I also think this should be provided via some LSP-agnostic infrastructure and not as a separate from-the-scratch implementation, as you put it. This is (and was) also my stance in other similar matters. The devil is in the details, of course. Is eldoc.el the right infrastructure for it. What augmentation does it need, if any? Are these augmentations practical given the relative size, complexity and history of eldoc.el? Isn't an "inlay.el" or a "little-hint.el" support library a better choice? Or maybe flymake.el with it's use of overlay-based annotations is also acceptable here? I don't (yet) have answers to these questions. Of course the existence of this prototype by Dimitri is certainly No Bad Thing and a good starting point. Jo=C3=A3o --0000000000001f7bc205f329e641 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jan 26, 2023 at 6:28 AM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Dimitri Belopopsky <dimitri@belopopsky.com>=
> Date: Wed, 25 Jan 2023 23:34:02 +0100
>
> I've been working on adding support for inlay hints inside eglot u= sing overlays.
> Here is a working patch, but I'm still missing a few things:
>
> - I can't figure out a way to show the hints on a document without= causing lags or timeouts from the lsp
> server
> - I'm currently updating the hints by sending the whole file each = time (to make sure all hints get updated
> correctly). I'm not sure on how to make this more efficient (or if= it even necessary).
>
> On the implementation side:
> - implemented with overlays as a minor model, enabled by default
> - shows all hints supported by the protocol
> - there is a customisation to disable the minor mode if the user doesn= 't want the feature
>
> I'd love to get a few points to finish this patch, and of course a= ny ideas and feedbacks are welcome!

Thank you for working on this important feature.

AFAIU, inlay hints provide information of the same kind as ElDoc and
in similar manner from the display and UX POV.=C2=A0 So I think this
feature should work via ElDoc, not as a separate from-the-scratch
implementation.=C2=A0 ElDoc is already capable of using Eglot-supplied
information, so perhaps the only feature we need to add is the
capability of ElDoc to (optionally) display the information in
overlays near point.=C2=A0 (I thought we already had such a capability in eldoc.el, but it looks like I was dreaming, because I cannot find it
there.)

The advantage of basing this on ElDoc is that then we will be able to
provide similar features from information sources other than Eglot.

Jo=C3=A3o, WDYT?

I think you're mostly right in y= our analysis.=C2=A0 I also think this should be provided
via= some LSP-agnostic infrastructure and not as a separate from-the-scratch
implementation, as you put it. This is (and was) also my stanc= e in other similar
matters.

The dev= il is in the details, of course.=C2=A0 Is eldoc.el the right infrastructure=
for it. What augmentation does it need, if any?=C2=A0 Are these = augmentations
practical given the relative size, complexity and h= istory of eldoc.el? Isn't
an "inlay.el" or a &= quot;little-hint.el" support library a better choice? Or maybe
flymake.el with it's use of overlay-based annotations is also a= cceptable
here?=C2=A0 I don't (yet) have answers to thes= e questions.

Of course the existence of this proto= type by Dimitri is certainly
No Bad Thing and a good startin= g point.

Jo=C3=A3o
--0000000000001f7bc205f329e641--