Fork me on GitHub
#lsp
<
2021-12-13
>
Marc O'Morain15:12:47

I see this in Calva when I try to run with a the latest LSP: I can’t for the life of me read that little icon 😄 Is it an error?

Marc O'Morain16:12:09

I’m attempting to call 'clojure/textDocument/testTree' and getting “Unsupported Request Method”, so I’m trying to debug what I’m doing wrong. Assume it’s something on my end.

ericdallo16:12:11

Never saw that icon :man-shrugging:

ericdallo16:12:23

@U0K592YDP is not a method, but a server notification

ericdallo16:12:45

you won't call it manually, server will return that Everytime a new filé is open/changed

ericdallo16:12:06

So you can cache/save data to show in a future tree open request from user or something else

Marc O'Morain16:12:16

aha, so I listen for those events :thumbsup:

ericdallo16:12:23

BTW @U0K592YDP, are you using local clojure-lsp? This feature is available only on master until next release

ericdallo16:12:36

There is a calva option to set a local clojure-lsp path

Marc O'Morain17:12:17

What’s the easiest way to install master? checkout and build?

ericdallo17:12:44

checkout and run make

Marc O'Morain17:12:54

Loving the docs 👏

🎉 1
Marc O'Morain17:12:19

I’m getting close > Exception in thread “main” java.lang.UnsupportedClassVersionError: clojure_lsp/feature/test_tree/TestTreeParams has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 60.0

ericdallo17:12:38

you compiled clojure-lsp with javac 17 or something and is running with java 15 or older

borkdude17:12:20

it's best if you use graalvm for both the uberjar and the native aot

ericdallo17:12:32

he is using for development only @U04V15CAJ

borkdude17:12:37

the clj-kondo compile script forces this by setting the path and java_home to GRAALVM_HOME

borkdude17:12:09

yes, regardless

borkdude17:12:19

and also the next line

Marc O'Morain18:12:04

@UKFSJSM38 do you have a macOS binary built?

ericdallo18:12:43

not really, I use Linux :/

ericdallo18:12:27

IMO you can use the JVM one, as it is for development only, it's the one I use when developing, but if you wanna use the graalvm you can follow: https://clojure-lsp.io/building/#graalvm

pez19:12:53

That’s an esc icon. It has nothing to do with lsp version, I think. I don’t know how, but probably I have fat-fingered in an escape character in the printout.

😆 3
pez20:12:37

Indeed. It seems the VS Code team has focused on helping with highlighting funny characters like that lately.

Marc O'Morain11:12:41

I don’t have the right dependencies on my machine, so I wasn’t able to get this to build.

Marc O'Morain11:12:53

But then I remembered that I know a little about CI

Marc O'Morain11:12:18

https://github.com/clojure-lsp/clojure-lsp/pull/669 ^ This makes CI create binaries on macOS and Linux 🎉

ericdallo12:12:55

@U0K592YDP it was on purpose to not generate multiple binaries on CI :/ It's too heavy to keep building with GraalVM every push to GitHub, that's why we do that only for Linux, but test all windows Linux and macos during the releas

ericdallo12:12:41

We test Linux just to make sure there is no bug bug related to reflection or something

ericdallo12:12:57

And leave the corner cases to fail during release which usually doesn't happen

borkdude12:12:23

You should be using CircleCI for this, it's much faster, especially when they give you the upgraded plan ;)

borkdude12:12:53

(but yes, this makes sense, limiting to linux on push)

ericdallo12:12:54

Yeah, I'm not a big fan of circle ci, and this was never a issue to clojure-lsp repo I think, the CI usually works ready good and the whole automatic release as well

borkdude12:12:59

I'm the reverse, at least when it comes to performance, I find CircleCI way better

borkdude12:12:22

and being able to ssh into containers 💕

ericdallo12:12:06

Yes, that's handy indeed

Marc O'Morain12:12:26

How do you build the macOS binaries when you do a release?

Marc O'Morain13:12:22

(and why not publish a new release on every master build?)

Marc O'Morain13:12:22

aha, thanks. So if I need a binary I can trigger that workflow :thumbsup:

borkdude13:12:26

releasing a binary on every master build is what I do with clj-kondo and babashka, but I don't publish them, I just overwrite in the snapshot release. Note that this will yield a lot of garbage releases if you would do this as official releases

☝️ 1
borkdude13:12:30

you can just test with the uberjar in development

Marc O'Morain13:12:55

I tried the uberjar, but I ended up in the same situation where my local JVM was not the version that had compiled the class files.

borkdude13:12:26

compile using java 8

borkdude13:12:36

I mean, create the uberjar yourself, that isn't too hard

borkdude13:12:53

actually I think lsp should also compile using java 8 for their uberjar

