Fork me on GitHub
#lsp
<
2021-08-05
>
lassemaatta14:08:04

does/should the lint-project-files-after-startup? setting affect the "linting unused public vars" feature at startup or should that be controlled separately with the :linters settings?

lassemaatta14:08:51

asking because Linting unused public vars for whole project took 382950ms 😅

ericdallo14:08:07

yeah, I found that issue and know how to fix it

ericdallo14:08:29

basically that feature is:

ericdallo14:08:22

if lint-project-files-after-startup? is enabled (true as default), it will lint all files from your project to have informations like how many errors/warnings your project has, exmple on emacs modeline:

ericdallo14:08:29

it doesn't affect any linter though

ericdallo14:08:34

this is the heavier feature of clojure-lsp and depends on the project size, I tested on one of the biggest services on Nubank, and took 391838ms , but Remeber this run async and should not affect performance that much

ericdallo14:08:52

on other medium/small projects, it's quite fast

ericdallo14:08:56

TLDR the exception was that I was not using async/>! but async/put! which doesn't have backpressure 😅

lassemaatta14:08:13

I dread the day I must do something non-trivial with core.async, I can barely write working synchronous code 🙂

😂 6
ericdallo14:08:06

yeah, clojure-lsp is not a heavy case of async, but I already learned a lot of async with it 😛

lassemaatta16:08:40

hmm... I added :linters {:unused-public-var {:level :off}} to my .lsp/config.edn but it seems clojure-lsp still performs the unused var linting. was this a known issue or am I doing something wrong?

ericdallo16:08:48

oh, I need to update the docs about that, if you want to disable the public lint, you need to do that on clj-kondo side, add {:linters {:clojure-lsp/unused-public-var {:level :off}}} to your .clj-kondo/config.edn

lassemaatta16:08:07

hmm.. that did not seem to have any effect. I assume the clj-kondo config is read when I restart emacs and not cached anywhere?

ericdallo16:08:57

just to confirm, you want to not lint public var for your files, right?

lassemaatta16:08:44

yeah. or more precisely: I don't want clojure-lsp to consume one of my cpu cores for ~5 minutes every time I (re)start emacs and I assume that the culprit is that unused-public-var linting

ericdallo16:08:11

alright so, the best approach is not that

ericdallo16:08:25

but disable :lint-project-files-after-startup?

lassemaatta16:08:39

I've already done that

lassemaatta16:08:52

(or at least I've attempted to do that)

ericdallo16:08:11

hum, I just checked the code, and I found the performance issue is some lines before that one

ericdallo16:08:50

yeah, I'll make a fix to check that flag before the code that is heavy

lassemaatta16:08:42

I assume that :lint-project-files-after-startup? false is doing something, because I no longer get those "a/b/c" counters for the errors and warnings

ericdallo16:08:53

yes, but the heavy calculation is being done yet facepalm

ericdallo16:08:15

could you test from master branch?

lassemaatta16:08:39

sure, I'll report back my findings 👍

lassemaatta16:08:56

the issue seems to be resolved 🎉

ericdallo16:08:29

Good 🙂 I have plans to improve somehow that part of clojure-lsp, but i'll not be an easy task

lassemaatta16:08:06

I also noticed that a) it seems to be running over java (as you mentioned) and b) the "analyzing source paths" parts was about 30% faster than previously (22 seconds vs. 35) and it used multiple cores simultaneously

ericdallo16:08:23

hum, let's wait next release (I'll do a fix release soon) to test the graalvm binary one

lassemaatta16:08:16

sure. Can I try to do the graalvm build or does it require some additional magic/setup?

ericdallo16:08:35

oh, that'd be great

lassemaatta16:08:11

seems to be working ok. The "analyzing source paths" seems to be running on a single core and as such takes a bit longer than the java version (32 seconds on native). And if I re-enable the :lint-project-files-after-startup? flag we get back to the "single core saturated for ~5 minutes" situation (for both the java and the native image).

lassemaatta16:08:47

those fast "didOpen", "documentHighlight" et al seem to be quite a bit faster on the native version vs. the java (no surprise there)

