New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LSP crashing with MethodError on FoldingRangeClientCapabilities #35
Comments
Did you see #23 (comment)? |
Going by some of the suggestions in that thread, I managed getting it to work by setting |
I have the same issue on Doom emacs. The |
I have the same issue. Now I get the following error:
my configuration is
|
This works for me, thanks a lot!!! |
Not sure why this issue was closed, as |
I'm still having this exact issue using most recent Doom Emacs as well as most recent Julia 1.7.2.
I tried removing and readding
in |
Where are your default environments then? Have you tried changing |
I think there was no environment at all since I did a fresh install of Julia, removing the old I have in the meantime installed
I don't think changing I've found a way to make it work now, it seems: On a freshly launched Emacs, open any |
I experienced the same crashes (using Doom Emacs with a standard config) and I could also "fix" them by closing and reopening the file. Doom Emacs implements the originally proposed workaround in https://github.com/doomemacs/doomemacs/blob/bc32e2ec4c51c04da13db3523b19141bcb5883ba/modules/lang/julia/config.el#L85-L88 but for me it was not sufficient (it seems the hook might be applied too late?). Adding (after! julia-mode
(when (featurep! :lang julia +lsp)
(unless (featurep! :tools lsp +eglot)
(setq-hook! 'julia-mode-hook
lsp-enable-folding t
lsp-folding-range-limit 100)
(add-hook 'julia-mode-local-vars-hook #'lsp! 'append)))) to config.el, similar to the config for However, I agree with @ulysses4ever: Even if the workaround could be applied successfully, it's still a workaround that does not fix the underlying problem. According to the LS.jl developers it's a bug in lsp-mode. I'm not familiar with the code in lsp-mode and I'm a complete beginner when it comes to lisp programming but I just followed @ulysses4ever's suggestion and tried to change the definition in https://github.com/emacs-lsp/lsp-mode/blob/c44cd787a9164df683ac21ece2c05d21cb3deda7/lsp-mode.el#L3537-L3542 such that it matches other conditional capabilities such as https://github.com/emacs-lsp/lsp-mode/blob/c44cd787a9164df683ac21ece2c05d21cb3deda7/lsp-mode.el#L3474 and https://github.com/emacs-lsp/lsp-mode/blob/c44cd787a9164df683ac21ece2c05d21cb3deda7/lsp-mode.el#L3477-L3481. It seems this actually worked and emacs-lsp/lsp-mode@master...devmotion:lsp-mode:dw/fix_foldingrange was sufficient to fix the crashes. |
@devmotion this sounds great! By any chance, could you open a pull request against lsp-mode? |
I opened a PR: emacs-lsp/lsp-mode#3593 |
The PR was merged, so you can test it by updating lsp-mode. I still haven't observed any crashes after updating (and removing the workaround). |
emacs-lsp/lsp-mode@6b6afc00deec -> emacs-lsp/lsp-mode@3fa645c0397b joaotavora/eglot@e835996e1661 -> joaotavora/eglot@bd970be047ab - There are multiple issues in the lsp-mode repo (emacs-lsp/lsp-mode#2722), lsp-julia repo (gdkrmr/lsp-julia#23 and gdkrmr/lsp-julia#35), and the LanguageServer.jl repo (julia-vscode/LanguageServer.jl#844) about crashes of the Julia LSP with lsp-mode due to errors caused by the folding capabilities announced by the client. One can work around these issues by enabling folding (see gdkrmr/lsp-julia#23) but that is only a hack and does not fix the underlying issue. The problem is caused by a violation of the LSP specs in lsp-mode which was fixed in emacs-lsp/lsp-mode#3593. The PR updates lsp-mode to the latest commit on the master branch which contains this fix (and some other unrelated fixes, CI passes successfully again), and hence the workaround for lsp-julia can be removed. Ref: emacs-lsp/lsp-mode#3593 Ref: emacs-lsp/lsp-mode#2722 Ref: gdkrmr/lsp-julia#35 Ref: gdkrmr/lsp-julia#23 Ref: julia-vscode/LanguageServer.jl#844 Close: #6516 Co-authored-by: devmotion <devmotion@users.noreply.github.com>
emacs-lsp/lsp-mode@6b6afc00deec -> emacs-lsp/lsp-mode@3fa645c0397b joaotavora/eglot@e835996e1661 -> joaotavora/eglot@bd970be047ab - There are multiple issues in the lsp-mode repo (emacs-lsp/lsp-mode#2722), lsp-julia repo (gdkrmr/lsp-julia#23 and gdkrmr/lsp-julia#35), and the LanguageServer.jl repo (julia-vscode/LanguageServer.jl#844) about crashes of the Julia LSP with lsp-mode due to errors caused by the folding capabilities announced by the client. One can work around these issues by enabling folding (see gdkrmr/lsp-julia#23) but that is only a hack and does not fix the underlying issue. The problem is caused by a violation of the LSP specs in lsp-mode which was fixed in emacs-lsp/lsp-mode#3593. The PR updates lsp-mode to the latest commit on the master branch which contains this fix (and some other unrelated fixes, CI passes successfully again), and hence the workaround for lsp-julia can be removed. Ref: emacs-lsp/lsp-mode#3593 Ref: emacs-lsp/lsp-mode#2722 Ref: gdkrmr/lsp-julia#35 Ref: gdkrmr/lsp-julia#23 Ref: julia-vscode/LanguageServer.jl#844 Close: doomemacs#6516 Co-authored-by: devmotion <devmotion@users.noreply.github.com>
The server seems to be crashing soon after starting. It seems to always be crashing on the function LanguageServer.FoldingRangeClientCapabilities. Not quite sure how to go about debugging this issue
The stderr log is below
The text was updated successfully, but these errors were encountered: