Fork me on GitHub
#lsp
<
2021-08-19
>
anonimitoraf04:08:01

Browsing the settings doc • text-document-sync-kind - What are the tradeoffs of :full vs :incremental? And why is :full the default?

ericdallo12:08:45

Whenever a change is made to a file, the client can send only the lines it was changed or the full text document updated

ericdallo12:08:56

Usually the incremental helps for huge buffers

ericdallo12:08:21

But I could not make it work perfectly yet, giving some outdated buffers bugs

ericdallo12:08:37

That's why full is the default yet

anonimitoraf01:08:02

Ah I see. Is there an audit of the buffer bugs? Just out of curiosity

ericdallo01:08:26

I don't remember exactly what was the issue, but It was not something easy to fix and it was making clojure-lsp really unusable 😕

anonimitoraf01:08:15

Ah ok 😞. An emacs-specific bug yeah?

ericdallo01:08:05

not really, should happen for all clients

ericdallo01:08:26

I intend to go back and take a look, but I'm trying to prioritize some other things

anonimitoraf01:08:41

Ah ok yea, no worries 🙂 Was just curious

👍 3
lassemaatta06:08:51

are there any known performance issues regarding :completion?

lassemaatta06:08:27

Every one in a while I notice my laptop fans spinning loudly and see that clojure-lsp is using quite a few of my cpu cores

lassemaatta06:08:58

Nothing appeared in the logs for a few minutes, then about a dozen lines of :completion 150000ms (the duration ranged from 130 to 150 seconds).

lassemaatta06:08:04

It seems I can trigger this quite consistently by doing something like (get-in m [:foo :bar :zed :lol :kek ..... It seems that typing each kw triggers a new completion attempt and typing enough keywords fast enough consumes all the cores

pez06:08:28

Oh, wow, sounds like a great find!

lassemaatta07:08:08

I assume that normally :completion shouldn't take that long, but I'm dealing with a rather huge project and I assume that trying to do completion just takes longer than in a smaller project and it's easier to trigger multiple concurrent completion attempts (which just escalates the problem further)

anonimitoraf11:08:39

I think I see this too. Sometimes completions, sometimes they don't. Although it doesn't bother me too much. I do wonder though, any possible optimizations that you can think of @UKFSJSM38?

ericdallo12:08:57

We need to confirm it's related to completion indeed or completion is taking more time because it:s waiting for the didChange process async like in the calva issue

ericdallo12:08:06

Could you elaborate the repro please?

lassemaatta15:08:54

I'll try to figure out in more detail what's going on and whether or not I can isolate the problem to a simple reproduction outside my main project. Originally, today while working with some code, I noticed that anytime I typed a sequence of consecutive keywords, clojure-lsp would end up consuming 4-6 cpu cores for a few minutes. For example if I had (let [x (get-in m [:x |])] ... (where | is my cursor), and I quickly typed 5 more keywords into the lookup vector -> cpu usage would rise and after a while the clojure-lsp log would show a bunch of :completion lines. I also checked that this also happens in an empty ns with no requires.

ericdallo15:08:19

Yeah, quite odd behaviour, a repro would certainly help

lassemaatta17:08:11

a couple of very un-scientific tests and observations: • Everything seems to work fine in a bare bones lein new app foo project. Typically the duration in the :completion logging is just dozens of ms and the cpu usage is low. After a few times after trying really hard I managed to get a few random cases of approx 1000 ms, but the change in the cpu usage is minimal so it's really hard to notice. • I added a whole bunch of top level dependencies (`lein deps :tree` prints something like 300+ libraries) to the project, but didn't :require any of them. Now it was much easier to see how the cpu usage climbed when typing lots of keywords. Instead of seeing values like 1000 ms rarely, I could consistently see multiple cpu cores being utilized for several seconds and the :completion durations in the range of 5000 ms. Again, I could see how several lines of :completion <some value near 5000ms> were printed after the cpu usage had been high for a few seconds. • Setup ◦ I deleted the .lsp directory between tests ◦ I recreated the .clj-kondo cache between tests and linted the classpath as described in the clj-kondo "project setup" chapter. ◦ No configuration for lsp or clj-kondo

ericdallo17:08:51

that helps a lot actually, probably the computation in the completion inside clojure-lsp is considering keywords from external deps, which probably doesn't make sense

ericdallo17:08:18

I didn't confirm that, but I can try to take a look, could you pass that repro with those deps later?

ericdallo17:08:23

or open an issue with that

lassemaatta17:08:15

sure, I can try to push this to github tomorrow. I need to sanitize the deps a bit as they contain some private libraries not available on clojars etc.

👍 3
lassemaatta17:08:40

and to be clear, my state-of-the-art way to trigger this was to type a lot of short keywords really really fast, ie. (get m [:q :w :e :r :t <imagine 30 keywords here> .. 😄

ericdallo14:08:32

FYI call-hierarchy support on vim 🧵

ericdallo14:08:51

This issue was done, so I guess call hierarchy will work on coc?

ericdallo14:08:04

clojure-lsp already supports that from server side

dharrigan14:08:03

Just saw that 🙂