gdkrmr / lsp-julia

MIT License
70 stars 19 forks source link

languageserver crashes because of `MethodError: no method matching Union{Int64, String}(::String)` #40

Closed Gijs-Koot closed 3 years ago

Gijs-Koot commented 4 years ago

When starting the LanguageServer with lsp, the LanguageServer starts but eventually crashes with the following error appearing in julia-ls:stderr;

[ Info: Received new data from Julia Symbol Server.
ERROR: MethodError: no method matching Union{Int64, String}(::String)
Stacktrace:
 [1] LanguageServer.InitializeParams(::Dict{String,Any}) at /home/gijs/.julia/packages/LanguageServer/y1ebo/src/protocol/initialize.jl:111
 [2] dispatch_msg(::JSONRPC.JSONRPCEndpoint, ::JSONRPC.MsgDispatcher, ::Dict{String,Any}) at /home/gijs/.julia/packages/JSONRPC/1Kq3H/src/typed.jl:64
 [3] run(::LanguageServerInstance) at /home/gijs/.julia/packages/LanguageServer/y1ebo/src/languageserverinstance.jl:308
 [4] top-level scope at none:1

This is an issue that was filed at julia-vscode/LanguageServer.jl as well, more details there https://github.com/julia-vscode/LanguageServer.jl/issues/651.

If I understand correctly, a fix has been merged here https://github.com/julia-vscode/LanguageServer.jl/pull/821, but this isn't present in the latest release.

If I install the master branch directly, with

(@v1.5) pkg> add https://github.com/julia-vscode/LanguageServer.jl

the server starts without this error and appears to work well. This will eventually be resolved by a new release of LanguageServer.jl, but I thought to file this anyway for anyone using lsp-julia.

ki-chi commented 4 years ago

Do you use create_sysimage() in PackageCompiler.jl?

As the comment on the issue of julia-vscode/LanguageServer.jl#836, the error may be caused by precompiling LanguageServer with PackageCompiler.

Skipped the precompile, it works well on my environment. (LanguageServer v3.2.0 and Julia v1.5)

Gijs-Koot commented 4 years ago

The command issued to julia by this package doesn't include it, and I didn't consciously precompile it no. Also, I don't have PackageCompiler installed, so it seems unlikely that I'm using an image somewhere. The bug above does appear to explain it, and I'm just using master until the fix is merged. Thanks.

danmrc commented 3 years ago

Did this changed? I have the same issue, and I have not used PackageCompiler.jl

I can't use the add https://github.com/julia-vscode/LanguageServer.jl because it conflicts with some packages

Thanks in advance

roiholtzman commented 3 years ago

I also have this issue.

gdkrmr commented 3 years ago

should be solved now