bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#62816: 30.0.50; ElDoc blinks echo area when eldoc-documentation-comp


From: João Távora
Subject: bug#62816: 30.0.50; ElDoc blinks echo area when eldoc-documentation-compose is used
Date: Fri, 14 Apr 2023 01:16:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Dmitry Gutov <dmitry@gutov.dev> writes:

> On 14/04/2023 02:23, João Távora wrote:
>> Dmitry Gutov <dmitry@gutov.dev> writes:
>> 
>>> I still see the problem with window jumping and blinking when typing
>>> with company-mode enabled, though. You say: "I do use company and
>>> multi-line echo areas liberally". Do you have some extra configuration
>>> for company-frontends?
>> Not that I know of.  I just use a TTY frame.  I don't see it.  The
>> echo
>> area is frequently empty for me when selecting Eglot completions (in
>> clangd, the server I most use nowadays).
>> 
>>> 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.

>>> 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".  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.

>> 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.

>> 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.

João





reply via email to

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