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

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

bug#69657: Missing imenu entries with eglot


From: Sebastian Poeplau
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
    }
  ]
}





reply via email to

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