This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-20
Channels
- # announcements (33)
- # aws (1)
- # babashka (8)
- # beginners (100)
- # calva (59)
- # clara (4)
- # clj-kondo (33)
- # cljdoc (9)
- # cljs-dev (30)
- # cljsrn (1)
- # clojure (28)
- # clojure-australia (1)
- # clojure-boston (1)
- # clojure-dev (4)
- # clojure-europe (14)
- # clojure-france (5)
- # clojure-italy (7)
- # clojure-nl (1)
- # clojure-uk (36)
- # clojurescript (13)
- # clojureverse-ops (6)
- # conjure (2)
- # cursive (2)
- # datahike (11)
- # datalevin (1)
- # datomic (106)
- # graphql (3)
- # helix (10)
- # holy-lambda (24)
- # kaocha (2)
- # lambdaisland (3)
- # lsp (199)
- # malli (35)
- # off-topic (16)
- # pathom (7)
- # polylith (38)
- # portal (16)
- # quil (2)
- # re-frame (18)
- # reagent (57)
- # shadow-cljs (11)
- # testing (3)
- # xtdb (9)
how do I disable the unused-public-var linter?
Do the docs here help? https://clojure-lsp.io/settings/#clojure-lspunused-public-var
Is there something I can read that will give me an understanding of sessions and workspaces? One thing in particular I’m wondering about is the file .emacs.d/.lsp-session-v1
and how things work with multiple Emacs instances.
Not sure there is something to read about that, this is a particularity in lsp-mode
I suggest you request that on emacs-lsp discord channel https://discord.gg/swuxy5AAgT
I was trying to speed up the lsp reformatting and this time I knew exactly the namespaces (just 5-6)
the initial clj-kondo analysis phase seems to take as long as without specifying the namespaces, is that normal?
even if you pass one or 2 namespaces, it could be something on classpath that may change the diagnostics or something else for those namespaces
@U0524T275 after fixing the unknown namespaces, it should be faster
ah yeah sure makes sense
unfortunately inside the work network I can't build clojure-lsp
so still e to use the older version
ah cool 😄
nice I'll get it then
Ah well I juit call clojure-lsp --version
I guess if there only one executable available it will use that one
Released clojure-lsp 2021.10.20-13.04.11 with more fixes, performance improvements and new features! • General ◦ Improve intialization feedback report messages. ◦ Consider `dev` and `test` alias for deps.edn projects as project-specs during classpath lookup. https://github.com/clojure-lsp/clojure-lsp/issues/586 ◦ Avoid scanning source-paths twice, as it was being considered as part of external classpath as well. ◦ Change cache db from sqlite to datalevin for faster startup + better graalvm compatibility. ◦ Make the cache analysis save async to make startup faster. ◦ Support Auto refresh settings memoizing with a ttl of 1 second avoiding the need of restarting server when changing configs. https://github.com/clojure-lsp/clojure-lsp/issues/502 ◦ Bump clj-kondo adding new `gen-class` linter and other fixes/improvements. Fixes https://github.com/clojure-lsp/clojure-lsp/issues/589 ◦ Remove unused duplicate require if any. https://github.com/clojure-lsp/clojure-lsp/issues/527 ◦ Fix crash on clean-ns when ns contains comments. ◦ Improve project analysis filter to check source-paths. https://github.com/clojure-lsp/clojure-lsp/issues/597 • Editor ◦ Add reference code lens for ns forms. https://github.com/clojure-lsp/clojure-lsp/issues/578 ◦ Fix expand-let bug that occurs when a list form precedes let. https://github.com/clojure-lsp/clojure-lsp/pull/590 ◦ Add new command to create test for function at point. https://github.com/clojure-lsp/clojure-lsp/issues/582 ◦ Add new code action to create test for current function/var ◦ Add `private` to documentSymbol to make clear that a var or function is `private`. ◦ Add new code action `Suppress xxx diagnostic`, adding clj-kondo comment code to ignore the diagnostic. https://github.com/clojure-lsp/clojure-lsp/issues/591 ◦ Add more semantic tokens: aliases for macros, variable and function definitions. ◦ Add https://clojuredocs.org/ information during symbol hover. https://github.com/clojure-lsp/clojure-lsp/issues/571 Probably one of the major changes is the replace of sqlite with #datalevin as the analysis cache db implementation, improving the clojure-lsp startup, thank you @huahaiy for the huge help on this! 🚀 Also, we have https://clojuredocs.org/ integration 🎉 showing docs, examples, notes and see-alsos of symbols directly on your editor when hovering a symbol! Have a great code ;)
@ericdallo How does one get the clojuredocs on hover?
when clojure-lsp starts it requests and cache clojuredocs, so when you hover it tries to find the symbol on that cache
I'm trying to remember the emacs command, I use all the time but on doom-emacs which is just K
😂
yeah, but it calls a doom function which down there will call this lsp-mode command
yeah, I'm searching, I think lsp-mode just add a hook to eldoc, so you just need to call eldoc, let me check
I'm also always having trouble with lsp thinking that it needs to index my entire /tmp folder when I'm testing things in /tmp/test-project, even when I have a /tmp/test-project/.clj-kondo
about the hover, doom seems to do a lot of magic, I really don't know how to do that on emacs vanilla :(
it still asks me to import a project every time I visit another file in this project
I don't see clojuredocs in doom's +lookup/documentation
either (the eldoc thing)
you can also do it like this: -e "(set! *warn-on-reflection true)" -m "clojure-lsp.main"
> I’ll just use Calva 😛 😃 This will only work while the REPL is not connected. I’m working on it!
Trying to run the clojure-lsp server in some kind of development mode. development.md
says I can do this, but I can’t:
% clj -X:debug-jar && clj -X:bin
Compiling clojure-lsp.main ...
Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:436).
clojure_lsp.ClojureExtensions
Full report at:
/var/folders/t5/gqxhj8pd6p9_tnvy6sbtmy480000gn/T/clojure-14345845008648981829.edn
Compilation failed!
Execution error (ExceptionInfo) at hf.depstar.uberjar/build-jar-as-exec (uberjar.clj:554).
AOT compilation failed
Full report at:
/var/folders/t5/gqxhj8pd6p9_tnvy6sbtmy480000gn/T/clojure-13972972892988954623.edn
I have also tried some variants on
% clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.8.3"},cider/cider-nrepl {:mvn/version,"0.26.0"}}}' -A:debug:bin -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
WARNING: Implicit use of clojure.main with options is deprecated, use -M
nREPL server started on port 63367 on host localhost -
And connect the REPL and load main.clj
. But that gives:
; Evaluating file: main.clj
; Syntax error (FileNotFoundException) compiling at (src/clojure_lsp/main.clj:1:1).
; Could not locate borkdude/dynaload__init.class, borkdude/dynaload.clj or borkdude/dynaload.cljc on classpath.
; Evaluation of file main.clj failed: class clojure.lang.Compiler$CompilerException
Both doing it manually and running make
gave me an executable. Running it, but then unsure what to do. There is no /tmp/clojure-lsp.*.out
.
this folder is generated by JVM, but I think for some macos it generates in another folder
• get the generated folder by running the serverInfo
command and checking log-path
• Just set a clojure-lsp config {:log-path "/tmp/clojure-lsp.out"}
yes, every time we run on JVM it shoud start nrepl in background and log the port/make available on serverInfo
command
Well, stderr is not just for errors. It is a channel to communicate on out of stdout band also.
clojure-lsp logs a lot of useful information on its log, I don't know why logging to stderr is necessary
lsp clients already use the stderr for other err/warning issues, we would add info that is not a error/warning and maybe confuse those things
Now I am in a bit of a Catch 22. I want to know which port to communicate with clojure-lsp on, and need to talkk to clojure-lsp to find out what log file I can find that port in.
we had issues in the past we permission on the log path, that's why we leave to jdk create the log file on its default location, but we allow user override that as well
Also:
% clojure -M:run
Execution error (NullPointerException) at clojure-lsp.main/exit (main.clj:116).
null
After quite a while. 😃that's odd, well, generate the binary with make
, which will just generate an embedded jar in a executable file
I have mine log-path configured on my ~/.lsp/config.edn
if it helps: https://github.com/ericdallo/dotfiles/blob/master/.lsp/config.edn#L1
BTW check if you have write permissions on /tmp/
as you use Macos, maybe try log to home or somewhere else
let me try to explain it better:
• you generate the dev binary running make
as you did.
• you tell your editor to use the binary when starting clojure-lsp, for Calva for example there is a setting to specify the clojure-lsp path
• during a specific moment when clojure-lsp is starting, it should start printing to the log-path
> you tell your editor to use the binary when starting clojure-lsp, for Calva for example there is a setting to specify the clojure-lsp path So that what I just tried. 😃 I just copied it over the one that Calva has downloaded for itself. Works. Now let’s see where I find the logpath.
Good, you can set the clojure-lsp path calva setting to avoid overwriting to the one calva downloads
Yeah, forgot about you saying I should use that. Looked for it in the log. 😃 I have the REPL connected. Missed what you answered about me being able to modify clojure-lsp now.
No, doesn’t seem to be able to REPL the program into a new shape. So I edit->recompile->test the old fashion way?
Well, if you say it works via the REPL I want that. It’s the reason I do Clojure in the first place. 😃
What I tried was adding a key to serverInfo, reevaluated that form and then ran serverInfo command again. Don’t see my new key there.
I even use this https://github.com/ericdallo/dotfiles/blob/master/.doom.d/config.el#L28-L37 in my emacs that connect to the nrepl on clojure-lsp automatically haha
make -> reload the vs code window (to make clojure-lsp reconnect) -> serverInfo, copy port -> calva connect, paste port -> load file -> edit server-info function -> serverInfo -> success.
I can try describe the process “Hack clojure-lsp with Calva” in the development.md file, if you like?
It is quite a mind-fuck to experience this. I am modifying the clojure-lsp server backing my session.
It can be agnostic, with a short section about the calva specifics. (Like clojure-lsp path).
It seems I need to evaluate more than just the server-info
function for it to kick in. Do you have an idea what more it is? I’d like to avoid to instruct to reload the whole file, which works, but it brute.
If we make that (def server-info-raw #'server-info)
then we only need to re-eval server-info
. WDYT?
I can’t seem to be able to make lsp-find-references
return all references of a var - it only returns references from namespaces that I have already open. The same for lenses. Do I need to configure any special settings for it to work (I’m on Emacs)?
Can LSP easily determine that a function call is to a private Var rather than a public Var? Now that we have semantic tokens, that would seem like a useful distinction to surface in color-coding function calls perhaps?
I'm just no sure which modifier to add, here are the docs: https://microsoft.github.io/language-server-protocol/specification#textDocument_semanticTokens
Hmm, that sounds a bit hokey... I'm surprised they don't have standard tokens/modifiers for access levels...
They show tokenModifiers
as an array with things like private
and static
below that...
yeah, I'm not sure if the modifiers need to follow that list or we could include custom ones, but each client handle that extra modifier
Hokey is ok, I'd say. It's up to the theme to style it anyway so it's quite arbitrary either way.
Two issues I found with lsp. 1. Macros are listed in company as a Variable + Function. 2. Some of the functions are listed as variables, but they're functions
thanks! Probably because there is the var-definition and the var-usage of that function, is this project opensource so I can try later?
Yeah. This is holy-lambda 😄
You're very welcome 🙂
Also I see great performance improvements in this release.
I made a commit on master fixing the 2.
the first one I need to debug a little more
Much appreciated!