ericdallo17:08:10

yeah, graal takes a little more time for those analysis but consume less resources in general

ericdallo17:08:26

and I suppose you have a huge project

ericdallo17:08:37

usually I can't notice the analysis difference

ericdallo17:08:53

actually for medium/small projects I notice graal is faster

lassemaatta17:08:40

yeah, I think this is in the ballpark of 150-200k lines

😨 3
😂 3
ericdallo18:08:59

clojure-lsp Released 2021.08.05-18.25.54 with just minor fixes related to previous release: • Fix async project lint after startup for huge projects. https://github.com/clojure-lsp/clojure-lsp/issues/506 • Fix :lint-project-files-after-startup? to be considered before clojure-lsp lint unusued public vars. • Fix excluded symbols for code lens, making clojure-lsp check clj-kondo config as well for the linter :clojure-lsp/unused-public-var

borkdude18:08:50

Have you also bumped clj-kondo pretty please?

borkdude18:08:55

It contains a bugfix for Windows

ericdallo18:08:56

it's using 2021.08.03

borkdude18:08:32

it contains the fix on master, but it wasn't released yet. ah well

borkdude18:08:35

nobody complained so far

borkdude18:08:55

but in theory Calva windows users should be able to notice this...

ericdallo18:08:59

Yeah, otherwise my bump bot would catch that hehe

borkdude19:08:05

the analysis fails

borkdude19:08:14

due to some Window path thing

ericdallo19:08:35

I will bump to latest kondo so

ericdallo19:08:04

I'm releasing a fix including this bump as well

dharrigan18:08:58

something is broken

dharrigan18:08:09

installed this release, now vim is going ape on me

dharrigan18:08:28

Uncaught exception: Header must provide a Content-Length property.                                                           
Uncaught exception: Header must provide a Content-Length property.                                                           
Uncaught exception: Header must provide a Content-Length property.                                                           
Uncaught exception: Header must provide a Content-Length property.                                                           
Uncaught exception: Header must provide a Content-Length property.                                                           
Uncaught exception: Header must provide a Content-Length property.                                                           
Uncaught exception: Header must provide a Content-Length property.                                                           
Uncaught exception: Header must provide a Content-Length property. 

dharrigan18:08:47

literally just installed 2021.08.05-18.25.54

ericdallo18:08:01

let's discuss the issue in a thread please 🙂

dharrigan18:08:17

Here's a thread 🙂

ericdallo18:08:25

Does the issue only happens in the new version?

dharrigan18:08:32

Literally just installed this release.

dharrigan18:08:41

Going back to previous version

dharrigan18:08:50

2021.08.03-13.33.03 no issues

ericdallo18:08:16

that's odd, maybe some bad compiled binary, let me check

ericdallo18:08:25

could you test the clojure-lsp one from the releases page?

dharrigan18:08:48

Okay, will try that

dharrigan18:08:23

❯ clojure-lsp --version
clojure-lsp 2021.08.05-18.25.54
clj-kondo 2021.08.03

dharrigan18:08:26

firing up vim

dharrigan19:08:09

A whole screen full of Uncaught exception: Header must provide a Content-Length property.

ericdallo19:08:14

that's odd, this kind of message looks a issue with the client

ericdallo19:08:25

can you get server<->client json requests logs?

dharrigan19:08:16

