all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dmitry@gutov.dev>
To: "João Távora" <joaotavora@gmail.com>
Cc: 62816@debbugs.gnu.org
Subject: bug#62816: 30.0.50; ElDoc blinks echo area when eldoc-documentation-compose is used
Date: Fri, 14 Apr 2023 03:22:57 +0300	[thread overview]
Message-ID: <ae9eb43d-b4ad-cbc7-88d3-212b4dffa1f3@gutov.dev> (raw)
In-Reply-To: <87jzyf2u8n.fsf@gmail.com>

On 14/04/2023 03:16, João Távora wrote:

>>>> Here's a screencast that demonstrates the problem:
>>>> https://a.uguu.se/csTMrzxc.webm
>>> Ugh, that indeed looks awful.  We must fix it.
>>>
>>>> One way to fix that is
>>>>     (push 'company-echo-metadata-frontend company-frontends)
>>
>> Sorry, that was supposed to be (delete ...). The one above restores
>> the configuration -- I needed it for a repeat comparison.
> 
> Ahaha :-) No, no, I did exactly the same and misquoted you.  I put the
> push there to restore it, with a quick C-x C-e.  You did send the delq.

Oh. :-)

>>>> but I wonder whether some better solution exists.
>>> I hope so.
>>>
>>>> OTOH, Eglot implements the attribute which this frontend plugs into
>>>> via :company-docsig, and it seems like both with LSP servers that I
>>>> just tried it returns nil. If the feature is generally unused, I could
>>>> understand if Eglot users all disable this frontend anyway.
>>> I don't think that's the best solution.  Though you're right that
>>> only
>>> one server, pyright, uses this (it's some user's hack in eglot.el I let
>>> through: I don't even know what it does, i think it tells)
>>
>> Maybe other servers have different bits of info that could be used for
>> this?
> 
> Probably.  Just looked at the spec, there's are two different "detail"
> fields (though it's not clear which one to pick or where exactly to send
> them).  See
> https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_completion
> if you're interested, and search down for "detail".

"Detail" does sound relevant. But it depends on what info the servers 
actually provide in it.

> But are you saying
> that if that :company-docsig is taken out completely, the problem will
> not happen?  Maybe I can put it in only for the pyright server.

Not exactly: the backend interface doesn't differentiate between a not 
implemented action and action returning nil. Not for 'meta' anyway.

>>> But, perhaps to ask the obvious, why can't Company just detect when nil
>>> is passed to it via :company-docsig and not do any echoing in that
>>> situation?  Isn't it Company doing the clearing we want to avoid?
>>
>> I think it does need to clear the echo area when it was previously
>> echoed to by the same backend (showing meta from a different
>> completion). E.g. after the user just presses C-n with completion
>> popup already visible. So the idea to "just not do any echoes" would
>> require some bookkeeping about where the current message came from,
>> compare the current message contents, and possibly still fail
>> sometimes where the exact same message came from a different
>> source. The last one is unlikely, though.
> 
> I see.  Eglot only uses one Company source, company-capf, if that helps.

Alas no.

>>> Another option is just to temporarily disable eldoc during the duration
>>> of the Company completion session.
>>
>> Right.
>>
>> And yet another solution would be to detect that Eldoc will be used,
>> and try to plug into its documentation functions to display the meta
>> thingy alongside the other info.
>>
>> That's at least 3 potential solutions now.
> 
> I think you should do the "bookkeeping" one, at least a very simple
> version.  Just record in your concept of a "company session" if there
> was ever a non-nil :company-docsig sent from anywhere that required
> echoing.  Until there is, never clear on nil :company-docsig.
> Eventually, if there is something to echo, tough luck: display it and
> proceed as currently, clearing always on nil, risking flickering.
> Suspect this should fix 95% of the cases, certainly Eglot usages.

Yeah, that should be the most conservative solution. Maybe I'll start 
with it.





  reply	other threads:[~2023-04-14  0:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13 14:47 bug#62816: 30.0.50; ElDoc blinks echo area when eldoc-documentation-compose is used João Távora
2023-04-13 22:58 ` Dmitry Gutov
2023-04-13 23:23   ` João Távora
2023-04-13 23:37     ` Dmitry Gutov
2023-04-14  0:16       ` João Távora
2023-04-14  0:22         ` Dmitry Gutov [this message]
2023-04-15  1:03           ` Dmitry Gutov
2023-04-14 18:03 ` Dmitry Gutov
2023-04-14 18:09   ` João Távora
2023-04-14 18:53     ` Eli Zaretskii
2023-04-14 19:58       ` João Távora
2023-04-15  9:13         ` Eli Zaretskii
2023-04-15 11:04           ` João Távora
2023-04-15 11:40           ` 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=ae9eb43d-b4ad-cbc7-88d3-212b4dffa1f3@gutov.dev \
    --to=dmitry@gutov.dev \
    --cc=62816@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    /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.