-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature request] Make eglot works with speedbar #536
Comments
That would be a good addition. Speedbar is very handy when working with files with a lot of definitions. |
Or maybe speedbar can understand the correct format of imenu. Eglot is doing nothing more than follow the established format:
|
A now-deleted I received this morning by one "Tom F" stated the following: "sb-imenu as described in https://stackoverflow.com/a/36893492 can do this. I'm using eglot with it." |
After But when I click or press return on the item, it reports error:
|
That probably explains why the poster deleted the comment. Get someone with Elisp skills to fix speedbar-imenu. Maybe talk to its author. It shouldn't be hard, but unfortunately, I have no time for this. I do know that M-x imenu works.That's the thing that exists in Emacs, and that's what I'm coding for. Other extensions must also code for Emacs, then they will work with Eglot. |
@joaotavora Below is my attempt to make eglot-imenu work with speedbar by transform the complex alist form to the simple form. ;; borrow from eglot-imenu
(defun eglot-imenu-get-point (one-obj-array)
(car (eglot--range-region
(eglot--dcase (aref one-obj-array 0)
(((SymbolInformation) location)
(plist-get location :range))
(((DocumentSymbol) selectionRange)
selectionRange)))))
(defun eglot-imenu-to-simple-form (menu)
(cl-loop for form in menu
collect (cons (car form)
(if (imenu--subalist-p form)
(eglot-imenu-to-simple-form (cdr form))
(eglot-imenu-get-point (cadr form))))))
(advice-add #'eglot-imenu :filter-return #'eglot-imenu-to-simple-form)
;; optional, prevent speedbar from creating additional tags for long entries
(setq speedbar-tag-regroup-maximum-length 100) Testing on linux kernel with clangd, looks ok to me: I've made a bug report to ask support for complex imenu form in speedbar, see https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-06/msg01058.html. |
Fix #758, #536, #535. Eglot's eglot-imenu returned a structure compliant with the rules outlined in imenu--index-alist. In particular, it returned some elements of the form (INDEX-NAME POSITION GOTO-FN ARGUMENTS...) The original intention (mine) must have been to allow fancy highlighting of the position navigated to with a custom GOTO-FN. Not only was access to that fanciness never implemented, but many other imenu frontends do not support such elements. See for example #758, #536, #535. And also related issues in other packages: colonelpanic8/flimenu#6 bmag/imenu-list#58 So it's best to remove this problematic feature for now. It can be added back later. * eglot.el (eglot-imenu): Simplify. * NEWS.md: Mention change
Fix joaotavora/eglot#758, joaotavora/eglot#536, joaotavora/eglot#535. Eglot's eglot-imenu returned a structure compliant with the rules outlined in imenu--index-alist. In particular, it returned some elements of the form (INDEX-NAME POSITION GOTO-FN ARGUMENTS...) The original intention (mine) must have been to allow fancy highlighting of the position navigated to with a custom GOTO-FN. Not only was access to that fanciness never implemented, but many other imenu frontends do not support such elements. See for example joaotavora/eglot#758, joaotavora/eglot#536, joaotavora/eglot#535. And also related issues in other packages: colonelpanic8/flimenu#6 bmag/imenu-list#58 So it's best to remove this problematic feature for now. It can be added back later. * eglot.el (eglot-imenu): Simplify. * NEWS.md: Mention change
Fix joaotavora/eglot#758, joaotavora/eglot#536, joaotavora/eglot#535. Eglot's eglot-imenu returned a structure compliant with the rules outlined in imenu--index-alist. In particular, it returned some elements of the form (INDEX-NAME POSITION GOTO-FN ARGUMENTS...) The original intention (mine) must have been to allow fancy highlighting of the position navigated to with a custom GOTO-FN. Not only was access to that fanciness never implemented, but many other imenu frontends do not support such elements. See for example joaotavora/eglot#758, joaotavora/eglot#536, joaotavora/eglot#535. And also related issues in other packages: colonelpanic8/flimenu#6 bmag/imenu-list#58 So it's best to remove this problematic feature for now. It can be added back later. * eglot.el (eglot-imenu): Simplify. * NEWS.md: Mention change
Fix #758, #536, #535. Eglot's eglot-imenu returned a structure compliant with the rules outlined in imenu--index-alist. In particular, it returned some elements of the form (INDEX-NAME POSITION GOTO-FN ARGUMENTS...) The original intention (mine) must have been to allow fancy highlighting of the position navigated to with a custom GOTO-FN. Not only was access to that fanciness never implemented, but many other imenu frontends do not support such elements. See for example #758, #536, #535. And also related issues in other packages: colonelpanic8/flimenu#6 bmag/imenu-list#58 So it's best to remove this problematic feature for now. It can be added back later. * eglot.el (eglot-imenu): Simplify. * NEWS.md: Mention change #758: joaotavora/eglot#758 #536: joaotavora/eglot#536 #535: joaotavora/eglot#535 #758: joaotavora/eglot#758 #536: joaotavora/eglot#536 #535: joaotavora/eglot#535
Fix joaotavora/eglot#758, joaotavora/eglot#536, joaotavora/eglot#535. Eglot's eglot-imenu returned a structure compliant with the rules outlined in imenu--index-alist. In particular, it returned some elements of the form (INDEX-NAME POSITION GOTO-FN ARGUMENTS...) The original intention (mine) must have been to allow fancy highlighting of the position navigated to with a custom GOTO-FN. Not only was access to that fanciness never implemented, but many other imenu frontends do not support such elements. See for example joaotavora/eglot#758, joaotavora/eglot#536, joaotavora/eglot#535. And also related issues in other packages: colonelpanic8/flimenu#6 bmag/imenu-list#58 So it's best to remove this problematic feature for now. It can be added back later. * eglot.el (eglot-imenu): Simplify. * NEWS.md: Mention change
Fix joaotavora/eglot#758, joaotavora/eglot#536, joaotavora/eglot#535. Eglot's eglot-imenu returned a structure compliant with the rules outlined in imenu--index-alist. In particular, it returned some elements of the form (INDEX-NAME POSITION GOTO-FN ARGUMENTS...) The original intention (mine) must have been to allow fancy highlighting of the position navigated to with a custom GOTO-FN. Not only was access to that fanciness never implemented, but many other imenu frontends do not support such elements. See for example joaotavora/eglot#758, joaotavora/eglot#536, joaotavora/eglot#535. And also related issues in other packages: colonelpanic8/flimenu#6 bmag/imenu-list#58 So it's best to remove this problematic feature for now. It can be added back later. * eglot.el (eglot-imenu): Simplify. * NEWS.md: Mention change
Speedbar can use imenu to get definitions in a file and display them as tags. (if the return value of
imenu-create-index-function
is of the from(INDEX-NAME POSITION)
, speedbar can handle this for free) However, when I tried using speedbar with eglot, speedbar complained "speedbar-insert-generic-list: malformed list!" since it didn't know how to insert the result ofeglot-imenu
as tags.It might be useful to make eglot work with speedbar so that we will have tree-like structure to show major definitions for each file.
The text was updated successfully, but these errors were encountered: