gdkrmr / lsp-julia

MIT License
70 stars 19 forks source link

LanguageServer crash TypeError: in Expr, expected Symbol, got a value of type CSTParser.EXPR #56

Closed fbkarsdorp closed 2 years ago

fbkarsdorp commented 2 years ago

I'm having trouble getting lsp-julia to run properly. From the log below, it seems that exception = TypeError: in Expr, expected Symbol, got a value of type CSTParser.EXPR is the problem. Not sure how to proceed from here. But perhaps the error is familiar to you?

Updating registry at `~/.julia/registries/General` Updating `~/.emacs.d/elpa/lsp-julia-20210530.2152/languageserver/Project.toml` [2b0e0bc5] + LanguageServer v4.1.0 [cf896787] + SymbolServer v7.1.0 Updating `~/.emacs.d/elpa/lsp-julia-20210530.2152/languageserver/Manifest.toml` [00ebfdb7] + CSTParser v3.3.0 [ffa9a821] + DocumentFormat v3.2.4 [48062228] + FilePathsBase v0.9.16 [682c06a0] + JSON v0.21.2 [b9b8584e] + JSONRPC v1.3.3 [2b0e0bc5] + LanguageServer v4.1.0 [69de0a69] + Parsers v2.1.2 [b3cc710f] + StaticLint v8.0.1 [cf896787] + SymbolServer v7.1.0 [0796e94c] + Tokenize v0.5.21 [30578b45] + URIParser v0.4.1 [0dad84c5] + ArgTools [56f22d72] + Artifacts [2a0f44e3] + Base64 [ade2ca70] + Dates [f43a241f] + Downloads [b77e0a4c] + InteractiveUtils [b27032c2] + LibCURL [76f85450] + LibGit2 [8f399da3] + Libdl [56ddb016] + Logging [d6f4376e] + Markdown [a63ad114] + Mmap [ca575930] + NetworkOptions [44cfe95a] + Pkg [de0858da] + Printf [3fa0cd96] + REPL [9a3f8284] + Random [ea8e919c] + SHA [9e88b42a] + Serialization [6462fe0b] + Sockets [fa267f1f] + TOML [a4e569a6] + Tar [8dfed614] + Test [cf7118a7] + UUIDs [4ec0a83e] + Unicode [deac9b47] + LibCURL_jll [29816b5a] + LibSSH2_jll [c8ffd9c3] + MbedTLS_jll [14a3606d] + MozillaCACerts_jll [83775a58] + Zlib_jll [8e850ede] + nghttp2_jll [3f19e933] + p7zip_jll [ Info: Received new data from Julia Symbol Server. ┌ Error: get_hover failed to convert Expr │ exception = │ TypeError: in Expr, expected Symbol, got a value of type CSTParser.EXPR │ Stacktrace: │ [1] Expr │ @ ./boot.jl:253 [inlined] │ [2] get_hover(b::StaticLint.Binding, documentation::String, server::LanguageServerInstance) │ @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/hover.jl:58 │ [3] get_hover(x::CSTParser.EXPR, documentation::String, server::LanguageServerInstance) │ @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/hover.jl:20 │ [4] textDocument_hover_request(params::LanguageServer.TextDocumentPositionParams, server::LanguageServerInstance, conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}) │ @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/hover.jl:6 │ [5] (::LanguageServer.var"#96#97"{typeof(LanguageServer.textDocument_hover_request), LanguageServerInstance})(conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, params::LanguageServer.TextDocumentPositionParams) │ @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/languageserverinstance.jl:252 │ [6] dispatch_msg(x::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::JSONRPC.MsgDispatcher, msg::Dict{String, Any}) │ @ JSONRPC ~/.julia/packages/JSONRPC/yu0G3/src/typed.jl:67 │ [7] run(server::LanguageServerInstance) │ @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/languageserverinstance.jl:361 │ [8] top-level scope │ @ none:1 │ [9] eval │ @ ./boot.jl:360 [inlined] │ [10] exec_options(opts::Base.JLOptions) │ @ Base ./client.jl:261 │ [11] _start() │ @ Base ./client.jl:485 └ @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/hover.jl:60 ERROR: get_hover failed to convert Expr Stacktrace: [1] get_hover(b::StaticLint.Binding, documentation::String, server::LanguageServerInstance) @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/hover.jl:61 [2] get_hover(x::CSTParser.EXPR, documentation::String, server::LanguageServerInstance) @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/hover.jl:20 [3] textDocument_hover_request(params::LanguageServer.TextDocumentPositionParams, server::LanguageServerInstance, conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}) @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/hover.jl:6 [4] (::LanguageServer.var"#96#97"{typeof(LanguageServer.textDocument_hover_request), LanguageServerInstance})(conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, params::LanguageServer.TextDocumentPositionParams) @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/languageserverinstance.jl:252 [5] dispatch_msg(x::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::JSONRPC.MsgDispatcher, msg::Dict{String, Any}) @ JSONRPC ~/.julia/packages/JSONRPC/yu0G3/src/typed.jl:67 [6] run(server::LanguageServerInstance) @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/languageserverinstance.jl:361 [7] top-level scope @ none:1 caused by: TypeError: in Expr, expected Symbol, got a value of type CSTParser.EXPR Stacktrace: [1] Expr @ ./boot.jl:253 [inlined] [2] get_hover(b::StaticLint.Binding, documentation::String, server::LanguageServerInstance) @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/hover.jl:58 [3] get_hover(x::CSTParser.EXPR, documentation::String, server::LanguageServerInstance) @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/hover.jl:20 [4] textDocument_hover_request(params::LanguageServer.TextDocumentPositionParams, server::LanguageServerInstance, conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}) @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/hover.jl:6 [5] (::LanguageServer.var"#96#97"{typeof(LanguageServer.textDocument_hover_request), LanguageServerInstance})(conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, params::LanguageServer.TextDocumentPositionParams) @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/languageserverinstance.jl:252 [6] dispatch_msg(x::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::JSONRPC.MsgDispatcher, msg::Dict{String, Any}) @ JSONRPC ~/.julia/packages/JSONRPC/yu0G3/src/typed.jl:67 [7] run(server::LanguageServerInstance) @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/languageserverinstance.jl:361 [8] top-level scope @ none:1 Process julia-ls stderr finished [ Info: Received new data from Julia Symbol Server. ```
gdkrmr commented 2 years ago

I think I am getting the same error, can you format the error message nicely please, it is currently not legible.

fbkarsdorp commented 2 years ago

Should be better now.

gdkrmr commented 2 years ago

I have a fix but the fix only works on current master of LanguageServer.jl, so I will wait a couple of days, until the LanguageServer.jl people tag a new version.

See also: https://github.com/julia-vscode/LanguageServer.jl/issues/1003 https://github.com/julia-vscode/LanguageServer.jl/issues/998

EDIT: if you are really impatient, you can checkout https://github.com/gdkrmr/lsp-julia but you will have to install LanguageServer.jl#master manually, there is currently no automatism for it.

fbkarsdorp commented 2 years ago

Excellent. Thanks so much!

surya-chak commented 2 years ago

Hello, I'm getting the same problem with the same error.

Are there any updates on this?

I'm a bit of a noob here and am not sure how to install the LanguageServer directly from git as indicated in the documentation on @gdkrmr's version of the lsp-julia mode gitHub repo.

Absolutely any help would be deeply appreciated

gdkrmr commented 2 years ago

You start julia loading the environment that comes with lsp-julia, then you can use Julia Pkg to install whatever version of the LanguageServer.jl you need.

The issue is that by default the latest tagged version is being installed which currently is 4.1.0 but that version is not compatible with lsp-julia at the moment. Current lsp-julia master from my repo and LanguageServer.jl master are compatible but installing them requires manual intervention.

surya-chak commented 2 years ago

You start julia loading the environment that comes with lsp-julia, then you can use Julia Pkg to install whatever version of the LanguageServer.jl you need.

Thanks for this. I have already tried downgrading to 4.0 but that doesn't work either. Is there a version that you know for sure works?

The issue is that by default the latest tagged version is being installed which currently is 4.1.0 but that version is not compatible with lsp-julia at the moment. Current lsp-julia master from my repo and LanguageServer.jl master are compatible but installing them requires manual intervention.

I understood this from the documentation on the main lsp-julia github page and is specifically what my original question was about. I've tried to just git clone the master branch into my JULIA_PATH but in that cause using LanguageServer results in an error because dependencies have not been installed properly. Is there a resource somewhere to guide me through the process of actually installing the master branch? I am also okay with installing a previous version of LanguageServe provided I know which one works. Thank you again!

gdkrmr commented 2 years ago

This one is working for me on a different machine:

[[LanguageServer]]
deps = ["CSTParser", "DocumentFormat", "JSON", "JSONRPC", "Markdown", "Pkg", "REPL", "StaticLint", "SymbolServer", "Tokenize", "URIParser", "UUIDs"]
git-tree-sha1 = "ac9f7da10fbba9cad8455a3436d121eaf8f308f6"
uuid = "2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7"
version = "4.0.0"

A general guide is somewhat difficult, because the directory where lsp-julia is being installed differs between machines.

surya-chak commented 2 years ago

@gdkrmr Thank you for your help. I'll try to revert back to that version and see if it works.

Thanks!

gdkrmr commented 2 years ago

Should be fixed by new release. Requires Julia 1.7