non-Jedi / eglot-jl

Wrapper for using Julia LanguageServer.jl with emacs eglot
Creative Commons Zero v1.0 Universal
61 stars 11 forks source link

LanguageServer crashes trying to get `length(nothing)` #3

Closed vvpisarev closed 4 years ago

vvpisarev commented 4 years ago

Occasionally, Eglot sends nil where LanguageServer expects an array, which crashes LanguageServer.

My actions causing the crash:

versioninfo():

Julia Version 1.4.0
Commit b8e9a9ecc6 (2020-03-21 16:36 UTC)
Platform Info:
  OS: Linux (x86_64-suse-linux)
  CPU: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, ivybridge)

File it crashes on: anything I tried. In particular: https://gist.github.com/vvpisarev/92a2c38ab31a63e63820b8e9d48e8a4a#file-sim_type-jl

Events log: https://gist.github.com/vvpisarev/92a2c38ab31a63e63820b8e9d48e8a4a#file-eglot-events Stderr: https://gist.github.com/vvpisarev/92a2c38ab31a63e63820b8e9d48e8a4a#file-eglot-stderr

There are line 117 in events and similar ones later indicating that emacs sent messages with :result nil.

non-Jedi commented 4 years ago

Thanks for the bug report.

I'm currently running into the eglot companion issue to https://github.com/non-Jedi/lsp-julia/issues/20 on my own computer. I think I need to switch to using my own depot for vendoring in the LanguageServer.jl deps to get better reproducibility, and then we should be able to figure out what's going on with your problem.

See #4

vvpisarev commented 4 years ago

Thanks!

Interesting... I get the no method matching is_stdlib(), too, but only when the default environment is used. If I'm in a package, it's length(::Nothing) error. The paths in the error messages point to LanguageServer v.1.1.0-DEV and SymbolServer v.2.0.1-DEV though, not the versions from the default environment.

non-Jedi commented 4 years ago

Could you post the events log and stderr from #5 so I don't have to debug this against an old version of LanguageServer.jl please? I have been unable to replicate thus far.

EDIT: or against current master now.

vvpisarev commented 4 years ago

Here: https://gist.github.com/vvpisarev/293c5ff793fbe84ea396c1d38edea3c2

The logs are for running eglot on eglot-jl.jl itself.

non-Jedi commented 4 years ago

Looks like the problem is that eglot is responding with a nil results field in a workspace/configuration response. By my reading of the language server protocol spec this should always be a list/collection (any[]).

I will open an issue against eglot and tag you in it to provide further information.

non-Jedi commented 4 years ago

@vvpisarev please try again with master of eglot. This error is likely the same as https://github.com/joaotavora/eglot/issues/340 and fixed by https://github.com/xuchunyang/eglot/commit/5de7c55dddc14d12937e371e7f7445411c397bcd

vvpisarev commented 4 years ago

Aha, that seems to be it.

Thank you for the help!