-
Notifications
You must be signed in to change notification settings - Fork 202
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
eglot with ido and imenu #535
Comments
I am testing with: this is the contenf of file emacsq-test-eglot.el:
(defun s-load-now/eglot () (require 'cl) |
aramirez <notifications@github.com> writes:
And I am getting this error:
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p ([(:kind 12 :name functx :range (:end (:character
Do you also get this error when you use regular Imenu?
João
|
Does your code handle special elements from
Related issues in other packages: |
>>>> "João" == João Távora ***@***.***> writes:
[...]
> And I am getting this error: --8<---------------cut
> here---------------start------------->8--- Debugger entered--Lisp error: (wrong-type-argument
> integer-or-marker-p ([(:kind 12 :name functx :range (:end (:character
João> Do you also get this error when you use regular Imenu?
No. It works pretty fine.
You could have tested it. with the file I
posted (JIC):
--8<---------------cut here---------------start------------->8---
emacs -Q -l /tmp/emacsq-test-eglot.el
--8<---------------cut here---------------end--------------->8---
BR
|
aramirez <notifications@github.com> writes:
>>>>> "João" == João Távora ***@***.***> writes:
[...]
>> And I am getting this error: --8<---------------cut
>> here---------------start------------->8--- Debugger entered--Lisp error: (wrong-type-argument
>> integer-or-marker-p ([(:kind 12 :name functx :range (:end (:character
João> Do you also get this error when you use regular Imenu?
No. It works pretty fine.
In that case, the problem lies in the code you posted, not in Eglot,
which is designed to work with Emacs. This is why I'm closing this bug
report, but you can keep discussing or posting results of your
investigation here.
I'm sorry, but I personally don't have time to test your code. Andrii
has suggested a possible fix to this.
João
|
Hi Joao: I made this very straight forward function for @aramirez to reproduce the ido-imenu behavior in
He said that this worked even with LSP. Do you have an idea why it is failing with eglot? Best, |
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
I am using the function ido-imenu
(defun ido-imenu ()
"Update the imenu index and then use ido to select a symbol to navigate to.
Symbols matching the text at point are put first in the completion list."
(interactive)
(imenu--make-index-alist)
(let ((name-and-pos '())
(symbol-names '()))
(flet ((addsymbols (symbol-list)
(when (listp symbol-list)
(dolist (symbol symbol-list)
(let ((name nil) (position nil))
(cond
((and (listp symbol) (imenu--subalist-p symbol))
(addsymbols symbol))
On this source code:
--8<---------------cut here---------------start------------->8---
#include <stdio.h>
void main() {
int var;
var = 10;
double dvar;
dvar = 0;
dvar = dvar + var;
}
void functx() {
}
--8<---------------cut here---------------end--------------->8---
In GNU Emacs 27.1 (build 1, armv7l-unknown-linux-gnueabihf, X toolkit, Xaw3d scroll bars)
System Description: Arch Linux ARM
This is my eglot version:
--8<---------------cut here---------------start------------->8---
eglot-20200830.1254
--8<---------------cut here---------------end--------------->8---
And I am getting this error:
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p ([(:kind 12 :name functx :range (:end (:character 0 :line 12) :start (:character 0 :line 10)) :selectionRange (:end (:character 11 :line 10) :start (:character 5 :line 10)))] #f(compiled-function (name one-obj-array) #<bytecode -0x1ffffffff9beac48>)))
goto-char(([(:kind 12 :name functx :range (:end (:character 0 :line 12) :start (:character 0 :line 10)) :selectionRange (:end (:character 11 :line 10) :start (:character 5 :line 10)))] #f(compiled-function (name one-obj-array) #<bytecode -0x1ffffffff9beac48>)))
(let* ((selected-symbol (ido-completing-read Symbol? symbol-names)) (position (cdr (assoc selected-symbol name-and-pos)))) (goto-char position))
(let ((name-and-pos 'nil) (symbol-names 'nil)) (flet ((addsymbols (symbol-list) (when (listp symbol-list) (dolist (symbol symbol-list) (let (... ...) (cond ... ... ...) (unless ... ... ...)))))) (addsymbols imenu--index-alist)) (let ((symbol-at-point (thing-at-point 'symbol))) (if symbol-at-point (progn (let* ((regexp (concat ... )) (matching-symbols (delq nil ...))) (if matching-symbols (progn (sort matching-symbols ...) (mapc ... matching-symbols))))))) (let* ((selected-symbol (ido-completing-read Symbol? symbol-names)) (position (cdr (assoc selected-symbol name-and-pos)))) (goto-char position)))
emacswiki/ido-imenu()
funcall-interactively(emacswiki/ido-imenu)
call-interactively(emacswiki/ido-imenu nil nil)
command-execute(emacswiki/ido-imenu)
--8<---------------cut here---------------end--------------->8---
Best Regards
The text was updated successfully, but these errors were encountered: