Closed llj098 closed 5 years ago
It looks like the server is LSP Java server is returning wrong location info. I have seen this error sometimes when using openjdk or when the project is not imported correctly. Can you share which version of java do you use? I will fix the code on lsp-mode
side to skip items with location set to nil.
Thanks for your reply!
my java version:
java -version java version "11.0.1" 2018-10-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
On Fri, Nov 2, 2018 at 12:38 PM Ivan Yonchovski notifications@github.com wrote:
It looks like the server is LSP Java server is returning wrong location info. I have seen this error sometimes when using openjdk or when the project is not imported correctly. Can you share which version of java do you use? I will fix the code on lsp-mode side to skip items with location set to nil.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/emacs-lsp/lsp-mode/issues/466#issuecomment-435269069, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIfuxp9uxllO5MpAljW7nV-fKBL_Tr9ks5uq8xKgaJpZM4YLAi7 .
Yeah, it looks like the references problem is related to the java version, can you try with oracle jdk 8/9?
OK, I'm using macOS now, however I already deleted java8. Later on I'll install it, and let you know.
Thanks!
On Fri, Nov 2, 2018 at 1:40 PM Ivan Yonchovski notifications@github.com wrote:
Yeah, it looks like the references problem is related to the java version, can you try with oracle jdk 8/9?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/emacs-lsp/lsp-mode/issues/466#issuecomment-435276887, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIfu9Cy0i_p5ChEvQlyUgfVK-THisr_ks5uq9rUgaJpZM4YLAi7 .
Hello, I have delete java11 and test with java8, same error
On Fri, Nov 2, 2018 at 1:40 PM Ivan Yonchovski notifications@github.com wrote:
Yeah, it looks like the references problem is related to the java version, can you try with oracle jdk 8/9?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/emacs-lsp/lsp-mode/issues/466#issuecomment-435276887, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIfu9Cy0i_p5ChEvQlyUgfVK-THisr_ks5uq9rUgaJpZM4YLAi7 .
Can you include the whole messages communication + reproducing the issue from the start to that point with lsp-print-io
set to t
? Also, the used java is controlled by lsp-java-java-path
. The log you have attached does not include that info.
Additionally, if it is possible, can you include the whole java project that you are trying to use?
If you are getting this error every time you try to fetch references, it might be due to the language server sending an array of DocumentSymbol
objects, instead of SymbolInformation
. The xref methods in lsp-mode
currently don't support DocumentSymbol
.
This may be related to xref-prompt-for-identifier
. See https://github.com/MaskRay/ccls/wiki/Emacs#find-definitionsreferences Also see a related discussion on eglot https://github.com/joaotavora/eglot/issues/147
textDocument/references
does not return DocumentSymbol[]
. The issue is the useless prompt and its fallout.
I'm getting this failure in C/C++ code using emacs-ccls as noted by @MaskRay above. The link to the ccls wiki seems to be broken but I followed the eglot bug link and read that.
Is there a way for this to be resolved since LSP doesn't provide an equivalent to the tags-type "lookup all matches for this symbol"?
Having a very common function like xref-find-references generate a Lisp error is probably not great :grin:. If we can't solve this, maybe we need to do a bit of defensive coding here to avoid throwing an error in this situation?
@madscientist Read my comment above. I just don't use xref-find-references
as its xref-prompt-for-identifier
is not suitable for LSP.
Yes, but it's not good that loading lsp will automatically replace a commonly-used keybinding with a function which throws an error. Either the binding shouldn't be replaced, or the new function should catch the error situation and print a message like "Unsupported in LSP" with a pointer to a wiki page for more info, or something like that.
It's just going to lead to many more people filing duplicate issues or commenting on existing issues to leave things as they are.
9111fb1 have fixed the original issue only which was caused by JDT LS returning nil symbol references. @MaskRay about the xref-find-references I believe that we could fix it by using creating lsp-find-references which uses lsp-find-custom and then rebinding it to xref-find-references like lsp-ui do:
(define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
Describe the bug in a java project, on a method, I run the command
xref-find-references
emacs shows:wrong type argument: hash-table-p, nil
To Reproduce in a java project. run
xref-find-references
on a method symbol. lsp-mode version: 20181031.1905 lsp-java version: 20181025.1822Expected behavior list all the references
Which Language Server did you use lsp-java
OS mac os
Error callstack
Attachment: message.log