lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
Chase 2021-07-02T00:56:52.268100Z

Yep, worked perfectly for me. Thanks!

🎉 1
Chase 2021-07-02T00:58:40.268400Z

Quick question, the log is just a history of things that happened when running clojure-lsp? What would I normally set that path too?

ericdallo 2021-07-02T01:52:45.268700Z

yes, is just to log what clojure-lsp is doing

ericdallo 2021-07-02T01:52:53.268900Z

it's debug purposes only

Jakub Zika 2021-07-02T11:20:43.272300Z

Hi, I have just created a valid function which is wrongly parsed by lsp.

(defn send-to-slack [message]
  (let [command (clojure.string/join " " ["curl" "-i" "-X" "POST" "-H" "\\"Content-Type: application/json\\"" "-d" (str "'{\\"text\\":\\"" message "\\"}'") slack-uri])]
    (shell/sh "sh" "-c" command)))
It seems valid to Emacs once i change \\ to \ but then it fails during execution… Should I ignore warnings or there is some workaround?

ericdallo 2021-07-02T12:30:37.273100Z

That looks wrong with the double slashes, I'd guess

ericdallo 2021-07-02T12:31:12.273300Z

The warnings from clj-kondo are pretty reliable, not sure if it's a issue there

👍 1
ericdallo 2021-07-02T12:31:25.273500Z

@borkdude may know what's is the correct here

borkdude 2021-07-02T12:33:26.273700Z

why are you escaping it like this?

borkdude 2021-07-02T12:34:35.273900Z

if it's related to a Windows-specific bug... try babashka.process instead, it will apply that fix automatically without escaping

👍 1
borkdude 2021-07-02T12:36:15.274100Z

btw, if I eval this code from a file:

(require '[clojure.string]
         '[clojure.java.shell :as shell])

(defn send-to-slack [slack-uri message]
  (let [command (clojure.string/join " " ["curl" "-i" "-X" "POST" "-H" "\\"Content-Type: application/json\\"" "-d" (str "'{\\"text\\":\\"" message "\\"}'") slack-uri])]
    (shell/sh "sh" "-c" command)))

borkdude 2021-07-02T12:36:21.274300Z

it seems to be incorrect as well

borkdude 2021-07-02T12:36:30.274500Z

Syntax error reading source at (REPL:5:89).
Invalid token: Content-Type:

borkdude 2021-07-02T12:36:46.274700Z

You might need an extra \ in front of those double \\s

☝️ 1
Jakub Zika 2021-07-02T12:59:32.275Z

Oh, you are right, thanks. It is a specific problem in evaluating BB in org mode… There is no other way how can evaluate this script - this is why, it took me some time to construct this 🙂. I have yet to find a way how to keep this code consistent between .org and .clj.

borkdude 2021-07-02T13:05:33.275700Z

@zikajk Is this the org-mode stuff from Adam?

👍 1
borkdude 2021-07-02T13:05:52.275900Z

On his stream yesterday he discovered that it accidentally quotes strings the wrong way. I think he's going to fix it soon

borkdude 2021-07-02T13:06:04.276100Z

You might want to follow up on the discussions forum

Jakub Zika 2021-07-02T13:07:53.276300Z

Ha, thanks. I will check that elisp.

Jakub Zika 2021-07-02T13:19:54.276600Z

@borkdude I am still not able to get this to work in BB REPL. Once the command seems parsed correctly it fails during execution. Should I move to babashka/process? Thanks

borkdude 2021-07-02T13:20:31.277100Z

Is this on Windows?

borkdude 2021-07-02T13:20:41.277300Z

Then probably yes

Jakub Zika 2021-07-02T13:23:22.277500Z

No, using babashka in zsh on macos. And I am going to deploy this script on old unsuported centOS too…

borkdude 2021-07-02T13:24:05.277700Z

ok, please start another thread in #babashka then, where we can discuss what's going wrong.

💯 1
borkdude 2021-07-02T13:24:23.278Z

I'm kind of busy now, but perhaps someone else can help meanwhile

👍 1
2021-07-02T21:36:16.280500Z

So I'm just trying out clojure lsp for the first time on a machine that can actually run it, and it's looking pretty cool so far! One question: I have hooks set up with clj-kondo to resolve a particular macro, but it appears that clojure-lsp isn't recognizing that hook and is giving me a warning about an unresolved macro. Is there some configuration I need to add to have it pay attention to the clj-kondo config?

borkdude 2021-07-02T21:37:23.280900Z

it should work right out of the box

ericdallo 2021-07-02T21:37:32.281Z

Hey, glad to hear you are liking :)

