Skip to content

Commit

Permalink
Hacks to make reason-language-server work for me
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
jjlee committed May 10, 2020
1 parent 35d4630 commit 9626cf0
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -5845,17 +5845,19 @@ REFERENCES? t when METHOD returns references."
(let ((method (if (stringp msg-or-method)
msg-or-method
(plist-get msg-or-method :method))))
(-if-let (reqs (cdr (assoc method lsp-method-requirements)))
(-let (((&plist :capability :check-command) reqs))
(--filter
(with-lsp-workspace it
(or
(when check-command (funcall check-command it))
(when capability (lsp--capability capability))
(lsp--registered-capability method)
(and (not capability) (not check-command))))
(lsp-workspaces)))
(lsp-workspaces))))
(if (equal method "textDocument/rangeFormatting")
nil
(-if-let (reqs (cdr (assoc method lsp-method-requirements)))
(-let (((&plist :capability :check-command) reqs))
(--filter
(with-lsp-workspace it
(or
(when check-command (funcall check-command it))
(when capability (lsp--capability capability))
(lsp--registered-capability method)
(and (not capability) (not check-command))))
(lsp-workspaces)))
(lsp-workspaces)))))

(defalias 'lsp-feature? 'lsp--find-workspaces-for)

Expand Down Expand Up @@ -7812,17 +7814,7 @@ CALLBACK is the status callback passed by Flycheck."
:column (1+ (lsp-diagnostic-column diag))
:message (lsp-diagnostic-message diag)
:level (lsp--flycheck-calculate-level diag)
:id (lsp-diagnostic-code diag)
:end-column (-> diag
lsp-diagnostic-range
(plist-get :end)
(plist-get :column)
(1+))
:end-line (-> diag
lsp-diagnostic-range
(plist-get :end)
(plist-get :line)
(1+)))))
:id (lsp-diagnostic-code diag))))
(funcall callback 'finished)))

(defun lsp--flycheck-buffer ()
Expand Down

0 comments on commit 9626cf0

Please sign in to comment.