ericdallo13:12:30

we compile with java8 at CI to release

ericdallo13:12:55

@U0K592YDP’s issue sounds like, he's compiling with java X but running with java Z

Marc O'Morain13:12:35

marc@blaster ~/dev/clojure-lsp $ make clean
rm -rf classes clojure-lsp clojure-lsp.jar docs/README.md
marc@blaster ~/dev/clojure-lsp $ clojure -X:prod-jar
Downloading: com/google/code/gson/gson/maven-metadata.xml from central
Synchronizing pom.xml
Skipping paths: classes resources
Compiling clojure-lsp.main ...
Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:440).
clojure_lsp.feature.test_tree.TestTreeParams

Full report at:
/var/folders/q0/2g2lcf6j79df6vxqm0cg_0zm0000gn/T/clojure-1120159636839573834.edn

Compilation failed!
Execution error (ExceptionInfo) at hf.depstar.uberjar/build-jar-as-exec (uberjar.clj:554).
AOT compilation failed

Full report at:
/var/folders/q0/2g2lcf6j79df6vxqm0cg_0zm0000gn/T/clojure-6206336463939364273.edn
marc@blaster ~/dev/clojure-lsp $

Marc O'Morain13:12:50

marc@blaster ~/dev/clojure-lsp $ cat /var/folders/q0/2g2lcf6j79df6vxqm0cg_0zm0000gn/T/clojure-1120159636839573834.edn
{:clojure.main/message
 "Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:440).\nclojure_lsp.feature.test_tree.TestTreeParams\n",
 :clojure.main/triage
 {:clojure.error/class java.lang.ClassNotFoundException,
  :clojure.error/line 440,
  :clojure.error/cause "clojure_lsp.feature.test_tree.TestTreeParams",
  :clojure.error/symbol java.net.URLClassLoader/findClass,
  :clojure.error/source "URLClassLoader.java",
  :clojure.error/phase :execution},
 :clojure.main/trace

Marc O'Morain13:12:45

anyway, I was able to use GH Actions to get the binary that I need to continue loading a Test Tree

🎉 2
ericdallo13:12:39

@U0K592YDP about the first stacktrace, you ran make clean and run a clojure alias manually, but you didn't compile the classes clojure-lsp require, you can just run make and it should generate everything correctly

Marc O'Morain13:12:27

2021-12-16T13:36:58.170Z INFO [clojure-lsp.producer:?] - :testTree 0.00 secs I can see this in the LSP logs 🎉

Marc O'Morain13:12:48

Time to find out how to get the client to subscribe the test tree events now…

ericdallo13:12:57

@U0K592YDP search for clientCapabilities

ericdallo13:12:24

you need to send {"experimental": {"testTree": true}}

Marc O'Morain15:12:51

FYI: I’m getting top level keys uri: string and tree: TestTreeNode

Marc O'Morain15:12:59

(The docs might need to be updated)

ericdallo15:12:12

ops, I'll fix it

Marc O'Morain15:12:18

I have it all wired up, now, and I now have to do a little dance to make VSCode and Clojure LSP work together. VSCode fires a callback when it wants to load tests, and the LSP is firing a callback when it discovers a test.

ericdallo15:12:41

yes, makes sense

Marc O'Morain15:12:24

It feels like I have two male USB connectors, and I can’t plug them together. So I need to create some sort of USB hub using a promise or an iterator or something 🙂

ericdallo15:12:57

good comparison 😂

borkdude15:12:36

You probably need to create an empty promise first

borkdude15:12:52

that was a joke

Marc O'Morain15:12:02

In doing some research I found the with-test macro, which is shown here. Clojure LSP is not finding those tests.

ericdallo15:12:57

Yeah, it will work only with the default ones for now

ericdallo15:12:31

I talked with @U04V15CAJ about adding that to kondo, but it probably makes more sense to have that logic on lsp

Marc O'Morain15:12:34

I have never seen with-test in the wild, so not really a problem 🙂

ericdallo15:12:57

Yeah, but there are other test frameworks like midje and state-flow

ericdallo15:12:04

Which won't work for now

ericdallo15:12:24

But I intend to add support in other release

borkdude15:12:08

gotta start somewhere

Marc O'Morain15:12:00

Is there a way to trigger the LSP to perform the action that will result in a TestTree item being sent back to the client?

Marc O'Morain15:12:38

Editing a file causes the scan for Test items to take place. VSCode suggests doing the scan when the user opens a file.

ericdallo15:12:03

But we do send the notification when the file is open-end and if any changes

borkdude21:12:01

Tralala, releasing clj-kondo... o wait: https://status.circleci.com/

😂 1
borkdude21:12:13

Now it's working again :)