Subject: bug#69657: Missing imenu entries with eglot

From: Felician Nemeth <[email-masked]>
Date: Sat, 09 Mar 2024 17:20:12 +0100

CC-ing João, the maintainer of breadcrumb-mode.

> I did M-x imenu, although I should add that I normally use
> consult-imenu, which presents a flattened menu. That's also what I wrote
> the patch for.

Without the patch, I can jump to "bar" (M-x imenu RET Foo RET bar RET)
and cannot jump to "Foo".  With the patch, I can jump to "Foo" (M-x
imenu RET Foo RET) and cannot jump to "bar".

So the default / basic behavior has changed, but I don't think it is a
definit improvement.

>> On the other hand, the patch seems to ruin breadcrumb-mode: putting
>> the point after "{}", the breadcrumb header line shows: "dir/test.cpp:
>> Class > Foo" instead of the original "dir/test.cpp: Class > Foo >
>> bar".
>
> If you move point _after_ "{}", you're outside of method "bar", aren't
> you? Doesn't that mean the breadcrumb header is correct now and was
> wrong before?

This is the first time I use breadcrumb, so I don't really know what is
the exact correct behaviour.  But without the patch there are locations
for with "bar" is present it the breadcrumb header, and with the patch
there isn't any.

Maybe this is a bug in breadcrumb, but applying the current version of
the patch is going to ruin an existing feature.

Additionally, with the patch, the *Completions* buffer shows: "3
possible completions: *Rescan* Foo".  So maybe there is a bug in imenu
as well, since it seems it cannot handle items having the same name.

> for the record, this is the textDocument/documentSymbol response I'm
> getting for the example in my original message:  [...]

This is what I get as well, so luckily the different clangd versions
don't cause problems.

----

By the way, I haven't used consult before, but after a quick look at it,
I think consult-imenu could use the breadcrumb-kind text properties to
show additional information in its live preview mode.