Hi. Very new to cljs here. I've encountered a problem with lsp
in cljs. Whenever lsp
detects an error it prevents me from typing. A current example:
I am trying out the re-frame starter app and playing around with it. In events.cljs
is this function:
(re-frame/reg-event-fx
::set-active-panel
(fn-traced [{:keys [db]} [_ active-panel]]
{:db (assoc db :active-panel active-panel)}))
lsp
says active-panel
is an "unresolved symbol". If I put my cursor after active-panel
in the params list lsp
prevents any input. This also happens when I type my own functions. When I swap out the backend to cider
I don't have that problem. So lsp
has to be at fault here.
What exactly is causing these issues and how can I prevent this?
Has anyone else had that happen to them?
My Clojure layer setup is very basic.
(setq-default dotspacemacs-configuration-layers
'(
(clojure :variables
clojure-enable-fancify-symbols t
clojure-enable-clj-refactor t
;; clojure-backend 'cider
)
lsp
))
@sebastian I have been trying to get a workable LSP configuration with minimal impact, but it requires a fair bit of configuration. You may have luck by just disabling indentation on the lsp layer, e.g.
(lsp :variables
lsp-enable-on-type-formatting nil
lsp-enable-indentation nil)
I have a bit of a walk through of my lsp config for Clojure here: https://practicalli.github.io/spacemacs/install-spacemacs/clojure-lsp/configure-lsp-and-cider.htmlI also disabled cljfmt as it seemed a bit aggressive, although the above may also disable that already https://github.com/practicalli/spacemacs.d/blob/live/dot-lsp/config.edn#L89
great. I'll check that out.
I keep tweeking this configuration to see what works best. However, unless there is something you definiately benefit from lsp, then I suggest disabling (use cider as the clojure backend) it until you have time to set things up.
this config fixes the issue with lsp preventing my input. thanks.
True. Currently there isn't as I am just starting out with clj/s. If I bump into more problems with lsp
I'll go back to cider
.
The clojure-lsp project has had a lot more work put into it in the last few months and continues to be very active, so improvements are coming. However, it still needs a bit of time to configure unless you want the whole IDE experience
@sebastian lsp-mode should not prevent you from input anything, make sure to update both clijure-lsp and lsp-mode, you can ask for help on #lsp as well :)