unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Sebastian Poeplau via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "João Távora" <joaotavora@gmail.com>
Cc: 69657@debbugs.gnu.org, Felician Nemeth <felician.nemeth@gmail.com>
Subject: bug#69657: Missing imenu entries with eglot
Date: Sun, 10 Mar 2024 20:15:04 +0100	[thread overview]
Message-ID: <87frwxuc1w.fsf@mailbox.org> (raw)
In-Reply-To: <87jzmat5qe.fsf@mailbox.org>

> 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	other threads:[~2024-03-10 19:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08 20:01 bug#69657: Missing imenu entries with eglot Sebastian Poeplau via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-08 21:44 ` Felician Nemeth
2024-03-08 22:28   ` Sebastian Poeplau via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-09 16:20     ` Felician Nemeth
2024-03-10  1:05       ` João Távora
2024-03-10 16:15         ` Sebastian Poeplau via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-10 19:15           ` Sebastian Poeplau via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-03-10 19:33             ` João Távora
2024-03-17 11:04               ` Sebastian Poeplau via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87frwxuc1w.fsf@mailbox.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=69657@debbugs.gnu.org \
    --cc=felician.nemeth@gmail.com \
    --cc=joaotavora@gmail.com \
    --cc=sebastian.poeplau@mailbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).