Is there a way to check that .lsp/config.edn
is being read by the server in emacs? Trying to debug some issues with macro-defs
I don't think there is such option 😕
You can try to tail -200f /tmp/lsp.out
to see if clojure-lsp
is logging something useful for you
@mitchell_clojure You can make a grave EDN syntax error to see if something throws ;)
good ideas! making a breaking change produces WARN clojure-lsp.parser: Cannot read file:///home/m/projects/.../.lsp/config.edn
in the file watch. Unsure if that means that lsp is actually reading it in as my config because I get a similar error when breaking regular source buffers
Probably is a syntax error on your config.edn
My config.edn
is
{"macro-defs"
{clojure.test.check.clojure-test/defspec [{:element :declaration
:tags ["unused"]}]}}
However I still get unresolved symbol errors on my usagesHey @mitchell_clojure, with the latest version of clojure-lsp and lsp-mode, you can now run on emacs lsp-clojure-server-info
which will get some information that may help us debug your issue 🙂
thank you! I really appreciate you guys working on this great tool. going to give it a go this morning as soon as I get a moment :D
Looks like the project settings are being read correctly, so this is even more mystifying to me...
{:project-root "file:///tmp/lsp_test",
:project-settings "{\"macro-defs\" {clojure.test.check.clojure-test/defspec [:declaration]}}\n",
:client-settings {"dependency-scheme" "jar", "source-paths" #{"src" "test"}, "macro-defs" {},
"project-specs" nil, "cljfmt" {:indents {}}}, :port 36967}
Could the empty "macro-defs"
in :client-settings
be clobbering the project config?@mitchell_clojure we are using clj-kondo
for linting, so you probably will need to add a "clj-kondo" map in you config.
For more information check https://github.com/snoe/clojure-lsp#initializationoptions
You probably need something like {"clj-kondo" {:lint-as {clojure.test.check.clojure-test/defspec clojure.core/defn}}}
ah, okay, so I have to set both a "macro-def"
and a "clj-kondo"
setting to define new "declaration" macros. This will surpress the kondo error while also telling lsp that the macro is a declaration. Seems to work fine for me. I thought that using the "unused"
tag for the declaration element would surpress kondo as well
yeah, this is not the final feature, in the future we intend to use only kondo and remove the macro-def as will be unnecessary 🙂
Looks good to me this configuration, are you trying to restart the server with lsp-workspace-restart
?
yes, or I will use lsp-workspace-shutdown
and then re enter the project to get it to start up
I think that the cause is probably that the config.edn
is somehow not being used
odd... Could you try moving your config.edn to ~/.lsp/config.edn
?
just to test if clojure-lsp finds it
Are you getting clj-kondo
or lsp
as the source of diagnostics?
everything being reported as lsp
, trying the ~/.lsp/config.edn
trick now
yeah, same problem
@snoe anything more to try on this case?
not sure, fighting something at work so I won't be able to look. How it's launched and getting the project-root/cwd that lsp is using to find the config is probably key.
like maybe it's launching from /usr/bin or something weird
I'll try to later add a debug log when loaded the config, this may help for issue like that
One thing I've been meaning to look at is a command or something in the protocol where you can send back a message. I'd like to be able to get the environment info like this, the config, the repl port etc back in the client
hum, it really seems a good idea, I can implmenet that under executeCommand from lsp protocol, and then add a command on lsp-mode for that , like lsp-clojure-server-info
yup, unless maybe lsp has something specific for this
No, It doesn't 😕 https://microsoft.github.io/language-server-protocol/specifications/specification-3-16/
I'm going to try to narrow it down after work so I will let you guys know if I figure out the root cause. Maybe something to do with some hidden spacemacs configuration