Fork me on GitHub

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?


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


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

👍 2

@U04V15CAJ may know what's is the correct here


why are you escaping it like this?


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

👍 4

btw, if I eval this code from a file:

(require '[clojure.string]
         '[ :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)))


it seems to be incorrect as well


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


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

☝️ 4

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.


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

👍 4

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


You might want to follow up on the discussions forum


Ha, thanks. I will check that elisp.


@U04V15CAJ 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


Is this on Windows?


Then probably yes


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


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

💯 4

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

👍 4
Joshua Suskalo21:07:16

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?


Hey, glad to hear you are liking :)


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


Do you have a .clj-kondo folder?

Joshua Suskalo21:07:05

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.

Joshua Suskalo21:07:31

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.


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


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

Joshua Suskalo21:07:42

same issue. I can try removing the sqlitedb though

Joshua Suskalo21:07:02

reindexed after restarting the workspace and has the same issue

Joshua Suskalo21:07:36

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


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


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

Joshua Suskalo21:07:29

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


Not that one

Joshua Suskalo21:07:54

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


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

Joshua Suskalo21:07:12

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


as ERROR level? that's odd

Joshua Suskalo21:07:40

yeah, it was weird


could you paste it here?

Joshua Suskalo21:07:41

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.

Joshua Suskalo21:07:44

That's the only error

Joshua Suskalo21:07:56

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


that's okay, let me check that error


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


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


could you try to make a minimal repro?


a repo with minimal macro and the hook

Joshua Suskalo21:07:01

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


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


it should work right out of the box