Fork me on GitHub
#lsp
<
2021-02-24
>
mikejcusack00:02:15

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.

ericdallo00:02:07

maybe ask too on #emacs or #doom-emacs

ericdallo00:02:18

#emacs has way more people

mikejcusack00:02:52

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

kimim04:02:13

@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.

ericdallo11:02:02

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

kimim12:02:26

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

ericdallo12:02:12

(:project-root @db/db) probably

kimim12:02:09

it is nil.

ericdallo12:02:07

did the server started correctly?

ericdallo12:02:24

it'll persist that after the initialize request

ericdallo12:02:35

I suggest you compile with lein with-profile debug bin

ericdallo12:02:40

start clojure-lsp in a sample project

ericdallo12:02:51

and connect to the running repl, gettint the nrepl port

ericdallo12:02:05

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

kimim12:02:38

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

ericdallo12:02:18

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

kimim14:02:00

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

ericdallo14:02:20

LMK if you need help

borkdude09:02:15

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

borkdude09:02:42

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

ericdallo11:02:32

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

ericdallo15:02:00

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

ā¤ļø 6
šŸŽ‰ 3
clojure-lsp 1
borkdude15:02:42

Does this also include the incremental sending of changed text?

ericdallo15:02:55

No @U04V15CAJ I'm having a hard time making that work šŸ˜…

borkdude15:02:18

No problems, just curious :)

ericdallo15:02:46

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

ericdallo15:02:23

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

ericdallo15:02:39

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)

ericdallo15:02:46

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

borkdude15:02:17

so you need debouncing

ericdallo15:02:29

yeah šŸ™‚

borkdude15:02:53

I googled that for you :)

ericdallo15:02:04

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

ericdallo15:02:41

Oh, maybe that could work šŸ˜„

ericdallo15:02:52

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

ericdallo16:02:47

It fix the issue indeed @U04V15CAJ thank you again šŸ™‚ It seems to have a issue though, or I need a different function

ericdallo16:02:09

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

ericdallo16:02:46

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

ericdallo16:02:58

tiny sample:

(def in (chan 1))

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

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

ericdallo16:02:06

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

ericdallo16:02:18

and the fourth, sixty etc,

borkdude16:02:14

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

borkdude16:02:23

(#clojure will possibly give more answers)

ericdallo18:02:20

need to make some concurrency tests yet

ribelo19:02:55

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

ericdallo19:02:36

that is from emacs lsp-mode, generic settings

ribelo20:02:48

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

ribelo20:02:55

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

ericdallo20:02:19

Any exception on the log?

ericdallo20:02:24

Relate to that?

ribelo20:02:54

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

ribelo20:02:32

and yes, there is an expection

ribelo20:02:56

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

ribelo20:02:53

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

ericdallo20:02:29

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

ericdallo20:02:54

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

ribelo20:02:58

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

ericdallo20:02:47

is your project a boot one?

ericdallo20:02:36

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

ericdallo20:02:57

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

ericdallo20:02:14

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

ribelo20:02:20

we previously used boot, now deps.edn

ericdallo20:02:38

Did removing the boot file worked?

ericdallo20:02:14

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

ericdallo20:02:32

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

ribelo20:02:20

Yes, it's working.

nice 1
practicalli_john22:02:59

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.

borkdude22:02:22

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

borkdude22:02:47

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

borkdude22:02:13

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

mikejcusack22:02:27

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

ericdallo22:02:38

ā˜ļø

borkdude22:02:41

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

borkdude22:02:07

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

ericdallo22:02:02

Sure, this is a easy valid change

ericdallo22:02:39

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

borkdude22:02:33

You can get it from the CLJ_KONDO_VERSION file on the classpath

šŸ‘ 1
ericdallo12:02:31

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

borkdude12:02:55

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

borkdude12:02:01

this is good enough

borkdude12:02:43

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)

borkdude12:02:00

or some script or something

borkdude12:02:07

I leave that as an exercise ;)

ericdallo12:02:01

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

ericdallo12:02:33

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

ericdallo12:02:04

That could be pretty common for libs using the analyzer

borkdude12:02:26

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

ericdallo22:02:45

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

practicalli_john22:02:21

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
borkdude22:02:30

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

šŸ˜„ 1
practicalli_john22:02:50

Even more joy šŸ™‚

borkdude22:02:24

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

clj-kondo 3
ericdallo22:02:24

Oh, that's cool!