lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
mikejcusack 2021-02-24T00:45:44.199900Z

Doesn't that do the opposite? Doesn't that disable LSP completion?

ericdallo 2021-02-24T00:46:16.200200Z

Oh yeah, fixed it, thanks!

👍 1
Lucy Wang 2021-02-24T00:48:01.200600Z

ah right I remember that, but what if the remote process is simply a jar without the source code there?

dpsutton 2021-02-24T00:49:39.200900Z

not sure. haven't tried that use case. i think it only does the prefix of the path so if the jar stuff could just be mangled and chopped to match the local directory it could work

mikejcusack 2021-02-24T00:56:15.202400Z

Does anyone have a working doom+lsp+rebl set up? I'm following the directions from the REBL docs, but the communication between Doom and REBL isn't working.

ericdallo 2021-02-24T00:57:07.202500Z

maybe ask too on #emacs or #doom-emacs

ericdallo 2021-02-24T00:57:18.202700Z

#emacs has way more people

mikejcusack 2021-02-24T00:58:52.202900Z

Ok, thanks. I wish I could just use a clojure.main repl like in Cursive. It works without a hitch there.

2021-02-24T04:51:13.204Z

@ericdallo Hello Eric, I am investigating the classpath loading failure issue. How to get the project-root value when I connect to the running nrepl? Thanks.

ericdallo 2021-02-24T11:02:02.206Z

Hi! You can call lsp-clojure-cursor-info and check the :port

2021-02-24T12:51:26.206200Z

I connected to the nrepl already. How can I start debug clojure-lsp, for example, get the project-root value through repl? thanks.

ericdallo 2021-02-24T12:52:12.206400Z

(:project-root @db/db) probably

2021-02-24T12:53:09.206600Z

it is nil.

ericdallo 2021-02-24T12:54:07.206800Z

did the server started correctly?

ericdallo 2021-02-24T12:54:24.207Z

it'll persist that after the initialize request

ericdallo 2021-02-24T12:54:35.207200Z

I suggest you compile with lein with-profile debug bin

ericdallo 2021-02-24T12:54:40.207400Z

start clojure-lsp in a sample project

ericdallo 2021-02-24T12:54:51.207600Z

and connect to the running repl, gettint the nrepl port

ericdallo 2021-02-24T12:55:05.207800Z

then you can eval things that will affect the clojure-lsp running in your sample project

ericdallo 2021-02-24T12:57:37.208Z

maybe this can help: https://clojure-lsp.github.io/clojure-lsp/#community-development

2021-02-24T12:57:38.208300Z

Yes. I compiled with :debug, and running with clojure-lsp project. lsp-log-io is on, and I can get the logs now.

ericdallo 2021-02-24T12:58:18.208500Z

tip: you can use lsp-workspace-show-log

2021-02-24T14:03:00.208700Z

no clues today. i will continue digging the information later. Thanks.

ericdallo 2021-02-24T14:03:20.208900Z

LMK if you need help

borkdude 2021-02-24T09:36:15.205300Z

How can I get the call hierachy in lsp-mode?

borkdude 2021-02-24T09:39:42.205700Z

found it, lsp-treemacs. the outgoing hierarchy would also be possible to implement I think

ericdallo 2021-02-24T11:01:32.205800Z

Yes! Feel free to open a feature request issue :)

ericdallo 2021-02-24T15:18:00.210800Z

:clojure-lsp: Released clojure-lsp https://github.com/clojure-lsp/clojure-lsp/releases/tag/2021.02.24-14.23.08 :clojure-lsp: • Add new Thread first/last all code actions 🎉 • Improve completion performance using completion/resolveItem for documentation request

1
❤️ 6
🎉 3
borkdude 2021-02-24T15:18:42.211100Z

Does this also include the incremental sending of changed text?

ericdallo 2021-02-24T15:21:55.211400Z

No @borkdude I'm having a hard time making that work 😅

ericdallo 2021-02-24T15:22:05.211600Z

https://github.com/clojure-lsp/clojure-lsp/pull/336

borkdude 2021-02-24T15:22:18.211900Z

No problems, just curious :)

ericdallo 2021-02-24T15:22:46.212100Z

I need clojrue way to queue the changes and process them in some ms, instead of analyzing with clj-kondo at each change

ericdallo 2021-02-24T15:23:23.212400Z

I tried using clojure.async or with atom, but unsuccessfully

ericdallo 2021-02-24T15:24:39.213100Z

like, if you input 100 1 really fast (holding the key), clojure-lsp will receibe 100 didChange notifications, we should only analyze if the last didCHange took 200ms (or some configured time)

ericdallo 2021-02-24T15:25:46.213300Z

