This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-06
Channels
- # announcements (58)
- # babashka (43)
- # babashka-sci-dev (22)
- # beginners (8)
- # biff (8)
- # calva (62)
- # circleci (3)
- # clerk (6)
- # clj-kondo (27)
- # cljsrn (9)
- # clojure (61)
- # clojure-austin (4)
- # clojure-conj (3)
- # clojure-europe (11)
- # clojure-losangeles (2)
- # clojure-nl (2)
- # clojure-norway (4)
- # clojure-spain (5)
- # clojure-uk (2)
- # clojurescript (51)
- # data-science (1)
- # datascript (4)
- # emacs (33)
- # events (14)
- # funcool (14)
- # gratitude (13)
- # introduce-yourself (1)
- # jobs (9)
- # lsp (58)
- # malli (23)
- # missionary (31)
- # nextjournal (9)
- # off-topic (35)
- # proletarian (2)
- # re-frame (5)
- # remote-jobs (7)
- # shadow-cljs (2)
- # spacemacs (7)
- # sql (26)
- # testing (12)
- # vim (1)
- # web-security (3)
- # xtdb (2)
I'm noticing when typing new code, lsp-mode
is always constantly displaying errors (related to me not being done typing) in the minibuffer. Is there any way to suppress this? It's not actually (in my opinion) very helpful, but it is visually noisy and stops anything else that might appear there (from CIDER, for example, which is actually more helpful as I'm typing with how it highlights the arg list for whatever function I happen to be calling).
@UKFSJSM38 This is what goes into the minibuffer:
I see, I didn't even know that was possible 😂 That probably happens because you don't have flycheck or flymake configured properly?
Yeah, ok - I had an inkling that if I installed lsp-UI, at least the errors would go somewhere else. I'll go ahead and do that, thank you.
👍 lsp-ui is cool, but some features are a little bit too much, so I suggest add:
(setq lsp-ui-doc-enable nil
lsp-ui-peek-enable nil)
Ok thank you - I'm adding that to my use-package declaration and then I'll probably just have to customize the colors!
I think the colors should work fine OOTB, they use emacs default faces for success, warning, error etc
@UKFSJSM38 It works as you suggested - the errors appear in the buffer itself as overlays (or whatever). Interestingly, though, and possibly not a bug, but it still stops the normal (quite helpful) display from CIDER in the minibuffer in this case.
If I manage to determine when it works and when it doesn't, I'll come back with a more useful (precise) question.
I found pretty weird to show lint in the minibuffer, the default behavior without lsp-mode is not that AFAIK, I suggest you ask in the Discord server of emacs-lsp: https://discord.com/channels/789885435026604033/789890622424219658
Ok, thanks for the heads up - I had very limited luck asking for help there with lsp-treemacs
(which I'm convinced is just broken on a number of platforms) but I'm not quite good enough yet at elisp to debug it myself.
Hi - I am using the lsp server via nvim. When I am building clojure libraries and installing them locally e.g. lein install
the change in function signature is not being picked up and I get diagnostic errors that are not correct. If I delete all the .lsp and .clj-kondo directories ( which I presume forces a recreation of any cache ) it resolves the issue. As I am developing the library I am not updating the version of the library every time I install. Should this change in the library in the local maven repo be picked up; is it a bug ? Is there a way to ask the lsp server to recreate the cache rather than having to remove them manually from the file system ?
Good corner case, ATM clojure-lsp caches the sha of the project.clj, and since that would not change, it will use the cached classpath, one thing you can try to confirm that is to change anything in your project.clj, like add a space or newline and after a server restart it should work
not sure how we would fix that , pretty hard to know, would need to check the sha in the .m2 or something
Thanks for the quick reply. The edit of the deps/project.clj + LspStop clojure_lsp + LspStart clojure_lsp works. I’m not sure how this would be done through the lsp interface but perhaps adding a manual call to make the cache stale ( reset the shah value ) would at least give a manual approach ?
yeah, we fixed the last cache issue I was aware in the previous release, so this is the only one that we know that we would like to reset that cache, even so, not sure worth it. At least a issue makes sense for that if you don't mind opening it, there we could discuss fixing the root cause or other alternatives
sure - I’ll open one
I filed https://github.com/clojure-lsp/clojure-lsp/issues/1489 earlier today and went ahead and fixed it, but before I open a PR, seems prudent to check if the solution I came up with is okay lol. My bug is about non-string literals in the metadata of a var: (def ^{:doc (:doc (meta #'existing-var))} target-var 789)
. my solution is to enable finding the documentation of the referenced var if and only if the metadata is written in this way, lol (see the picture for a demonstration)
hum, not sure what if the metadata is written in this way
means even checking the print, maybe sharing the draft PR would be easier :p ?
AFAICS the exception is happening https://github.com/clojure-lsp/clojure-lsp/blob/c04df1c50afa5738e3e84f6367b1875ad84c3c8b/lib/src/clojure_lsp/feature/hover.clj#L30
The bug is that doc-line
checks (when (seq doc)
, which doesn't actually verify the docs are a string. If markdown is enabled, docstring->formatted-markdown
throws an Exception as you noted.
the simple fix is change the check to (when (and (string? doc) (seq do)
maybe we should confirm is doc
that comes from clj-kondo should really be other things than string
the more complex and fun fix is to check if the metadata is referencing another var's metadata and then use q/find-definition
to get information about it, and check it for a doc string lol
as you can see in the image I posted, base-var
has a docstring, and then existing-var
is referencing it and target-var
is referencing existing-var
. My PR implements tracing those references
sounds cool that find-definition, so it seems to be 2 different issues: • fix the exception, show the hover as string • new feature: follow metadata docs
of course, I'll fix those right up
that's a nice feature, we should probably mention in the docs somewhere in features.clj I guess
I can write some up tomorrow if you'd like
Would be nice! I think a simple mention in the hover section in the features would be enough
One thing would be nice to improve is the follow arity as well, at Nubank we have hundreds of functions like:
(defn ^:private bar-impl [{:keys [a b c d]}])
(defn bar [options] ,,, (bar options))
and would be awesome to hover into (bar|)
and see the bar-impl
arity instead of bar, maybe we could do the same when one uses :doc (:doc (meta #'bar-impl))
?hmm! that's interesting
I've seen folks hardcode the arglists before