Fork me on GitHub
#lsp
<
2021-12-22
>
dharrigan05:12:15

I notice, than when starting clojure-lsp, I get this in my /tmp/clojure-lsp* log:

dharrigan05:12:47

...
...
                                                               ...                               
                                         datalevin.binding.java/fn                 java.clj:  447
                                           org.lmdbjava.Env.create                 Env.java:   92
java.lang.NoClassDefFoundError: Could not initialize class org.lmdbjava.ByteBufferProxy

dharrigan05:12:31

That lmdb is part of datalevin, which clojure-lsp switched to. Is the error a redherring?

ericdallo12:12:05

Not aware of that

ericdallo12:12:19

maybe its not being able to create the database?

dharrigan13:12:58

<shrug> It's in my home folder, so totally writeable. I'll ping you via DM the full stack:

ericdallo13:12:00

Are you using native or JVM clojure-lsp?

dharrigan13:12:39

make debug-bin, put then in path.

dharrigan14:12:05

Let me see if it happens with native...

dharrigan14:12:38

Yes, only on JVM version

ericdallo14:12:36

what java version are you running?

dharrigan14:12:58

openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment Temurin-17.0.1+12 (build 17.0.1+12)
OpenJDK 64-Bit Server VM Temurin-17.0.1+12 (build 17.0.1+12, mixed mode, sharing)

ericdallo14:12:54

I suspect it's related with not working on jvm 17

ericdallo14:12:08

I think @U0A74MRCJ knows more about that

ericdallo14:12:25

I remeber there is a issue that the reflection warning on ByteBufferProxy that happens on jvm >8, would make it not work on jvm 17

ericdallo14:12:42

there is a issue opened about that on lmdbjava somewhere

dharrigan14:12:53

I'l switch to the static version. I was experimenting with some clojure-lsp and compiling

👍 1
dharrigan14:12:31

I have another question...

Huahai21:12:14

--add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/http://sun.nio.ch=ALL-UNNAMED

Huahai21:12:40

This jvm options should be sufficient

ericdallo21:12:26

the issue is that we should add those flags only for the >JVM9 since jvm8 doesn't support those flags

ericdallo21:12:31

but makes sense

ericdallo14:12:38

I fixed this issue on master @U11EL3P9U

dharrigan14:12:01