is not paralel, it just wait some time to analyze with clj-kondo the merge of all code changes one time instead of calling clj-kondo for each change

borkdude 2021-02-24T15:26:17.213500Z

so you need debouncing

ericdallo 2021-02-24T15:26:29.213700Z

yeah 🙂

borkdude 2021-02-24T15:26:47.213900Z

https://gist.github.com/scttnlsn/9744501

borkdude 2021-02-24T15:26:53.214100Z

I googled that for you :)

ericdallo 2021-02-24T15:27:04.214300Z

in that PR I process with your magic replace-text function and add to async channel, I just need to process them with debouncing

ericdallo 2021-02-24T15:27:41.214500Z

Oh, maybe that could work 😄

ericdallo 2021-02-24T15:27:52.214700Z

need to test, it's something that is not clear to me yet

ericdallo 2021-02-24T16:15:47.215800Z

It fix the issue indeed @borkdude thank you again 🙂 It seems to have a issue though, or I need a different function

ericdallo 2021-02-24T16:16:09.216Z

the debounce only happens when a second or other values are inserted in the specified time

ericdallo 2021-02-24T16:16:46.216200Z

if I just call it once, (after calling one time), it will not get the value from in

ericdallo 2021-02-24T16:16:58.216400Z

tiny sample:

(def in (chan 1))

(put! in {:bar (rand-int 100)})

(go-loop [value (<! (debounce in 1000))]
  (println value)
  (recur (<! (debounce in 1000))))

ericdallo 2021-02-24T16:18:06.216700Z

if I run the go-loop multiple or the first time, it works as expected, but the second time it doesn't print

ericdallo 2021-02-24T16:18:18.216900Z

and the fourth, sixty etc,

borkdude 2021-02-24T16:22:14.217100Z

Sorry, I'm cooking dinner. Ask in #core-async or #clojure

borkdude 2021-02-24T16:22:23.217300Z

