lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
2021-02-18T00:36:25.172Z

Hello all, clojure-lsp cannot show doc of core lib functions on Windows machine for me. Is this current status? Thanks.

2021-02-25T11:23:26.239300Z

The issue is fixed by latest release, after I delete all the .lsp folder which is generated by old release. Thanks!

ericdallo 2021-02-25T12:20:00.241300Z

Nice!!

ericdallo 2021-02-25T12:20:26.241500Z

I did a refactor or the way lsp find the configs too, the next release should has a smarter way to get the config

ericdallo 2021-02-18T00:45:48.172100Z

Hello! It should work, could you show a little repro?

2021-02-18T00:50:50.172300Z

2021-02-18T00:50:53.172700Z

2021-02-18T00:51:34.173100Z

Here is the difference for macOS and Windows

ericdallo 2021-02-18T00:52:14.173300Z

Hum, indeed, probably related with windows path, I thought that was fixed recently :thinking-face:

ericdallo 2021-02-18T00:52:58.173500Z

Could you open a issue please? Following the template to help find the real issue? I can take a look soon :)

2021-02-18T01:16:15.173700Z

I filed an issue https://github.com/clojure-lsp/clojure-lsp/issues/326 Thanks.

borkdude 2021-02-18T15:47:56.175200Z

Does clojure-lsp have any developer documentation? I want to build it locally but don't know how. I tried graalvm/native-unix-compile.sh but I got:

Syntax error macroexpanding at (db.clj:1:1).
Execution error (FileNotFoundException) at clojure-lsp.db/loading (db.clj:1).
Could not locate next/jdbc__init.class, next/jdbc.clj or next/jdbc.cljc on classpath.

borkdude 2021-02-18T15:53:40.175500Z

Plz add some build docs :)

dharrigan 2021-02-18T15:58:36.175700Z

There is a Makefile

dharrigan 2021-02-18T15:58:42.175900Z

lein bin builds

ericdallo 2021-02-18T15:58:57.176200Z

There is a build section @borkdude

ericdallo 2021-02-18T15:59:19.176700Z

https://clojure-lsp.github.io/clojure-lsp/#building

ericdallo 2021-02-18T15:59:26.177100Z

LMK if missing anything

borkdude 2021-02-18T15:59:55.177400Z

This is weird though:

$ clj
Clojure 1.10.2
user=> (require '[next.jdbc :as jdbc])
Execution error (FileNotFoundException) at user/eval1 (REPL:1).
Could not locate next/jdbc__init.class, next/jdbc.clj or next/jdbc.cljc on classpath.

ericdallo 2021-02-18T16:00:29.178100Z

Indeed :thinking_face:

dharrigan 2021-02-18T16:00:44.178400Z

the ❯ ./graalvm/native-unix-compile.sh seems to work for me too

ericdallo 2021-02-18T16:00:48.178700Z

Does that happens with lein repl too?

borkdude 2021-02-18T16:00:50.178800Z

I am getting the same kind of error when building with lein. Thanks for the docs. I was confused with the links on the top :)

dharrigan 2021-02-18T16:01:02.179100Z

[clojure-lsp:1061095]        write:     736.84 ms,  3.48 GB
[clojure-lsp:1061095]      [total]:  91,653.86 ms,  3.48 GB

dharrigan 2021-02-18T16:01:07.179500Z

Although, I am on Arch 🙂

ericdallo 2021-02-18T16:01:13.179700Z

Yeah, I was thinking in move that to a header section

borkdude 2021-02-18T16:01:23.179900Z

yes, lein repl crashes with the same

borkdude 2021-02-18T16:01:28.180100Z

$ lein repl
Compiling 1 source files to /Users/borkdude/Dropbox/dev/clojure/clojure-lsp/target/classes
#error {
 :cause Could not locate next/jdbc__init.class, next/jdbc.clj or next/jdbc.cljc on classpath.
 :via

ericdallo 2021-02-18T16:01:38.180400Z

That's weird

borkdude 2021-02-18T16:02:25.180700Z

yeah, the dep should be there:

seancorfield/next.jdbc 1.1.613
  org.clojure/java.data 1.0.78
    org.clojure/tools.logging 1.1.0
:thinking_face:

borkdude 2021-02-18T16:03:01.181Z

This does work though:

