Fork me on GitHub
#calva
<
2021-03-13
>
bringe01:03:04

Hello Calva friends. I've been working on making Calva use the graalvm-compiled native binaries for clojure-lsp. I've tested this vsix on Manjaro Linux and Windows 10 Pro. If anyone could give it a bit more testing that would be great. https://12178-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.180-use-clojure-lsp-native-binaries-ee3e554f.vsix With these changes, the appropriate clojure-lsp binary for your OS will now be downloaded by Calva then started. Startup time is much faster, though initial startup with a given project still takes a bit (faster than before though). CPU usage and memory usage should be lower as well.

👍 11
🎉 7
clojure-lsp 7
bringe01:03:48

The PR is here: https://github.com/BetterThanTomorrow/calva/pull/1043. Please on the PR if you've tested and for what OS. Quick test: 1. Install the vsix and reload vscode 2. See the "Downloading clojure-lsp" then "Initializing..." messages in the status bar 3. Once clojure-lsp has started, try operations like Go to Definition, verify that linting is working, try a Calva Refactor command or two, etc.

pez09:03:41

I’m testing this from the branch and notice a significant time lag when navigating to code in my project. Never seen it before, but that could be because I am always jacked-in and nREPL is blistering fast. Will try with dev as well now.

pez10:03:31

It's not like this in the dev branch. It's in my work project. A cljs mobile app. Not huge, but not tiny either. Navigating to a project file when lsp is finished initializing takes several seconds (maybe five) on this branch, but is instant on dev. Navigating to the same file again is instant on both branches. Which might mean the lag is happening in clojure-lsp? @ericdallo

pez10:03:31

So, it’s only with project sources. Clojure core and libraries are instant. Also documentation hover is quick. Definition hovers are also quick, interestingly enough. And even after having looked at that the navigation is slow. That indicates that finding and reading the file is still quick, and something is going on between that and opening the file in vscode.

pez10:03:15

Yes. there it is. Actually not about looking it up a second time, but about opening the editor.

ericdallo13:03:48

Never saw this lag @U0ETXRFEW do you have a repro? Also we can check the clojure-lsp request/response to check the time between them

pez14:03:49

I can’t reproduce it in a some test project at least. Where do I find the logs?

ericdallo14:03:15

@U9A1RLFNV may know better but I think for Calva there is a log output called clojure-lsp or something

ericdallo14:03:24

maybe you need to enable some debug flag

pez14:03:21

I know I have had that log before. 😃

leoiacovini20:03:05

Trying here on MacOS, and the “Go/Show to Definition/Parameters” actions stopped working, I always get the no definition found for 
. error “Find references” in the other hand is working fine, confusedparrot A Clojure (lein) project medium size

ericdallo20:03:34

Check clojure-lsp log file

leoiacovini20:03:51

Where Can I find it? I was looking into:

/var/folders/9v/7gk7ycxn2l544kxbznw979kr0000gp/T/clojure-lsp.10969030960409803808.out
and on the VSCode console with "clojure.trace.server": "verbose" But I am not sure what I am looking for

ericdallo20:03:27

You can pass a :log-path to clojure-lsp config to always log to the same file

leoiacovini20:03:21

Seems to be the file I am looking at, but I found no errors log, should I try to look for something specific?

ericdallo21:03:01

So no errors, you should check the same log I told PEZ to find, the request/response log between client<->server

ericdallo21:03:34

I know you can get it via Calva, I just don't remember know, @U9A1RLFNV will know how to access it

bringe21:03:13

The request/response log is in an Output channel called Clojure Language Client

bringe21:03:55

Thanks for all this testing, everyone. Indeed, some things could be a result of updating clojure-lsp. Maybe I should have just stuck with the same version from the currently released Calva for this testing...

bringe21:03:08

To isolate issues

pez21:03:26

I don’t have that output channel anymore. Not with dev either. Sticking to the same version as with dev sounds like a good idea.

leoiacovini21:03:57

I tried to replace the clojure-lsp binary inside the extension to the 2021.02.10-03.01.19 version (the one that was being used before), and it still is failing to navigate About the output channel I was able to get it’s logs when setting "clojure.trace.server": "verbose" on VsCode settings

ericdallo21:03:33

@U95713QV7 try to remove the .lsp/sqlite.db file and restart the server

leoiacovini21:03:54

Already did, no deal. Reverting back to the master version of Calva, makes things work again I am trying to bisect the problem, but it seems more related to the PR itself than to clojure-lsp. I am going to try to bump just the lsp version with Calva master and checks if something breaks

leoiacovini21:03:21

Yeah, just updating the JAR version of clojure-lsp still works fine

bringe22:03:58

I added a section to the clojure-lsp doc about enabling and viewing the logs: https://calva.io/clojure-lsp/#troubleshooting

bringe22:03:30

@U95713QV7 Nice investigation :thinking_face:

pez22:03:59

I think it should log by default.

bringe22:03:01

Would you mind putting your findings on the PR, so I can track them better?

ericdallo22:03:37

Nice investigation indeed!

bringe22:03:56

I think I was following the path of the other trace servers by not enabling the logging by default. The html, json, and typescript server tracing is off by default. Maybe in our case it does make sense to enable it by default, though.

pez22:03:05

Anyway, the lag with opening files that I experience is not there if I use 2021.02.10-03.01.19 in config.ts

👍 3
bringe22:03:19

Good to know it's not related to a code change in Calva

pez22:03:02