The recent clojure-lsp fixed support for absolute paths in deps.edn (#672).

dharrigan14:12:50

I'm wondering 'tho (and doesn't appear to work yet), if I gotoDefinition, for a var in a namespace that is in that :local/root, I'm getting back:

dharrigan14:12:59

[Trace - 14:38:13] Received response 'textDocument/definition - (13)' in 9ms.
No result returned.

dharrigan14:12:06

Is that supported yet?

ericdallo14:12:51

it should work

ericdallo14:12:05

we need to debug the source-paths found by clojure-lsp

ericdallo14:12:10

from its log

dharrigan14:12:42

It's only finding two ["src" "test"]

ericdallo14:12:07

that's the issue so

ericdallo14:12:13

what's your deps.edn?

dharrigan14:12:27

Let me get together an example project

ericdallo14:12:28

where is the local/root in root or in a alias?

dharrigan16:12:12

Thanks @ericdallo. The problem, as identified by eric was that I had $HOME/.lsp/config.edn with a :source-paths entry. That prevented it from working.

dharrigan16:12:38

Removing :source-paths ["src" "test"] from my .lsp/config.edn got it working great!

👍 1
dharrigan16:12:57

I've made anote to do a PR for troubleshooting, will do that in a while.

dharrigan16:12:26

(it's great now that we have full slack history, so I put that there for anyone else coming after me)

🚀 1
yes 1
dharrigan17:12:58

feedback welcome 😉

Noah Bogart16:12:57

i updated a bunch of namespace declarations one after the other (in 11 files, to be exact), and then ran “organize imports” on the last one, and my editor (neovim + coc + coc-clojure) ground to a halt. the output file showed:

Noah Bogart16:12:36

cond_plus is a library that includes clj-kondo config plus a hook, and I include the file in my .clj-kondo folder:

$ exa -T .clj-kondo/cond_plus
.clj-kondo/cond_plus
└── cond_plus
   ├── config.edn
   └── hooks
      └── cond_plus_hook.clj

Noah Bogart16:12:42

it kept retrying up to 40 times, and then later restarted and retried up to 22 times, and then restarted and retried up to 40 times again, lol

Noah Bogart16:12:03

i quit neovim because it had completely frozen and ran clojure-lsp clean-ns -n game.cards.agendas directly instead of calling the organize-imports command from within neovim, and the log showed:

2021-12-22T16:45:17.591Z  INFO [clojure-lsp.db:?] - Reading analysis cache from Datalevin db took 5.20 secs
2021-12-22T16:45:17.592Z  INFO [clojure-lsp.crawler:140] - Using cached classpath for project root /Users/noah/Personal/netrunner
2021-12-22T16:45:17.593Z  INFO [clojure-lsp.crawler:227] - Analyzing source paths for project root /Users/noah/Personal/netrunner
2021-12-22T16:45:17.594Z  INFO [clojure-lsp.feature.clojuredocs:40] - Refreshing clojuredocs cache...
2021-12-22T16:45:19.651Z  INFO [clojure-lsp.feature.clojuredocs:?] - Refreshing clojuredocs cache took 2.06 secs.
2021-12-22T16:45:37.112Z  INFO [clojure-lsp.kondo:76] - Starting to lint whole project files...
2021-12-22T16:47:36.474Z  INFO [clojure-lsp.kondo:?] - Linting whole project files took 119.37 secs
2021-12-22T16:47:36.491Z  WARN [clojure-lsp.kondo:?] - Non-fatal error from clj-kondo: [clj-kondo] Auto-loading config path: cond_plus/cond_plus
[clj-kondo] Already seen the file /Users/noah/Personal/netrunner/src/cljs/nr before, skipping
...
(bunch of "Already seen the file" messages)
...
2021-12-22T16:47:36.492Z  INFO [clojure-lsp.crawler:?] - Project only paths analyzed, took 138.90 secs
2021-12-22T16:47:39.318Z  WARN [clojure-lsp.kondo:?] - Non-fatal error from clj-kondo: [clj-kondo] Auto-loading config path: cond_plus/cond_plus

Noah Bogart17:12:24

in lsp’s defense, i replaced a single require line [game.core :refer :all] (where game.core used potemkin’s import-vars to re-export 600+ vars) to explicitly listing all 600+ requires, in all 11 files lol

Noah Bogart17:12:19

this is a lot of information and I’m not sure how relevant any of it is, so my apologies @ericdallo for the spam, but it seemed pertinent to share at least. i can delete all of this and move it to a github issue if that would be more helpful

ericdallo17:12:23

I think this is related with the latest release where I changed the default of :linters :custom-lint-async? from false to true

ericdallo17:12:38

that should improve performance but it seems there are issues with that still

ericdallo17:12:44

could you test changing it to false ?

👍 1
Noah Bogart19:12:39

looks like the crashing/freezing issue is coc-nvim related, but lsp does grind to a halt regardless of the :custom-lint-async setting if i replace [game.core :refer :all] with the above snippet in all 11 files really quickly lol

Noah Bogart19:12:20

maybe i should just slow down and take it one file at a time lol

Noah Bogart19:12:03

yeah, if i paste the above and call the “organize imports” command and wait for it to finish before moving to the next file, lsp takes a bit of time but doesn’t break anything

Noah Bogart19:12:15

thanks for the help and sorry to fill the chat with my nonsense

ericdallo19:12:58

hahah yeah, maybe that's too much for the lsp, some concurrency issue we should improve though