non-Jedi / eglot-jl

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

repeated server disconnect and reconnect after upgrading emacs package #30

Closed LarryLegend33 closed 1 year ago

LarryLegend33 commented 2 years ago

title of post is exactly what's happening. in the events log I see two errors:

First Error:

[stderr] ERROR: MethodError: no method matching (::LanguageServer.var"#93#95"{LanguageServerInstance})(::String, ::Int64) [stderr] Closest candidates are: [stderr] Closest candidates are: [stderr] (::LanguageServer.var"#93#95")(::Any) at /Users/nightcrawler/.julia/packages/LanguageServer/JrIEf/src/languageserverinstance.jl:185

Second Error:

[stderr] ERROR: LoadError: TypeError: in Expr, expected Symbol, got a value of type CSTParser.EXPR [stderr] Stacktrace: [stderr] [1] Expr [stderr] @ ./boot.jl:253 [inlined] [stderr] [2] get_signatures(x::CSTParser.EXPR, tls::StaticLint.Scope, sigs::Vector{LanguageServer.SignatureInformation}, env::StaticLint.ExternalEnv) [stderr] @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/signatures.jl:68 [stderr] [3] get_signatures(b::StaticLint.Binding, tls::StaticLint.Scope, sigs::Vector{LanguageServer.SignatureInformation}, env::StaticLint.ExternalEnv) [stderr] @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/signatures.jl:45 [stderr] [4] textDocument_signatureHelp_request(params::LanguageServer.TextDocumentPositionParams, server::LanguageServerInstance, conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}) [stderr] @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/signatures.jl:18 [stderr] [5] (::LanguageServer.var"#96#97"{typeof(LanguageServer.textDocument_signatureHelp_request), LanguageServerInstance})(conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, params::LanguageServer.TextDocumentPositionParams) [stderr] @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/languageserverinstance.jl:252 [stderr] [6] dispatch_msg(x::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::JSONRPC.MsgDispatcher, msg::Dict{String, Any}) [stderr] @ JSONRPC ~/.julia/packages/JSONRPC/yu0G3/src/typed.jl:67 [stderr] [7] run(server::LanguageServerInstance) [stderr] @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/languageserverinstance.jl:361 [stderr] [8] top-level scope [stderr] @ ~/.emacs.d/elpa/eglot-jl-20211208.359/eglot-jl.jl:51 [stderr] in expression starting at /Users/nightcrawler/.emacs.d/elpa/eglot-jl-20211208.359/eglot-jl.jl:51 [internal] Fri Dec 17 00:44:32 2021: (:message "Connection state changed" :change "exited abnormally with code 1\n")

ffevotte commented 2 years ago

It looks like there is currently an upstream issue with LanguageServer, that affects eglot-jl. It looks like this is fixed in LanguageServer.jl#master, but we'll have to wait for a new release to be tagged before we can ship an up-to-date Manifest. In the meantime, you can get around the issue by using customized versions of LanguageServer & SymbolServer.

Here is a step-by-step guide that I think should work as a temporary workaround:

  1. make a new, empty directory to store the customized project: mkdir /some/path/to/projectdir
  2. create a Julia project in that directory, declaring dependencies to SymbolServer and LanguageServer#master:
    julia> using Pkg
    julia> Pkg.activate("/some/path/to/projectdir")
    julia> pkg"add SymbolServer, LanguageServer#master"
  3. in your emacs configuration file, setup eglot-jl so that it uses the newly created project:
    (setq  eglot-jl-language-server-project "/some/path/to/projectdir")

That should do it; please do not hesitate to report back whether this worked. In any case, we should probably keep this issue open until a new version of LanguageServer is released, that we can properly reference in the Manifest.toml shipped with eglot-jl

karthink commented 2 years ago

I just tried this and can confirm that it works. The upstream issue is still unfixed.

vbmithr commented 2 years ago

Hi. I still have issues with language server reconnecting. I see that a new languageserver has been released. Does it makes sense to update this package now?

Best, Vincent

zsteve commented 2 years ago

Had the same issue as OP and the proposed fix by using LanguageServer#master works. Apparently any new release of LanguageServer (if any) still doesn't fix this?

non-Jedi commented 2 years ago

Sorry. This is my bad. I haven't been using eglot lately. I think all that's needed is to update eglot-jl's Manifest.toml to use all the latest tagged versions. Not sure when I'll get around to doing so, but I'd merge a PR if someone else wants to fix it up.

rdiaz02 commented 2 years ago

For other new Julia users like me, who stumble upon this issue, I think the issue is solved, as of now (2022-10-26, Julia 1.8.2) as follows:

This procedure updates Manifest.toml and Project.toml in ~/.emacs.d/elpa/eglot-jl-20211208.359. You can now start emacs, and eglot-jl will work, including linting.

However, if we look at the logs (M-x eglot-events-buffer) we still see lines like

[stderr] ┌ Info: Couldn't retrieve cache file for ArrayInterfaceStaticArraysCore.
[stderr] └   exception = HTTP/2 404 while requesting https://www.julia-vscode.org/symbolcache/store/v1/packages/A/ArrayInterfaceStaticArraysCore_dd5226c6-a4d4-4bc7-8575-46859f9c95b9/v0.1.3_93c8ba53d8d26e124a5a8d4ec914c3a16e6a0970.tar.gz

and

[stderr] ┌ Warning: LibSSH2_jll not stored on disc
[stderr] └ @ SymbolServer ~/.julia/packages/SymbolServer/LMSFX/src/SymbolServer.jl:247

(...)
[stderr] ┌ Warning: MKL_jll not stored on disc
[stderr] └ @ SymbolServer ~/.julia/packages/SymbolServer/LMSFX/src/SymbolServer.jl:247

These I do not understand (I have those packages already present under ~/.julia/packages), but this seems innocuous (and I wonder if the warnings from SymboServer are related to https://github.com/julia-vscode/SymbolServer.jl/issues/124).

Edit: I can make a PR with the new Manifest.toml and Project.toml, if that helps, but being new to Julia I'd hesitate to trust me :sweat_smile: .

hochata commented 1 year ago

@rdiaz02 I would say yes to creating a MR with the updated manifest. This package is not very usable without it.

rdiaz02 commented 1 year ago

PR created.

non-Jedi commented 1 year ago

Should be fixed by #31.