Yes, now back to latest clojure-lsp and the issue is back. Here’s a log from a navigation with the lag:

[Trace - 11:14:00 PM] Sending request 'textDocument/definition - (21)'.
[Trace - 11:14:00 PM] Received response 'textDocument/definition - (21)' in 10ms.
[Trace - 11:14:00 PM] Sending notification 'textDocument/didOpen'.
[Trace - 11:14:00 PM] Sending notification 'textDocument/didClose'.
[Trace - 11:14:01 PM] Sending request 'textDocument/definition - (22)'.
[Trace - 11:14:01 PM] Sending request 'textDocument/codeAction - (23)'.
[Trace - 11:14:03 PM] Received response 'textDocument/definition - (22)' in 2668ms.
[Trace - 11:14:03 PM] Received response 'textDocument/codeAction - (23)' in 2608ms.
[Trace - 11:14:03 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 11:14:03 PM] Sending notification 'textDocument/didOpen'.
[Trace - 11:14:03 PM] Sending request 'textDocument/codeAction - (24)'.
[Trace - 11:14:03 PM] Sending request 'textDocument/documentSymbol - (25)'.
[Trace - 11:14:03 PM] Sending notification '$/cancelRequest'.
[Trace - 11:14:03 PM] Sending request 'textDocument/documentSymbol - (26)'.
[Trace - 11:14:04 PM] Sending request 'textDocument/codeAction - (27)'.
[Trace - 11:14:04 PM] Sending notification '$/cancelRequest'.
[Trace - 11:14:04 PM] Sending request 'textDocument/codeAction - (28)'.
[Trace - 11:14:04 PM] Sending notification '$/cancelRequest'.
[Trace - 11:14:06 PM] Received response 'textDocument/documentSymbol - (25)' in 2845ms. Request failed: The request (id: 25, method: 'textDocument/documentSymbol') has been cancelled (-32800).
[Trace - 11:14:06 PM] Received response 'textDocument/codeAction - (24)' in 2856ms. Request failed: The request (id: 24, method: 'textDocument/codeAction') has been cancelled (-32800).
[Trace - 11:14:06 PM] Received response 'textDocument/codeAction - (27)' in 2626ms. Request failed: The request (id: 27, method: 'textDocument/codeAction') has been cancelled (-32800).
[Trace - 11:14:06 PM] Received response 'textDocument/documentSymbol - (26)' in 2848ms.
[Trace - 11:14:06 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 11:14:06 PM] Received response 'textDocument/codeAction - (28)' in 2514ms.
[Trace - 11:14:07 PM] Sending request 'textDocument/codeAction - (29)'.
[Trace - 11:14:07 PM] Received response 'textDocument/codeAction - (29)' in 147ms.

ericdallo22:03:36

I think we would need the request and response params from the textDocument/definition that is not working

bringe22:03:38

Oh, wow. @ericdallo Received response 'textDocument/documentSymbol - (25)' in 2845ms - those documentSymbol and codeAction responses are taking a really long time

bringe22:03:03

Yeah, would be helpful. Can set logging to verbose for that.

bringe22:03:25

Oh I see request failed too. hmm

ericdallo22:03:01

still the documentSymbol should not block a textDocument/definition on client side, but yeah, it's weird to take that time, maybe you have a huge buffer/file content?

pez22:03:56

The files are not huge, if the question was for me.

ericdallo22:03:32

I see, could you provide a minimal repro with that bug? So I can test it with emacs client and understand the issue

bringe22:03:04

Before we go down the rabbit hole further, @U0ETXRFEW do you think I should just keep the clojure-lsp version set to one that works fine for this PR? We can still investigate this, but maybe separately.

pez22:03:21

Updating macos now (for completely other reasons) so can't test anything right now.

ericdallo22:03:56

@U9A1RLFNV what clojure-lsp version Calva master is using?

pez22:03:05

Yes, the PR seems fine otherwise.

👍 3
pez22:03:31

03.01.19

👍 3
ericdallo22:03:39

@U0ETXRFEW you mean 2021.02.10-03.01.19 ?

ericdallo22:03:07

I see, there was some fixes and features on some releases after that, @U9A1RLFNV maybe we should try to investigate those issues to bump Calva to latest clojure-lsp

pez22:03:15

@U9A1RLFNV maybe the problems that @U95713QV7 is experiencing are not due to clojure-lsp version?

bringe22:03:30

Yeah, it seems so. In any case I just set the version back to 2021.02.10-03.01.19 in the PR, so at least we can isolate issues better.

👍 3
bringe22:03:37

@ericdallo We'll definitely want to work out those issues with later versions, but after the PR is merged would be better, I think.

bringe01:03:16

And that's all, really. Just want to make sure it downloads and starts properly on other systems

bringe01:03:24

And of course, thanks to @ericdallo for his work on the graalvm compilation for clojure-lsp.

❀ 11
calva 10
clojure-lsp 10
bringe22:03:09

Ok, here's a new vsix in which the clojure-lsp version is set back to the one currently in use, so we can isolate any issues to being related to the PR, and not changes to clojure-lsp, aside from switching from a jar file to a binary file. https://12178-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.180-use-clojure-lsp-native-binaries-ee3e554f.vsix

bringe22:03:41

Now with this VSIX I'm having issues with navigation and hovers not working... Back to the drawing board! Just to clarify, it's an issue with cljs/js interop that I thought I worked around, but it's popped up again.

pez23:03:00

I can't test right now. Will do first thing tomorrow.

👍 3