user=> (require '[medley.core :as m])
nil

borkdude 2021-02-18T16:03:46.181200Z

What clojure version are you using locally

borkdude 2021-02-18T16:06:01.181500Z

(never mind, 1.10.2 is in the deps.edn)

borkdude 2021-02-18T16:07:05.182Z

Hmm, now it works. I don't know what happened, but I removed this dep from my .m2 and messed a little bit with the deps.edn file and now it works...

borkdude 2021-02-18T16:07:32.182300Z

Maybe some kind of caching issue

ericdallo 2021-02-18T16:16:26.185Z

Yeah, my guess is some m2 cache issue

borkdude 2021-02-18T16:17:04.186300Z

Tried out the newest clj-kondo with clojure-lsp locally. Completion now seems to work with set/. Although the invalid symbol is reported in the wrong spot :thinking_face:. I'll take a look at this...

ericdallo 2021-02-18T16:17:06.186600Z

I want to add pedantic flag to project.clj, not sure this would help fixing that kind of issue too

ericdallo 2021-02-18T16:18:07.187200Z

That's awesome!!

ericdallo 2021-02-18T16:18:21.187400Z

I intend to bump clj-kondo tonight

ericdallo 2021-02-18T16:18:28.187600Z

And make those tests

skuro 2021-02-18T16:18:56.188300Z

just started fiddling with clojure-lsp but something doesn't seem to add up:

skuro 2021-02-18T16:19:34.189Z

this is what I have in *Messages*:

LSP :: Sending to process failed with the following error: Process clojure-lsp not running
LSP :: Connected to [clojure-lsp:483714 status:starting].
LSP :: clojure-lsp has exited (exited abnormally with code 127)
Server clojure-lsp:483714 status:starting exited with status exit. Do you want to restart it? (y or n) n

ericdallo 2021-02-18T16:20:14.190Z

@skuro, probably the executable is not right, how did you installed it?

ericdallo 2021-02-18T16:20:36.190800Z

Try setting lsp-clojure-command-path in emacs

skuro 2021-02-18T16:20:37.190900Z

brew install clojure-lsp

ericdallo 2021-02-18T16:20:49.191300Z

Oh, brew has a super outdated version :/

ericdallo 2021-02-18T16:21:10.192100Z

We have a issue to create a custom tap to make that always updated

skuro 2021-02-18T16:21:31.192900Z

oh I see

ericdallo 2021-02-18T16:21:33.193Z

My suggestion for now, is to download from GitHub releases

ericdallo 2021-02-18T16:21:41.193400Z

@andre.peric is working on that :)

skuro 2021-02-18T16:21:58.193700Z

roger, thanks

borkdude 2021-02-18T17:05:12.193800Z

@ericdallo I now fixed it in clj-kondo master.

borkdude 2021-02-18T17:05:29.194Z

The location is alright now. The behavior of clojure-lsp is a bit inconsistent:

borkdude 2021-02-18T17:05:47.194200Z

When I have a top level ns require and then type set/ I don't get the completions on tab

borkdude 2021-02-18T17:06:01.194400Z

