Subject: Re: bug#65418: 29.1; Eglot: support clangd inactiveRegions extension

From: Filippo Argiolas <[email-masked]>
Date: Sun, 27 Aug 2023 12:52:58 +0200

On Fri, Aug 25, 2023 at 2:16 PM João Távora <[email-masked]> wrote:
>
> Filippo Argiolas <[email-masked]> writes:
>
> OK, after fetching that git snapshot today, I've done this:
>
> It's bare-bone but it works, because the method for communicating
> "inactive regions" is very basic (and similar to unsolicited
> diagnostics).
>
> Only minimally tested, so YMMV.
>
> This serves as a good example of how to support unofficial LSP
> extensions using Eglot as an API.  Could well be in the manual.
>
> The method for providing a client-side capability based on a server is
> crude.  Servers do identify themselves properly via LSP, but only after
> being initialized, so it's too late and I had to use an heuritic based
> on the command.  We could also use a proper subclass for clangd servers,
> but that's too verbose and overkill IMHO.

That's great! Definitely owe you a beer or a bottle of your favorite beverage!
Still testing it but so far it seems to work perfectly! Love that
clangd is smart enough to classify as inactive also other stuff beyond
ifdefs, like headers included but not used.

About the heuristic would it be that bad to just include
inactiveRegions in the general client capabilities? Guess it would be
just ignored by other servers not supporting it, wouldn't it? Kind of
surprised clangd doesn't use some kind of namespacing convention for
their protocol extensions.

Anyway, it would be great if this could be a part of eglot but I can
understand being careful given it's not in the standard protocol and
not even in a released clangd yet.
It would be great though if this example was included in the docs. It
says a lot about how easy to extend and well designed eglot is.

One thing about UI, all the themes I tried seem to render shadow as
grey-ish but it was my impression reading the docs that it would be a
dim version of the current face, so it would still have syntax
highlighting. Is it just a theme limitation (probably because shadow
wasn't used for something like this before) or it's not technically
possible?

Thanks a lot again,
Filippo