Fork me on GitHub
#lsp
<
2024-03-03
>
ericdallo17:03:12

Any macos user willing to test a clojure-lsp-intellij plugin change? I made some big refactors that may fix 3 major bugs that happens on macos only :)

sheluchin20:03:02

I'm trying to get the refactoring mappings working in nvim using fennel for config. I don't understand why the LSP log is telling me that the form cannot be found at the given position. Any ideas?

ericdallo20:03:08

maybe it's a by one row/col issue?

sheluchin20:03:01

You mean off-by-one? I tried shifting the hardcoded row/col numbers: > Could not find a form at this location. row 0 col 0 file /tmp/lspdebug/foo.cl

ericdallo20:03:21

so it doesn't seem to be the issue

sheluchin20:03:09

When I use the actions menu and select TFA, it does work correctly. Is there a way to see exactly what arguments its getting there?

ericdallo20:03:19

you can clone clojure-lsp and run bb debug-cli and it should generate a local clojure-lsp binary so you could test

ericdallo20:03:32

yes, there is

ericdallo20:03:34

you could debug client <-> https://clojure-lsp.io/troubleshooting/#client-server-log, BTW we need to add how to do that for vim in that docs, I have no idea

sheluchin20:03:57

Hmm, bb debug-cli failed:

Location: /tmp/clojure-lsp/scripts/make.clj:54:7

----- Context ------------------------------------------------------------------
50:       (fs/delete-tree f))))
51: 
52: (defn ^:private clj! [dir cmd]
53:   (-> (deps/clojure cmd {:dir dir, :inherit true})
54:       (p/check)))
          ^--- 
55: 
56: (defn ^:private build [dir tool] (clj! dir ["-T:build" tool]))
57: 
58: (defn ^:private unit-test [dir]
59:   (println :running-unit-tests... dir)

----- Stack trace --------------------------------------------------------------
babashka.process/check                    - <built-in>
make/clj!                                 - /tmp/clojure-lsp/scripts/make.clj:54:7
make/clj!                                 - /tmp/clojure-lsp/scripts/make.clj:52:1
make/build                                - /tmp/clojure-lsp/scripts/make.clj:56:34
make/build                                - /tmp/clojure-lsp/scripts/make.clj:56:1
make                                      - /tmp/clojure-lsp/scripts/make.clj:101:3
clojure.core/apply                        - <built-in>
user-92dcb728-0766-4497-84dc-39c53d8d7e9b - <expr>:28:1
Is there some intermediate step that should be done between cloning and running that command?

ericdallo20:03:37

hum, not really, do you have clojure installed? is there anything more in that stack before that?

sheluchin20:03:40

$ clojure --version
Clojure CLI version 1.11.1.1435
Yes, there's quite a bit in the stack. You want the whole thing?

ericdallo20:03:59

I think so, probably there is something saying why failed

ericdallo20:03:19

Syntax error (ClassNotFoundException) compiling at (clojure_lsp/main.clj:1:1). clojure-lsp.main :thinking_face:

ericdallo20:03:15

anythign relevant at /tmp/clojure-10905919124275376122.edn ?

ericdallo20:03:04

looks like some clojure issue, what's your clojure version?

sheluchin20:03:26

$ clojure --version Clojure CLI version 1.11.1.1435

ericdallo20:03:06

same as mine

ericdallo20:03:51

can you try rm -r .cpcache ?

sheluchin20:03:37

in the clojure-lsp repo folder? It doesn't exist

ericdallo20:03:03

does clojure -Spath in clojure-lsp folder works at least?

sheluchin20:03:32

$ clojure -Spath
/home/alex/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar:/home/alex/.m2/repository/org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar:/home/alex/.m2/repository/org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar

ericdallo20:03:33

or even clojure -A:dev -Spath to be precise

ericdallo20:03:32

k, try cd cli and then clj -T:build debug-cli

ericdallo20:03:44

yeah that's odd, what's your java version?

sheluchin20:03:23

$ java --version
openjdk 21.0.2 2024-01-16 LTS
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode, sharing)

ericdallo20:03:58

hum, didn't test clojure-lsp with java 21, only 17 and below, maybe it's related?

👀 1
sheluchin21:03:29

@UKFSJSM38 exactly which java 17 version?

ericdallo21:03:28

I don't think it would be relevant but mine is:

openjdk 17.0.7 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+7-nixos)
OpenJDK 64-Bit Server VM (build 17.0.7+7-nixos, mixed mode, sharing)

sheluchin21:03:17

Alright, I used asdf to install:

$ java --version
openjdk 17.0.2 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
and I'm still getting the same result.

sheluchin21:03:03

I think that's all I'm going to try today. Thanks for your help. I'll take another shot at it sometime.

ericdallo21:03:58

yeah, it shouldn't be hard to build a clojure-lsp local, sorry for that

sheluchin21:03:50

No worries, gotta be something with my environment.

sheluchin23:03:43

@UKFSJSM38 I managed to get a debug-cli build working by nuking my .m2 :man-shrugging: When I inspect what happens in call-refactor I see {:loc nil, :uri "/tmp/lspdebug/foo.clj", :refactoring :cycle-coll, :row 3, :col 2, :version 0}

ericdallo00:03:16

We need to understand why loc is being nil, try adding somes logger/info in the link I sent you

sheluchin00:03:45

I think it was because I was passing the path "/tmp/lspdebug/foo.clj" instead of the URI "file:///tmp/lspdebug/foo.clj". (vim.api.nvim_buf_get_name 0) returns the path of the current buffer and you can see in the screenshot I posted earlier, I naively used that value in :arguments.

ericdallo00:03:12

Ah makes sense