lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
ericdallo 2020-05-11T13:29:54.045300Z

@snoe Can we generate a release from the last PR merged 🙂 ?

snoe 2020-05-11T13:56:22.045500Z

🎉

ericdallo 2020-05-11T13:59:18.045700Z

Thanks! 🎉

ericdallo 2020-05-11T18:56:19.046500Z

Hey @snoe, we from :nubank: have a custom macro for testing and we can't create a macro-def for it, can you help us please?

ericdallo 2020-05-11T18:56:30.046600Z

this is the macro:

ericdallo 2020-05-11T18:56:56.046800Z

Sample structure:

(flow "Test flow"
  (side-effect!)
  [binding-a (fetch-a!)]
  (match? x binding-a)
  [binding-b (fetch-b!)])
Example2:
(flow test-x
  [a 1
   b 2]

  [c 3
   d 4

   :let [abcd (some-func/abcd)
         dcba (another-func a b) ]]

  (some-test/do-something a b c d)

  [some-value 1234]
  (my-fn/match? 2 (count some-value))
  (my-fn/match? (m/in-any-order [a b]) some-value))

ericdallo 2020-05-11T18:57:25.047Z

in the body, we can have many fn that apply to the state and we may bind the result to a name. Calling the function as in `(side-effect!)` will only apply to the state and skip the return. using `[name (fn!)]` will bind the result to the name. And we can still have `match?` in the middle of the forms. Finally, there is `[:let [name val]]` that will bind without as a usual `let`

ericdallo 2020-05-11T18:57:44.047200Z

The problem to me is that it can have multiple bindings

ericdallo 2020-05-11T18:58:24.047400Z

I tried something like:

my-ns/defflow [{:element :declaration :tags #{:unused}}
                                         {:element :bindings :pred :vector :repeat true}
                                         :bound-elements]

ericdallo 2020-05-11T18:58:39.047600Z

But It seems that :pred does not accept :vector

ericdallo 2020-05-11T19:06:03.048300Z

Also, I don't know if there's some :pred for a function or something like that

snoe 2020-05-11T19:59:23.048700Z

yeah, seems like you need a :vector and :list preds but I think you'll also run into repeat not working as you expect

ericdallo 2020-05-11T20:00:27.049Z

yes, I tried to add on match-pred? and clojure-lsp enters in a loop and wont even start 😢

snoe 2020-05-11T20:00:41.049200Z

there is match-patterns but It's been awhile since i made it and it ended up not being used so it'll need to be reverse engineered a bit

snoe 2020-05-11T20:02:35.049400Z

hrm, yeah, starting with a test there would be the way I approach it. but there could be assumptions about lists in that code

ericdallo 2020-05-11T20:04:36.049600Z

Yeah, that parse-match-patterns is pretty complex 😨

snoe 2020-05-11T20:05:42.049800Z

right, macros that don't follow established patterns are always going to be tricky. kondo is thinking about using a sexpr that evals the pattern in some way.

ericdallo 2020-05-11T20:07:16.050Z

That could help maybe