GNU bug report logs - #69657
Missing imenu entries with eglot

Previous Next

Package: emacs;

Reported by: Sebastian Poeplau <sebastian.poeplau <at> mailbox.org>

Date: Fri, 8 Mar 2024 20:33:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Sebastian Poeplau <sebastian.poeplau <at> mailbox.org>
To: João Távora <joaotavora <at> gmail.com>
Cc: 69657 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth <at> gmail.com>
Subject: bug#69657: Missing imenu entries with eglot
Date: Sun, 10 Mar 2024 20:15:04 +0100
> I wonder why I did get separate entries in consult-imenu with pylsp
> though. I'll have to give it another look, but it seems to me that in
> this case (e.g., with SymbolInformation objects) eglot's imenu function
> returns data that (a) works with plain imenu and (b) gives me what I
> expect with consult-imenu.

Here's the return value of eglot-imenu with pylsp:

((#1="Class"
     (#("Foo" 0 3 (breadcrumb-kind #1# breadcrumb-region (1 . 44))) . 1))
 (#2="Method"
     ("Foo" (#("bar" 0 3 (breadcrumb-kind #2# breadcrumb-region (16 . 44))) . 16))))

The Python code I used is the following:

  class Foo:
      def bar(self):
          pass

Like I said before, in this case I would consider the behavior of plain
imenu, consult-imenu, and which-function-mode as correct, even though
they don't use the breadcrumb annotations. I can jump to both the class
and the method, and outside the method which-function-mode tells me that
I'm in Foo. Maybe we could make eglot produce something similar for the
data from clangd...

For completeness, this is pylsp's response to
textDocument/documentSymbol:

{
  "jsonrpc": "2.0",
  "id": 21,
  "result": [
    {
      "name": "Foo",
      "containerName": null,
      "location": {
        "uri": "file:///tmp/test.py",
        "range": {
          "start": {
            "line": 0,
            "character": 0
          },
          "end": {
            "line": 3,
            "character": 0
          }
        }
      },
      "kind": 5
    },
    {
      "name": "bar",
      "containerName": "Foo",
      "location": {
        "uri": "file:///tmp/test.py",
        "range": {
          "start": {
            "line": 1,
            "character": 4
          },
          "end": {
            "line": 3,
            "character": 0
          }
        }
      },
      "kind": 6
    }
  ]
}




This bug report was last modified 1 year and 93 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.