-
Notifications
You must be signed in to change notification settings - Fork 84
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
textDocument/rangeFormatting always hangs? #423
Comments
I'm facing the same issue, and thought it could be because of refmt, but apparently no: reasonml/reason#2549 edit: I forgot to mention that rls is hanging on VS Code. |
I now remember that when I explicity told emacs to reformat a region (before I applied my hacks to the emacs code), I got broken formatting. I haven't verified it's using the same method in that case, but I'm pretty sure it is. So I think it does not hang under some circumstances. |
Hm, does refmt even use the language server protocol? I saw the hanging issue described in this issue literally on a new autogenerated project that I created by following the instructions on the Reason website: https://reasonml.github.io/docs/en/installation#new-project So @gaku-sei I'm not sure whether your issue has the same cause as mine. |
@jjlee for me it's very fluctuating actually 😕 |
@gaku-sei something to keep in mind is that compilation happens as-you-type, so refmt is fed unique text with half-typed words etc. That is the ideal recipe to make things less reproducible. |
jaredly/reason-language-server#423 In spacemacs (right now I'm on 3747afb from the develop branch), if I: 1. Apply this very hacky patch 2. Add this to my spacemacs init.el: dotspacemacs-additional-packages '( (lsp :location "~/dev/lsp-mode/") ) 3. Load a ReasonML (.re) file 4. Disable merlin linting: SPC SPC merlin-mode RET 5. Ensure LSP gets loaded: SPC SPC lsp RET 6. Run this (replacing the file path with where you put the reason-language-server binary): (lsp-register-client (make-lsp-client :new-connection (lsp-stdio-connection "/path/to/rls-linux/reason-language-server") :major-modes '(reason-mode) :notification-handlers (ht ("client/registerCapability" 'ignore)) :priority 1 :server-id 'reason-ls)) (spacemacs|define-jump-handlers reason-mode) 7. SPC SPC lsp again ... then it seems to work!
reason-language-server hangs for me when sending it the following textDocument/rangeFormatting request (I gave it 60 seconds):
Baz.re
looks like this:emacs lsp-mode.el (lsp-mode-20200311.612) seems to send this request whenever I paste a line of text into the file I'm editing (for example, if I paste in
let foo = "Bar";
again so that I have two lines in a row like that). I checked the logs for vscode when pasting text, and VS Code does not seem to do that -- in fact I wasn't able to trigger it to send a textDocument/rangeFormatting at all.So I have a suspicion that most of the editor LSP clients for Reason use the node.js implementation (all of which are implemented using the same node module I think) and never use that method, and that reason-language-server may never respond properly to requests of that method, always hanging?
If I hack
lsp-mode.el
to prevent it from trying, at least basics work -- inreason-mode
with lsp enabled and using reason-language-server, syntax highlighting and tooltips (lsp-ui-mode
) work and I can get type info usinglsp-describe-thing-at-point
. So perhaps one possible fix is to remove support for that method? (guessing totally here, I know nothing about LSP nor Reason)The text was updated successfully, but these errors were encountered: