1

I downloaded clojure-lsp (https://github.com/snoe/clojure-lsp) and tried to add it as a client in my init.el:

  (use-package lsp-mode
    :ensure t)
  (use-package lsp-ui
    :ensure t
    :config
    (add-hook 'lsp-mode-hook #'lsp-ui-mode))
  (lsp-define-stdio-client
   lsp-clojure-mode
   "clojure"
   (lambda () default-directory)
   '("~/bin/clojure-lsp")
   )

However when I do M-x lsp-mode in a clojure file, I only get this error after a short while:

Error during redisplay: (eval (lsp-mode-line)) signaled (wrong-type-argument lsp--workspace nil)

How do I correctly add clojure-lsp to lsp-mode?

1

It turns out that lsp-mode is currently being reworked. That means that the syntax for registering servers works different now:

(lsp-register-client
 (make-lsp-client :new-connection (lsp-stdio-connection "pyls")
                  :major-modes '(python-mode)
                  :server-id 'pyls))

So you might need to check out the latest README on github for up to date information:

https://github.com/emacs-lsp/lsp-mode

0

There are now instructions for configuration with emacs lsp-mode. The following is taken from what's currently there. You will need to start by putting the clojure-lsp executable on your path.

(require 'lsp-mode)
(lsp-register-client
 (make-lsp-client :new-connection (lsp-stdio-connection '("bash" "-c" "clojure-lsp"))
                  :major-modes '(clojure-mode clojurec-mode clojurescript-mode)
                  :server-id 'clojure-lsp))
(add-to-list 'lsp-language-id-configuration '(clojure-mode . "clojure-mode"))
(setq lsp-enable-indentation nil)
(add-hook 'clojure-mode-hook #'lsp)
(add-hook 'clojurec-mode-hook #'lsp)
(add-hook 'clojurescript-mode-hook #'lsp)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.