(#clojure will possibly give more answers)

ericdallo 2021-02-24T16:24:35.217500Z

np, thanks!

ericdallo 2021-02-24T18:12:20.218100Z

need to make some concurrency tests yet

borkdude 2021-02-24T18:14:49.218300Z

Very good

ericdallo 2021-02-24T18:37:09.218500Z

@borkdude if wanna give a try later: https://github.com/clojure-lsp/clojure-lsp/pull/336

2021-02-24T19:55:55.219Z

I see that the show-docs-arity-on-same-line? option has disappeared from settings https://emacs-lsp.github.io/lsp-mode/page/settings/

ericdallo 2021-02-24T19:59:08.219500Z

this is the correct clojure-lsp docs: https://clojure-lsp.github.io/clojure-lsp/

ericdallo 2021-02-24T19:59:36.219800Z

that is from emacs lsp-mode, generic settings

2021-02-24T20:04:48.220Z

well it seems to be some kind of regression, because it stopped working

2021-02-24T20:08:55.220300Z

besides, there is probably some other problem, because after 5 minutes of work, the log is over 3mb

ericdallo 2021-02-24T20:09:19.220500Z

Any exception on the log?

ericdallo 2021-02-24T20:09:24.220700Z

Relate to that?

2021-02-24T20:09:54.220900Z

99% of data is Cannot find position data when analysing fn*

2021-02-24T20:10:32.221100Z

and yes, there is an expection

2021-02-24T20:10:56.221300Z

Error while looking up classpath info in /home/ribelo/code/frisco-react Cannot run program "boot" (in directory "/home/ribelo/code/frisco-react"): error=2, No such file or directory

2021-02-24T20:13:53.221500Z

the error is probably on the side of our repo, because we gave up boot, but the build.boot file remained.

ericdallo 2021-02-24T20:16:29.221700Z

the Cannot find position data when analysing fn* is something to fix on clojure-lsp butis not a error just a unecessary log

ericdallo 2021-02-24T20:16:54.221900Z

the exception is indeed a error, we need to understand why is not analyzing correctly

2021-02-24T20:19:58.222200Z

After deleting build.boot there is no exception, the rest is unchanged

ericdallo 2021-02-24T20:26:47.222400Z

is your project a boot one?

ericdallo 2021-02-24T20:29:12.222600Z

clojure-lsp use these default project specs: https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/crawler.clj#L53-L61

ericdallo 2021-02-24T20:29:36.222900Z

if it finds the file in project-path , it then use the classpath-cmd to get the classpath

ericdallo 2021-02-24T20:29:57.223100Z

so if your project is a lein one, it'll use lein classpath to get the classpath

ericdallo 2021-02-24T20:29:58.223300Z

etc

ericdallo 2021-02-24T20:31:14.223500Z

but build.boot is the third one, so it should check if the projet is a lein or deps.edn one

2021-02-24T20:32:20.223700Z

we previously used boot, now deps.edn

ericdallo 2021-02-24T20:35:38.223900Z

Did removing the boot file worked?

2021-02-24T20:44:27.224200Z

yes

ericdallo 2021-02-24T20:50:14.224400Z

I see, I'll double check the priority on the default project specs

ericdallo 2021-02-24T20:50:32.224600Z

the show-docs-arity-on-same-line? should work now

2021-02-24T20:51:20.224900Z

Yes, it's working.

1
practicalli-john 2021-02-24T22:12:59.229200Z

Is the LSP and clj-kondo integration used by flycheck in Emacs-lsp? In Spacemacs, clj-kondo is typically added via a clojure-enable-linter variable on the Clojure layer (or a setq of the same name). Just wondering if running a am duplicating code analysis that clj-kondo is doing for LSP if I also include a linter for flycheck.

borkdude 2021-02-24T22:13:22.229600Z

@jr0cket No, if you want to use flycheck clj-kondo you should disable diagnostics

borkdude 2021-02-24T22:13:47.230Z

You can use both independently (which I am doing, because I'm developing it)

borkdude 2021-02-24T22:14:13.230600Z

But for most typical usage it's recommended to use the one built-in lsp probably

ericdallo 2021-02-24T22:14:38.231500Z

☝️

borkdude 2021-02-24T22:14:41.231700Z

However, to diagnose issues with clj-kondo, it is recommended to provide a command line repro

borkdude 2021-02-24T22:15:07.232900Z

@ericdallo Can clojure-lsp print the clj-kondo version? This would be really nice for error reports

ericdallo 2021-02-25T12:27:31.241900Z

it's printing (string/trim (slurp (io/resource "CLJ_KONDO_VERSION"))) => "2021.02.14-SNAPSHOT" not the exactly version on deps.edn: 2021.02.14-20210218.170309-6

borkdude 2021-02-25T12:27:55.242100Z

yeah, that version you cannot know before you to push to clojars

borkdude 2021-02-25T12:28:01.242300Z

this is good enough

ericdallo 2021-02-25T12:28:08.242500Z

Ok 🙂

borkdude 2021-02-25T12:28:43.242700Z

But you can maybe do your own version parsing from your deps.edn at compile time (beware that deps.edn isn't usually in the deployed jar)

borkdude 2021-02-25T12:29:00.242900Z

or some script or something

borkdude 2021-02-25T12:29:07.243100Z

I leave that as an exercise ;)

ericdallo 2021-02-25T12:33:01.243400Z

hahahaha I think I'll just use the resource file version, parsing the deps.edn looks harder/dangerous for a simple thing like that

ericdallo 2021-02-25T12:33:33.243600Z

maybe clj-kondo could has a function via JVM for that

ericdallo 2021-02-25T12:34:04.243800Z

That could be pretty common for libs using the analyzer

borkdude 2021-02-25T12:34:26.244Z

clj-kondo doesn't know this version itself, it's generated by clojars, like I said before. but you know this version, because you are adding it to your deps.edn

ericdallo 2021-02-25T12:35:01.244200Z

Oh, I see

ericdallo 2021-02-24T22:15:45.234200Z

For most users that just want to use lsp, the clj-kondo flychrck is not needed

ericdallo 2021-02-24T22:16:02.234400Z

Sure, this is a easy valid change

practicalli-john 2021-02-24T22:16:21.235Z

I would like clj-kondo to keep giving me joy, but dont need clj-kondo to do twice the work to give me the same joy. So it seems I can switch off the clojure-enable-linter variable and still get the same joy. Thank you 🙂

👍 1
borkdude 2021-02-24T22:16:30.235300Z

You will even get a newer clj-kondo sometimes, because Eric Dallo uses clj-kondo from master ;)

😄 1
ericdallo 2021-02-24T22:16:39.235400Z

I'll add to lsp-clojure-server-info and clojure-lsp --version

practicalli-john 2021-02-24T22:16:50.235700Z

Even more joy 🙂

borkdude 2021-02-24T22:17:13.236Z

thanks!

borkdude 2021-02-24T22:17:33.236300Z

You can get it from the CLJ_KONDO_VERSION file on the classpath

👍 1
borkdude 2021-02-24T22:28:24.237Z

I just merged a new linter to master. :redundant-expression. Example:

3
mikejcusack 2021-02-24T22:39:27.237500Z

In Doom, at least, it seems to be disabling flycheck when LSP is enabled.

ericdallo 2021-02-24T22:45:24.237700Z

Oh, that's cool!