But when I then type (require '[clojure.set :as set]) and try it again, it works

ericdallo 2021-02-18T17:06:21.194600Z

Nice!

ericdallo 2021-02-18T17:06:28.194800Z

Hum, will need to take a look

ericdallo 2021-02-18T17:06:32.195Z

it should behave the same

borkdude 2021-02-18T17:06:34.195200Z

borkdude 2021-02-18T17:07:13.195800Z

In the second screenshot I did not get completions. The first screenshot is the same as the first + some code added at the bottom

ericdallo 2021-02-18T17:07:58.196Z

Alright, I can investigate that soon, I hope is some simple to fix 😛

ericdallo 2021-02-18T17:08:07.196200Z

from clj-kondo analysis, is everything correct, right?

borkdude 2021-02-18T17:08:23.196400Z

yeah, it's a bit wobbly in lsp, when I move the cursor it suddenly starts working now

borkdude 2021-02-18T17:08:26.196600Z

yeah, should be ok now

ericdallo 2021-02-18T17:09:55.196800Z

:thinking_face: In the issue, there was a rewrite-clj issue that was solved: https://github.com/clojure-lsp/clojure-lsp/issues/270

ericdallo 2021-02-18T17:10:10.197100Z

maybe there is some corner case where it does not work properly

2021-02-18T18:27:33.200Z

How does project indexing works on clojure-lsp? Most of the time when I open an file on my project and try to go to definition it fails until I open the destination file manually. I'm using vim and coc if this is relevant information.

ericdallo 2021-02-18T18:28:13.200100Z

when starting clojure-lsp, it should call clj-kondo to analyze the whole classpath

ericdallo 2021-02-18T18:28:27.200300Z

check the /tmp/clojure-lsp.*.out log

ericdallo 2021-02-18T18:29:39.200500Z

it should use lein classpath , clojure -Spath or boot

2021-02-18T18:29:43.200700Z

That may be related as I use neomake to run clj-kondo (it was there before clojure-lsp start using clj-kondo). Let me try to remove neomake for that.

ericdallo 2021-02-18T18:29:46.200900Z

it depends on your project type

2021-02-18T18:30:05.201100Z

It uses the default clj-kondo cache for the project right?

ericdallo 2021-02-18T18:30:09.201300Z

yeah, clojure-lsp already use clj-kondo under the hood for lint

ericdallo 2021-02-18T18:30:12.201500Z

yes

2021-02-18T18:30:58.201700Z

Thanks, I will investigate things on my side.

ericdallo 2021-02-18T18:31:22.201900Z

yeah, try to rm .clj-kondo/.cache and .lsp/sqlite.db

2021-02-18T18:32:52.202100Z

Should be a .lsp/sqlite.1.db and a .lsp/sqlite.5.db on .lsp?

2021-02-18T18:40:11.202300Z

So, after removing the files you suggested looks like everything is working. Thank you!

2021-02-18T18:40:32.202500Z

And I also removed neomake for clj-kondo.

ericdallo 2021-02-18T18:43:35.202700Z

yeah, those are old db, you can always safely remove them

ericdallo 2021-02-18T18:43:44.202900Z

nice, good to know it works now 🙂

borkdude 2021-02-18T18:46:50.203100Z

@ericdallo Should clojure-lsp maybe have a command to re-index from scratch? I observed that "rm sqlite" is often recommended here, but this could maybe be supported better

ericdallo 2021-02-18T18:48:16.203300Z

not sure worth the implementation since is quite a simple rm command, but spend some time in some way to make lsp know that the sqlite is old would be really good

borkdude 2021-02-18T18:50:35.203600Z

it's a simple command but it requires you to leave your buffer

borkdude 2021-02-18T18:50:57.203800Z

and it's often the solution to unclear problems

borkdude 2021-02-18T18:51:19.204Z

anyway, not a big deal ;)

2021-02-18T18:52:18.204200Z

On vim you don't need to leave the buffer 😉

borkdude 2021-02-18T18:53:05.204400Z

Vim would be a different buffer for me though!

ericdallo 2021-02-18T18:53:14.204600Z

yeah, it could be done, I don't see any problem having a command for that too 🙂

2021-02-18T18:53:58.204800Z

Does it always does a full index when you open an project?

2021-02-18T18:54:32.205Z

Only index stale files could be an improvement if it doesn't do it already.

ericdallo 2021-02-18T18:57:13.205200Z

it does a full index the first time or when the project deps have changed

borkdude 2021-02-18T18:57:13.205400Z

It will probably already do this using hashes

borkdude 2021-02-18T19:06:17.205700Z

@ericdallo We have a deps.edn with deps for our front-end and deps for our backend in two different aliases. Will clojure-lsp detect this automatically? Or should I use :classpath-cmd ["clojure" "-A:frontend:backend" "-Spath"] ?

borkdude 2021-02-18T19:10:31.205900Z

for now I did it like the latter

ericdallo 2021-02-18T19:24:20.206100Z

yeah you should use that custom classpath-cmd, otherwise clojure-lsp will use a default clojure -Spath

borkdude 2021-02-18T19:25:42.206300Z

good to know

ericdallo 2021-02-18T23:10:27.206500Z

It was indeed a bug on clojure-lsp code related to the rewrite-clj workaround

ericdallo 2021-02-18T23:10:39.206700Z

I fixed and bumped and finally we have completion working properly 🎉

borkdude 2021-02-18T23:11:27.206900Z

🎉 🎉 🎉