Does clojure-lsp work with vscode without Calva? I was thinking does it work with other Clojure plugins, like Clover, out-of-the box π
There is a proof-of-concept extension in the clojure-lsp repo. You might get away by having both Clover and Calva active, though. (Then again, maybe not, I have no idea. π )
Exactly βοΈ, but be aware that is just a POC, we actually don't maintain it with latest features updates, so I'd suggest using Calva for a complete VSCode Clojure IDE π
If you give it a try to have both extensions active, @janne.sauvala, I am super curious about how that works. Without knowing very much about Clover, I think it is mainly a REPL tool, right? So then maybe it should be possible to use the rest of Calva and then Clover for the REPL.
Maybe it'd be a good idea to have this kind of option for Calva, where it could be used only with clojure-lsp/non REPL or with the REPL, then users that like other REPLs could use together with Calva
But I think Calva already supports it, right?
Only because Calva doesnβt really care. π If we had such an option we could hide the REPL buttons in the status bar. And maybe disable the default keyboard shortcuts that has to do with the REPL. Please file a feature request about it.
Iβm really happy Calva user and I really like how it also integrates lsp, clj-kondo, formatting and paredit with rest of the nREPL-tooling. π Yes, Clover makes integration between vscode and plain socket-repl. Now since we start to have all of there tools (Calva, LSP, clj-kondo, Clover) added to vscode I was thinking can we start to mix and match what we want to use
Yeah π It's a enhancement just for reach more users IMO, not a priority though I'll open an issue just to help you keep track
Thanks. I think it makes sense. Iβve been trying to pull Calva apart more to give Clover users access to our Paredit and such, but it is a lot of work, and a bit hard to explain to myself why I donβt spend that work on Calva users instead, so Iβve put that on hold. This one should be much easier.
I was looking over the project and I notice the examples, and this one catches my eye <https://github.com/clojure-emacs/clj-refactor.el/blob/master/examples/magic-requires.gif>
. I don't think it's implemented yet in clojure-lsp? If one wanted to contribute, any guidelines?
I implemented support for that for a few namespaces late December π here for alias: https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/refactor/transform.clj#L419-L424 and here for refers: https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/refactor/transform.clj#L436-L454
feel free to add more that makes sense for all
I would nice to not add generic ones that may conflict with user alias from some project, but I'm aware it's missing common alias like io
for <http://clojure.java.io|clojure.java.io>
and etc
Also, It's in my backlog add a full docs page explaning each refactoring with gifs too
noice! will review
BTW the require wen completion probably is not working after the kondo integration π that's something we need to fix
good job on the new release of clojure-lsp, about to push up the arch graal build
Actually the ci is not ready π
notice that this no longer works clojure-lsp --version
, just thought you might like to know π
Oh, i can hold off on the push if you're still ironing out the kinks
Yes, please, I was aware that the CI wouldn't work perfect haha, I'm fixing it, soon It'll be fixed
I let you know
no problemo
btw, the startup time for the new and improved clojure-lsp is sooopar-dooopar fast π
Nice π Did you run the linux native image sucessfully?
yes
great, about the --version, that feature was a workaround done by me some time ago, I think it's time to fix it for real π
I'll try to fix that soon
just tried 2021.02.01-16.44.01
and works great, is that ready now for pushing to arch?
I'm WIP on MacOS graalvm build then I'll announce it on the channel
Okay, I'll hold off
thanks, the only way to test the CI is releasing, sorry about that π
np
I was going to add in the io
to the clojure-lsp thing
somethig to do π
Noice :catjam:
I just downloaded clojure-lsp today (via spacemacs) and am getting this:
$ ./clojure-lsp
Error: Invalid or corrupt jarfile ./clojure-lsp
Is anyone else getting that also? I'm MacOS 10.13.6.Hum, it was the latest deploy
did you just download the clojure-lsp
file or the zipped one?
I'll rollback the last release until get fixed
Honestly, I'm not sure. spacemacs did it for me. It did take a really long time to download the 11mb file.
Thanks for the report, rolled back until I fix the CI
I'm having some issues with the CI
Ah, cool. I'll retry with the new "latest" and report back. Thanks for the help!
You're welcome, I hope I fix that today
Well, 2021.01.28-03.03.16
still didn't work for me when I had spacemacs download it. However, when I downloaded manually things started working just fine. Thanks again for the help!
probably some spacemacs cache
Also, this looks like it's going to be really cool once I figure out how to use it. Fancy and useful things are already popping up all over my editor! π Thanks for your work on it!
haha yes! check the docs for more info or this: https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/
thank you π
Hey all, after a lot of work, we released https://github.com/clojure-lsp/clojure-lsp/releases/tag/2021.02.01-20.37.52 version of clojure-lsp
:clojure-lsp: , this time adding experimental native image binaries compiled with GraalVM π, for now only available for Linux and MacOS, I may add support for Windows soon, if you find any errors, please https://github.com/clojure-lsp/clojure-lsp/issues.
More info https://github.com/clojure-lsp/clojure-lsp/pull/267
Thanks for everyone that helped me on this, @thiagokokada, @dharrigan, @kumarshantanu @snoe specially @borkdude who helped a lot
I'll try it out soon, but may be days before I get to that
Glad there is Windows support!
np, thanks for helping π
@ericdallo so what was needed for the static binary to work?
I couldn't test it yet, not sure it will work for other linux (non NixOS), but probably won't work since the sqlite native lib is not a static lib
this is huge, thanks @ericdallo . I started clojure-lsp when graal had just come out and had hoped to one day use it.
works pretty darn well on Arch π
startup time is milliseconds
(a bit longer, if no clj-kondo analysis has been performed prior - but once it has, restarts are super dopar quick)
π yes, IMO the trade-off worth thinking that memory and cpu resources are improved, alos this is experimental, I did a lot of tests and could not find any issues, but we will only know with users testing it π
so how do I install this lsp thing in emacs? let me test it ;)
hahah cool! This should help you: https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/
but it's basically download the binary, set the permission to executable (needs to fix that on the release, not sure how to do it yet though)
install lsp-mode and set lsp-clojure-custom-server-command
Seems to work great in MacOS 10.13.6. Also getting a really fast startup (unsurprisingly). π :thanks3:
I don't get this command in my emacs
oh it's a variable
I only get messages about a started server which exited with status exit. Do you want to restart it?
Hum, did you chmod +x
the file?
yes. I have:
(setq lsp-clojure-custom-server-command '("bash" "-c" "/Users/borkdude/Downloads/clojure-lsp"))
also check /tmp/clojure-lsp.out
or clojure-lsp:stderr
buffer
(I don't know why you need the bash there)
/bin/bash: clojure-lsp: command not found
Hum, usually this happen with wrong permission on file :thinking_face:
it seems that it doesn't find the override. it doesn't mention the dir
Yeah, probably lsp-mode is not recognizing that variable
ls -lat "/Users/borkdude/Downloads/clojure-lsp"
-rwx--x--x@ 1 borkdude staff 110061504 Feb 1 20:52 /Users/borkdude/Downloads/clojure-lsp
I don't know which config you use, but this is my config for that with use-package: https://github.com/ericdallo/dotfiles/blob/master/.doom.d/config.el#L174
I'll restart my emacs π±
yes, now it works
also the progress bar keeps spinning, is this normal?
Yes if it's analyzing the code, otherwise a issue
check /tmp/clojure-lsp.out
other than that, it seems to work!
hmm, I get different errors now
when trying to do lsp-find-references in some test code
Hum.. that should work, could you confrm that there is no errors on /tmp/clojure-lsp.out
?
also on the stderr lsp buffer?
Only this in the err buffer:
Feb 01, 2021 11:02:00 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 2
In lsp.out:
2021-02-01T22:03:20.165Z MBP2019.local DEBUG [clojure-lsp.main:?] - :documentHighlight 1 clojure.lang.LazySeq@6a838899
2021-02-01T22:03:20.165Z MBP2019.local DEBUG [clojure-lsp.main:?] - :hover 0 clojure.lang.LazySeq@6aca4964
2021-02-01T22:06:43.132Z MBP2019.local DEBUG [clojure-lsp.main:?] - :resolveCodeLens 3 clojure.lang.LazySeq@28b3a0ca
2021-02-01T22:06:43.132Z MBP2019.local DEBUG [clojure-lsp.main:?] - :resolveCodeLens 4 clojure.lang.LazySeq@6e5f2eed
2021-02-01T22:06:44.882Z MBP2019.local DEBUG [clojure-lsp.main:?] - :hover 0 clojure.lang.LazySeq@52817bb8
2021-02-01T22:06:44.882Z MBP2019.local DEBUG [clojure-lsp.main:?] - :documentHighlight 1 clojure.lang.LazySeq@14b4a80e
2021-02-01T22:06:45.746Z MBP2019.local DEBUG [clojure-lsp.main:?] - :documentHighlight 1 clojure.lang.LazySeq@483b8156
2021-02-01T22:06:53.373Z MBP2019.local DEBUG [clojure-lsp.main:?] - :documentHighlight 0 clojure.lang.LazySeq@ecf74042
2021-02-01T22:06:53.374Z MBP2019.local DEBUG [clojure-lsp.main:?] - :hover 0 clojure.lang.LazySeq@eeb66f0
2021-02-01T22:07:00.690Z MBP2019.local DEBUG [clojure-lsp.main:?] - :documentHighlight 0 clojure.lang.LazySeq@c2fd3fc2
Hum, it's expected on the err buffer that logs
Looks ok also the log file
Not sure it's a lsp-mode issue
is your lsp-mode updated?
let me check
lsp-version also errors :/
let me just erase it from the my elpa dir
yeah, unfortunately lsp-mode has a lot of breaking changes/bugs all the time π
we always have to recommend to remove and reinstall
All seems good now!
Now I'm able to test what you guys are using all this analysis for ;)
hahahah yeah
I'm glad to see you using :clojure-lsp: π
Hmm, this seems like a warning I don't get from the vanilla clj-kondo.
Oh I see, this is a .cljc issue probably. I have a workaround for this coming up
Hum :thinking_face:
Is there a way to turn diagnostics off, so I get only the clj-kondo ones from my installed clj-kondo?
oh nice!, we now really rely on clj-kondo for every analysis π
yep
:loading:
this is easier for me for development
since I'm always running the bleeding edge
(setq lsp-diagnostics-provider :none)
should work
you may need to lsp-workspace-restart
too
or just disable lsp-diagnostics-mode
for a single buffer only
ah I should remember the last one
thanks
π
BTW @borkdude, I could not the --static binary work with sqlite π
clojure-lsp: symbol lookup error: /tmp/sqlite-unknown-96fda49f-b136-4037-98b2-cb9e9dadfb63-libsqlitejdbc.so: undefined symbol: pthread_mutexattr_init
this happens in runtime when queryingProbably, because JNI loads dynamically the sqlite ?
yeah, I don't know. have you tried the native in a docker that absolutely has no libsqlite?
I still wonder how it loads the library
Good question
I also don't see the lib here:
clojure-lsp:
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1069.24.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 902.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1677.104.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1677.104.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
This is otool -L clojure-lsp
> Our SQLiteJDBC library requires no configuration since native libraries for major OSs, including Windows, Mac OS X, Linux etc., are assembled into a single JAR (Java Archive) file. The binary for sqlite is not static, that's the reason
I get that, but where does native-image leave this sqlite binary
normally you can't just "include" it and hope that it works
it might depend on your system installation of sqlite
it's a jar dependnecy from the sqlite-jdbc I think
it's in resources
I get that it is a JAR dependency. I just don't get how the native lib gets distributed with your binary
Maybe this happens through the JNI config? The only way to find out is to run the linux binary in a very minimal docker image
oh got it
Yeah, it's a way to check that
I tested a static compiled via CI static image, with my https://github.com/ericdallo/sqlite-graalvm-sample and got a more detailed exception:
Inserting...
Failed to load native library:sqlite-unknown-e3826d75-d79b-49ef-b323-a6f5bc7a3b71-libsqlitejdbc.so. osinfo: Linux/x86_64
java.lang.UnsatisfiedLinkError: Can't load library: /tmp/sqlite-unknown-e3826d75-d79b-49ef-b323-a6f5bc7a3b71-libsqlitejdbc.so
Exception in thread "main" java.sql.SQLException: Error opening connection
at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:239)
at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:61)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:21)
at org.sqlite.JDBC.createConnection(JDBC.java:115)
at org.sqlite.JDBC.connect(JDBC.java:90)
at java.sql.DriverManager.getConnection(DriverManager.java:677)
at java.sql.DriverManager.getConnection(DriverManager.java:189)
at next.jdbc.connection$get_driver_connection.invokeStatic(connection.clj:141)
at next.jdbc.connection$url_PLUS_etc$reify__747.getConnection(connection.clj:357)
at next.jdbc.connection$make_connection.invokeStatic(connection.clj:385)
at next.jdbc.connection$fn__760.invokeStatic(connection.clj:406)
at next.jdbc.connection$fn__760.invoke(connection.clj:406)
at next.jdbc.protocols$fn__563$G__558__570.invoke(protocols.clj:24)
at next.jdbc.connection$fn__764.invokeStatic(connection.clj:415)
at next.jdbc.connection$fn__764.invoke(connection.clj:406)
at next.jdbc.protocols$fn__563$G__558__570.invoke(protocols.clj:24)
at next.jdbc$get_connection.invokeStatic(jdbc.clj:155)
at sqlite_graalvm_sample.core$insert.invokeStatic(core.clj:15)
at sqlite_graalvm_sample.core$_main.invokeStatic(core.clj:36)
at sqlite_graalvm_sample.core$_main.doInvoke(core.clj:36)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at sqlite_graalvm_sample.core.main(Unknown Source)
Caused by: java.lang.Exception: No native library found for os.name=Linux, os.arch=x86_64, paths=[/org/sqlite/native/Linux/x86_64]
at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:367)
at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:67)
at org.sqlite.core.NativeDB.load(NativeDB.java:63)
at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:235)
... 24 more
But can you run the dynamic one in an environment that has no sqlite lib installed?
yeah, I can run in a alpine docker image
Got a pretty segfault π
And this on a ubuntu docker image:
The same error I get on NixOS βοΈ probably related with the non static sqlite lib
@ericdallo the dynamic binaries generally do not work in alpine at all
you should try it in an ubuntu one
Yeah, I Imagined that, that's why I tested on ubuntu
but make sure there is no libsqlite
I tried it here: https://clojurians.slack.com/archives/CPABC1H61/p1612221599195500?thread_ts=1612215716.175700&cid=CPABC1H61
So probably you have a dependency then?
Off to bed.