ericdallo 2021-07-02T21:38:09.281200Z

Yeah, it should work the same as using clj-kondo, unless you have a outdated .clj-kondo/.cache folder?

ericdallo 2021-07-02T21:38:43.281400Z

Do you have a .clj-kondo folder?

2021-07-02T21:39:05.281600Z

Yup, it has the hooks that I configured. I've been using clj-kondo with spacemacs for a while and it was all working correctly.

2021-07-02T21:39:31.281800Z

I'm now trying out doom for a bit and got the lsp set up and it's complaining about stuff I already have configured.

ericdallo 2021-07-02T21:40:08.282Z

Hum, could you try removing .clj-kondo/.cache folder?

ericdallo 2021-07-02T21:40:58.282200Z

If that doesn't work, could you try removing .lsp/sqlite.db?

2021-07-02T21:41:42.282400Z

same issue. I can try removing the sqlitedb though

2021-07-02T21:43:02.282600Z

reindexed after restarting the workspace and has the same issue

2021-07-02T21:43:36.282800Z

If I run clj-kondo from the commandline I get no warning for the macro either.

ericdallo 2021-07-02T21:43:38.283Z

That's odd, any errors on the clojure-lsp log?

ericdallo 2021-07-02T21:44:20.283200Z

You can get it via the :log-path of the return of lsp-clojure-server-info

2021-07-02T21:44:29.283400Z

Jul 02, 2021 4:44:30 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 433
This is everything I have in my stderr buffer

ericdallo 2021-07-02T21:44:47.283600Z

Not that one

2021-07-02T21:45:54.283900Z

oh, okay

2021-07-02T21:48:54.284100Z

Okay, looks like there's a lot going on in there

ericdallo 2021-07-02T21:49:34.284300Z

maybe it's better to restart the project and get the new log to avoid to much noise

2021-07-02T21:50:12.284500Z

The only thing logged at an ERROR level is clojure-lsp crawler saying it imported some of my config to the clj-kondo folder

ericdallo 2021-07-02T21:50:35.284700Z

as ERROR level? that's odd

2021-07-02T21:50:40.284900Z

yeah, it was weird

ericdallo 2021-07-02T21:50:51.285100Z

could you paste it here?

2021-07-02T21:51:41.285300Z

2021-07-02T21:44:07.948Z iris-joshua ERROR [clojure-lsp.crawler:79] - Imported config to .clj-kondo/org.suskalo/farolero. To activate, add "org.suskalo/farolero" to :config-paths in .clj-kondo/config.edn.

2021-07-02T21:51:44.285500Z

That's the only error

2021-07-02T21:51:56.285700Z

Lots of stuff is logged at debug level saying invalid clj-kondo finding

ericdallo 2021-07-02T21:52:14.285900Z

that's okay, let me check that error

ericdallo 2021-07-02T21:52:49.286100Z

oh, the level is wrong on the code, but that is the return of a clj-kondo log

ericdallo 2021-07-02T21:53:09.286300Z

odd, everything seems correct, and I use hooks with clojure-lsp and they work fine

ericdallo 2021-07-02T21:53:17.286500Z

could you try to make a minimal repro?

ericdallo 2021-07-02T21:53:28.286700Z

a repo with minimal macro and the hook

2021-07-02T21:54:01.286900Z

Sure, I could try, but I probably won't have time for it today.

ericdallo 2021-07-02T21:54:18.287100Z

no problem, I can test it on my side when you have the repro

2021-07-02T21:54:40.287300Z

Sounds good