lsp

FiVo 2024-11-05T12:20:26.718229Z

Hey hey, I am working on a project where some code actions do not work for me but for other people (both using lsp through emacs). An example being: suggesting import statements for Java classes. Is there some way how to best debug this?

ericdallo 2024-11-05T12:21:26.236759Z

probably only java classes import code actions are the ones affected, they rely on the https://clojure-lsp.io/settings/#java-support

ericdallo 2024-11-05T12:22:13.560859Z

take a look at that doc, if you think your JDK is correct, try removing the global cache and restarting clojure-lsp: rm -rf ~/.cache/clojure-lsp

FiVo 2024-11-05T12:29:11.150069Z

Didn't help

ericdallo 2024-11-05T12:30:07.480029Z

ok, remove the local cache as well .lsp/.cache of the project, restart clojure-lsp, and check the server logs if jdk is being analyzed.

FiVo 2024-11-05T12:30:23.101099Z

Also removed the local cache

FiVo 2024-11-05T12:31:21.069559Z

Is that *lsp-log* I should be looking at?

ericdallo 2024-11-05T12:31:40.674779Z

no, https://clojure-lsp.io/troubleshooting/#server-log

FiVo 2024-11-05T12:35:48.328029Z

Ok found it

2024-11-05T12:25:41.763Z  WARN [clojure-lsp.feature.java-interop:292] - [Java] Skipping download JDK source, setting `:java :download-jdk-source?` is disabled.
2024-11-05T12:25:41.763Z  WARN [clojure-lsp.feature.java-interop:303] - [Java] JDK source not found, skipping java analysis.

ericdallo 2024-11-05T12:39:21.772089Z

yep, so you have options to set the jdk location or understand why it's not finding it automatically

FiVo 2024-11-05T12:40:14.299989Z

If it doesn't find the JDK it turns off all suggestions for java classes?

ericdallo 2024-11-05T12:40:27.488389Z

no, only jdk classes

ericdallo 2024-11-05T12:40:35.184839Z

what java class you are trying to import?

FiVo 2024-11-05T12:40:59.643599Z

RootAllocator from [org.apache.arrow.memory RootAllocator]

FiVo 2024-11-05T12:41:40.973149Z

That works for the colleague but not for me.

ericdallo 2024-11-05T12:41:48.064229Z

hum, if it's on the classpath clojure-lsp should be aware of it sending clj-kondo to analyze that

ericdallo 2024-11-05T12:42:24.826619Z

could you try adding that dep to a sample project like https://github.com/ericdallo/clojure-sample and check if it works there?

FiVo 2024-11-05T12:43:07.660579Z

Will do. 🙏 for your time

👍 1
ericdallo 2024-11-05T12:59:03.345279Z

let me try

ericdallo 2024-11-05T13:00:47.870739Z

seems to be working for me 🤔

FiVo 2024-11-05T14:18:06.894389Z

I only get Create private function ...

ericdallo 2024-11-05T14:18:58.700389Z

are you sure you are using latest clojure-lsp version?

FiVo 2024-11-05T14:20:07.948419Z

:server-version "2024.08.05-18.16.00"

FiVo 2024-11-05T14:26:05.964479Z

Ok, so after latest changes UUID works but RootAllocator still doesn't

FiVo 2024-11-05T14:26:51.608729Z

Maybe it's some weird classpath issue ...

ericdallo 2024-11-05T14:39:02.999409Z

UUID is from jdk, so not exactly the same way it's analyzed