Fork me on GitHub
#calva
<
2023-07-15
>
DerTev16:07:50

Hey guys! Any idea, why I get an error when try to run the clojure-lsp? This is the log of the Clojure Language Client:

[Trace - 6:09:09 PM] Sending request 'initialize - (0)'.
[Trace - 6:09:21 PM] Received response 'initialize - (0)' in 12448ms. Request failed: Internal error (-32603).
[Error - 6:09:21 PM] Server initialization failed.
  Message: Internal error
  Code: -32603 
[object Object]
[Error - 6:09:21 PM] Clojure Language Client client: couldn't create connection to server.
  Message: Internal error
  Code: -32603 
[object Object]
[Error - 6:09:23 PM] Connection to server got closed. Server will not be restarted.

DerTev10:07:55

Where do I find the server logs on Windows?

ericdallo13:07:22

Good question :) I don't know what path windows use as tmp dir, but you can set a setting pointing to somewhere like: .lsp/config.edn

{:log-path "/some/path"} 

ericdallo20:07:35

yes, seems like the same issue, would be nice to try to get the server log specifying a log path

Δημήτριος Φκιαράς13:07:36

@UKFSJSM38, can you check if your project folder is placed in a path with non-latin characters in parent folder names?

ericdallo17:07:01

I think you meant @U03EXAURGUC?

❤️ 2
DerTev16:10:14

Sorry for the really long response time... I get the same error with the latest clojure-lsp version. I'll try to provide the full logs to you. Sadly, the linked problem doesn't seem to be related to this as there are only alphabetical characters (a-z) in the path of my project.

DerTev16:10:38

Should I fork the project and try it in there?

DerTev16:10:05

Also, I get no logs... The content of .lsp/config.edn is {:log-path "\Users\myuser\Downloads\clj-lsp-logs"}.

ericdallo16:10:35

ah, from your logs Clojure Language Client client: couldn't create connection to server. this meant that clojure-lsp is not even starting... it could be a problem on calva side as well. Maybe try running in your project repo clojure-lsp diagnostics and check if clojure-lsp is working

ericdallo16:10:03

Yeah, looks like not a clojure-lsp bug, maybe <!subteam^S03BGSAUPTQ> can help here

bringe17:10:25

@U03EXAURGUC Did you see if clojure-lsp starts for the clojure-sample project mentioned above? Also, check the dev console for any potentially useful info around clojure-lsp after you get the error message. (Help -> Toggle Developer Tools -> Console tab)

DerTev22:10:41

Uhm, it works with the project mentioned above...

DerTev22:10:25

Hm, but it does not work with a Leiningen Project, maybe is that the issue?

DerTev22:10:25

The project.clj looks like

(defproject clojure_sample "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url ""
  :license {:name "MIT License"}
  :dependencies [[org.clojure/clojure "1.10.3"]
                 [org.clojure/clojurescript "1.10.758"]
                 [org.clojure/core.async "1.5.648"]
                 [nubank/matcher-combinators "3.3.1"]]
  :target-path "target/%s")

bringe22:10:57

It should work with Lein projects. Can you provide a link to a repo with a sample project where you can reproduce the issue?

DerTev22:10:41

Yes, I can publish it to GitHub if you want

bringe22:10:48

Yes, a GH repo would be good

pez07:10:03

> The content of .lsp/config.edn is {:log-path "\Users\myuser\Downloads\clj-lsp-logs"}. Doesn’t look like that should work?

clj:user:> "\Users\myuser\Downloads\clj-lsp-logs"
; Syntax error reading source at (REPL:60:4).
; Unsupported escape character: \U

pez07:10:44

I tried the repro now. On my Mac. Works there. Will try find some time to test it on Windows as well.

pez08:10:43

I also tried with that log path configuration. Noting several things: • clojure-lsp silently falls back on /tmp/clojure-lsp.out as log file ◦ We then find the above error message in this log file • Calva’s command for opening the log file failed silently ◦ In the console log it informs something about VS Code having troubles with files bigger than 50MB ◦ Unfortunately I then removed the file, so I don’t know how big my file was ◦ It took a full reload of the VS Code window to make the command wrk again • Fixing the log path so to a legal string, but non-existent path (I just changed \ to / in that path and it doesn’t exist on my machine) I got the errors reported in @U03EXAURGUC’s thread start. I’ll post the clojure-lsp log from when using a legal string, though non-existent log path, and Calva’s console logs in separate messages. My main take-aways here are: • it could be a configuration error, @U03EXAURGUC • Calva could do better in handling the error, <!subteam^S03BGSAUPTQ> • clojure-lsp could do better in handling the error, @UKFSJSM38

pez08:10:13

The clojure-lsp log from when I tried with a valid string, but the doesn’t exist.

pez08:10:11

Calva’s console logging from the same session.

pez08:10:29

Fixing the log config so that it is an existing path, things work without issue. So there’s that. 😃

ericdallo11:10:19

So in clojure-lsp side the issue is when we receive a bad log path?

pez13:10:24

It seems so, but it is not fully conclusive. I can’t reproduce the error with an unparsable log path. Only with a non-existing one. In both cases it makes sense for clojure-lsp to fall back on a default, I think. And to update its serverInfo answer with the file it has fallen back to. That would help Calva open the right file, where the bad-log-path message can be read.

ericdallo13:10:53

makes sense, I think a check if file exists before creating the logger would be enough fallbacking for the default

👍 1
pez14:10:04

Does it make sense for Calva to automatically open the log on those startup errors? Asking everyone.

pez14:10:01

Or at least have a button there Open log file.

ericdallo14:10:27

I like the button idea

👍 2