calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
bringe 2021-03-13T01:30:04.284Z

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.

👍 3
2
🎉 2
bringe 2021-03-13T01:32:48.286300Z

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.

pez 2021-03-13T09:44:41.288200Z

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.

pez 2021-03-13T10:19:31.293900Z

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

pez 2021-03-13T10:47:31.294100Z

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.

pez 2021-03-13T10:56:15.294300Z

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

pez 2021-03-13T10:57:53.294800Z

Demo

ericdallo 2021-03-13T13:57:48.295200Z

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

pez 2021-03-13T14:07:49.295400Z

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

ericdallo 2021-03-13T14:14:15.295600Z

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

ericdallo 2021-03-13T14:14:24.295800Z

maybe you need to enable some debug flag

pez 2021-03-13T14:24:21.296Z

I know I have had that log before. 😃

leoiacovini 2021-03-13T20:10:05.296900Z

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

ericdallo 2021-03-13T20:24:34.297200Z

Check clojure-lsp log file

leoiacovini 2021-03-13T20:36:51.297400Z

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

ericdallo 2021-03-13T20:45:27.297700Z

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

leoiacovini 2021-03-13T20:51:21.297900Z

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

ericdallo 2021-03-13T21:23:01.298100Z

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

ericdallo 2021-03-13T21:23:34.298300Z

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

bringe 2021-03-13T21:26:13.298500Z

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

bringe 2021-03-13T21:26:55.298700Z

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

bringe 2021-03-13T21:27:08.298900Z

To isolate issues

pez 2021-03-13T21:41:26.299100Z

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.

leoiacovini 2021-03-13T21:44:57.299300Z

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

ericdallo 2021-03-13T21:48:33.299500Z

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

leoiacovini 2021-03-13T21:49:54.299700Z

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

leoiacovini 2021-03-13T21:53:21.299900Z

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

bringe 2021-03-13T22:00:58.300100Z

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

bringe 2021-03-13T22:01:30.300400Z

@leoiacovini Nice investigation :thinking_face:

pez 2021-03-13T22:01:59.300600Z

I think it should log by default.

bringe 2021-03-13T22:02:01.300800Z

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

ericdallo 2021-03-13T22:03:37.301Z

Nice investigation indeed!

bringe 2021-03-13T22:04:56.301200Z

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.

pez 2021-03-13T22:10:05.301600Z

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

👍 1
bringe 2021-03-13T22:11:19.301900Z

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

pez 2021-03-13T22:16:02.302100Z

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.

ericdallo 2021-03-13T22:17:36.302300Z

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

bringe 2021-03-13T22:17:38.302500Z

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

bringe 2021-03-13T22:18:03.302700Z

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

bringe 2021-03-13T22:18:25.302900Z

Oh I see request failed too. hmm

ericdallo 2021-03-13T22:20:01.303100Z

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?

pez 2021-03-13T22:20:56.303900Z

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

ericdallo 2021-03-13T22:21:32.304800Z

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

bringe 2021-03-13T22:22:04.305500Z

Before we go down the rabbit hole further, @pez 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.

pez 2021-03-13T22:22:21.306100Z

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

ericdallo 2021-03-13T22:22:56.306800Z

@brandon.ringe what clojure-lsp version Calva master is using?

pez 2021-03-13T22:23:05.307Z

Yes, the PR seems fine otherwise.

👍 1
pez 2021-03-13T22:23:31.307400Z

03.01.19

👍 1
ericdallo 2021-03-13T22:24:39.307800Z

@pez you mean 2021.02.10-03.01.19 ?

pez 2021-03-13T22:25:03.308100Z

Yes

ericdallo 2021-03-13T22:26:07.309400Z

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

pez 2021-03-13T22:26:15.309800Z

@brandon.ringe maybe the problems that @leoiacovini is experiencing are not due to clojure-lsp version?

bringe 2021-03-13T22:29:30.310Z

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.

👍 1
bringe 2021-03-13T22:30:37.310200Z

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

ericdallo 2021-03-13T22:30:51.310500Z

Sure!

bringe 2021-03-13T01:33:16.287Z

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

bringe 2021-03-13T01:34:24.287600Z

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

3
3
❤️ 3
bringe 2021-03-13T22:34:09.311900Z

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

bringe 2021-03-13T22:44:41.312800Z

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.

pez 2021-03-13T23:08:00.313900Z

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

👍 1