gdkrmr / lsp-julia

MIT License
70 stars 19 forks source link

no method matching LanguageServer.FoldingRangeCapabilities #23

Closed tamasgal closed 4 years ago

tamasgal commented 4 years ago

I am having some issues with lsp-julia. Here are my relevant Julia packages (running under Julia 1.4):

  [2b0e0bc5] LanguageServer v2.0.2-DEV #master (https://github.com/julia-vscode/LanguageServer.jl.git)
  [cf896787] SymbolServer v3.1.1

When I open a Julia file in Emacs, the lsp server is crashing with the following error:

ERROR: MethodError: no method matching LanguageServer.FoldingRangeCapabilities(::Nothing)
Closest candidates are:
  LanguageServer.FoldingRangeCapabilities(::Any, !Matched::Any, !Matched::Any) at /Users/tamasgal/.julia/packages/LanguageServer/35vuR/src/protocol/initialize.jl:132
  LanguageServer.FoldingRangeCapabilities(!Matched::Union{Missing, Bool}, !Matched::Union{Missing, Int64}, !Matched::Union{Missing, Bool}) at /Users/tamasgal/.julia/packages/LanguageServer/35vuR/src/protocol/initialize.jl:132
  LanguageServer.FoldingRangeCapabilities(!Matched::Dict) at /Users/tamasgal/.julia/packages/LanguageServer/35vuR/src/protocol/protocol.jl:37
Stacktrace:
 [1] LanguageServer.TextDocumentClientCapabilities(::Dict{String,Any}) at /Users/tamasgal/.julia/packages/LanguageServer/35vuR/src/protocol/protocol.jl:37
 [2] LanguageServer.ClientCapabilities(::Dict{String,Any}) at /Users/tamasgal/.julia/packages/LanguageServer/35vuR/src/protocol/protocol.jl:37
 [3] LanguageServer.InitializeParams(::Dict{String,Any}) at /Users/tamasgal/.julia/packages/LanguageServer/35vuR/src/protocol/initialize.jl:183
 [4] parse_params(::Type{Val{:initialize}}, ::Dict{String,Any}) at /Users/tamasgal/.julia/packages/LanguageServer/35vuR/src/requests/init.jl:125
 [5] parse(::Type{LanguageServer.JSONRPC.Request}, ::Dict{String,Any}) at /Users/tamasgal/.julia/packages/LanguageServer/35vuR/src/jsonrpc.jl:46
 [6] run(::LanguageServerInstance) at /Users/tamasgal/.julia/packages/LanguageServer/35vuR/src/languageserverinstance.jl:231
 [7] top-level scope at none:1

Process julia-ls stderr finished
gdkrmr commented 4 years ago

Is vscode already working with Julia 1.4? LanguageServer.jl is being developed primarily for the use in vscode, so first it has to work there.

non-Jedi commented 4 years ago

Yes. I also have eglot working with 1.4 now.

non-Jedi commented 4 years ago

@tamasgal could you please set lsp-print-io to t and post the messages from the buffer brought up by M-x lsp-workspace-show-log.

@gdkrmr it wouldn't be a bad idea to borrow some wording from https://github.com/emacs-lsp/lsp-mode/blob/master/.github/ISSUE_TEMPLATE/bug_report.md and make an issue template for this repo.

AlexLewandowski commented 4 years ago

I believe that error is due to folding not being set by default. This fixes that particular issue:

(setq lsp-enable-folding t)
(setq lsp-folding-range-limit 100)

LanguageServer#v2.0.0 still doesn't work though, see here.

For now, I recommend that you use the LanguageServer bundled with lsp-julia.

gdkrmr commented 4 years ago

There was a recent PR in lsp-mode that fixed this issue https://github.com/emacs-lsp/lsp-mode/issues/1591 https://github.com/emacs-lsp/lsp-mode/pull/1595