2021-08-05T18:59:33.957Z daffy INFO [clojure-lsp.server:410] - Starting server...
2021-08-05T18:59:33.959Z daffy INFO [clojure-lsp.nrepl:21] - ====== LSP nrepl server started on port 39019
2021-08-05T18:59:33.962Z daffy INFO [clojure-lsp.server:295] - Initializing...
2021-08-05T18:59:33.975Z daffy INFO [clojure-lsp.source-paths:137] - Using given source-paths: ["src" "test"]
2021-08-05T18:59:39.670Z daffy INFO [clojure-lsp.crawler:162] - Analyzing source paths for project root /home/david/development/workspaces/foo
2021-08-05T18:59:41.818Z daffy INFO [clojure-lsp.crawler:121] - Paths analyzed, took 2.1473644 secs. Caching for next startups...
2021-08-05T18:59:41.947Z daffy DEBUG [clojure-lsp.server:?] - :initialize 7984ms
2021-08-05T18:59:41.955Z daffy INFO [clojure-lsp.server:341] - Initialized!
2021-08-05T18:59:41.955Z daffy DEBUG [clojure-lsp.server:?] - :initialized 0ms
2021-08-05T18:59:41.987Z daffy DEBUG [clojure-lsp.server:?] - :didOpen 31ms
2021-08-05T18:59:42.155Z daffy DEBUG [clojure-lsp.server:?] - :didOpen 167ms
2021-08-05T18:59:42.324Z daffy DEBUG [clojure-lsp.server:?] - :codeLens 5ms
2021-08-05T18:59:43.961Z daffy DEBUG [clojure-lsp.server:?] - :semanticTokensFull 5ms
2021-08-05T18:59:45.007Z daffy WARN [clojure-lsp.feature.diagnostics:85] - Invalid clj-kondo finding.  Cannot find position data for {:type :unresolved-var, :filename "/home/david/development/workspaces/foo/redis.clj", :message "Unresolved var: mapv", :row nil, :col nil, :end-row nil, :end-col nil, :level :warning}
2021-08-05T18:59:45.064Z daffy INFO [clojure-lsp.feature.diagnostics:148] - Linting whole project files took 3258ms

dharrigan19:08:21

is from clojure-lsp

dharrigan19:08:34

Literally nothing has been updated on the client

dharrigan19:08:40

no new coc, no new vim, nadda

dharrigan19:08:45

just clojure-lsp updated

dharrigan19:08:16

And, going back to the release of 2 days ago, of clojure-lsp, no issues.

ericdallo19:08:56

that's weird, we need the json logs to debug it

ericdallo19:08:28

because clojure-lsp is sending/receiving the same data, the integration-tests prove that

ericdallo19:08:56

so nothing has changed on the Content-Length of the responses

dharrigan19:08:50

Something is up with codelens

dharrigan19:08:00

the request is being sent, but no reply is coming back

dharrigan19:08:14

dm'ed you a link

ericdallo19:08:51

I can't see any issues with that json log :thinking_face:

ericdallo19:08:09

we need to confirm this doesn't happen with other users

ericdallo19:08:18

maybe @UEENNMX0T can test latest release with vim?

dharrigan19:08:19

Well, all I can do is report what I see. The release of 2 days ago works. Todays release does not.

dharrigan19:08:29

I pushed out a release to Arch, now I'm going to have to revert that

ericdallo19:08:58

Yeah, sorry I'm trying to confirm/understand the issue

Noah Bogart19:08:05

i use vim 8.2, no code lens so i can’t test that part, i’m sorry

👍 3
Noah Bogart19:08:22

i upgraded to the same version @U11EL3P9U and don’t see any errors in my coc.nvim logs

ericdallo19:08:41

thanks, I'm double checking the changes

dharrigan19:08:49

Let me turn off codelens (and I'm on neovim 0.5.0)

👍 3
dharrigan19:08:44

codelens enabled == a page full of errors

dharrigan19:08:51

codelens disabled == all is fine

ericdallo19:08:16

I think I found the issue 😄

ericdallo19:08:12

one missing println facepalm This doesn't fail on emacs because lsp-mode safelly handle the server response while neovim seems to doesn't like

ericdallo19:08:31

will do a release fix + clj-kondo bump which I missed

ericdallo19:08:25

@U11EL3P9U Would you mind testing the clojure-lsp master? you can generate the binary with just make

dharrigan19:08:25

heating up my CPU right now 😉

🔥 3
dharrigan19:08:11

Looking good!

dharrigan19:08:35

❯ clojure-lsp --version
clojure-lsp 2021.08.05-18.25.54
clj-kondo 2021.08.04-SNAPSHOT

dharrigan19:08:46

codeLens enabled, no errors being spat out on vim

ericdallo19:08:06

nice, I'll release a fix, sorry for the problems

dharrigan19:08:03

Thank you for solving it quickly. 🙂

dharrigan19:08:20

looking good.