Fork me on GitHub
#clojure-europe
<
2021-02-17
>
RAMart07:02:59

:spock-hand: ☀️

ordnungswidrig07:02:11

Good morning. This day start nicely with a 10 people meeting about a production bug. It can only go uphill from here 😛

dharrigan08:02:13

'morning all btw!

ordnungswidrig08:02:57

@dharrigan yea. If if Kafka an Sisyphos had a child.

javahippie09:02:21

I tried to find the joke about message brokers, there. Time for another coffee

slipset09:02:36

@ordnungswidrig would be happy to know that I’ve been reading some liberator source-code this morning 🙂

ordnungswidrig09:02:04

don’t do that. It’s basically the first clojure code I had ever written.

slipset09:02:28

I know it is. And it’s such a wonderful journey into another way of writing Clojure 🙂

slipset09:02:46

Reason being is that we’re switching from Compojure to Reitit while not throwing out Liberator.

slipset09:02:49

Liberator plays nicely with Compojure (since Compojure expects a ring-handler), but Reitit just wants a simple function that accepts a request as a handler.

ordnungswidrig09:02:14

Well, liberator creates simple function that expect a request and return a response.

slipset09:02:24

So our code base is littered with :handler ((liberator-resource foo bar baz) req)

ordnungswidrig09:02:25

which is the ring-handler model

ordnungswidrig09:02:38

hmm you can use run-resource

ordnungswidrig09:02:03

e.g. :handler (run-resource req :exists? false)

slipset09:02:23

I played around with a new defresource which accepts a request so something like this:

(defresource field-search [{:keys [system ctx parameters] :as request}]
  :allowed-methods [:get]
  :available-media-types ["application/json"]
  :handle-ok (component-service/search-components (:component-service system)
                                                  ctx parameters))

slipset09:02:47

Which I guess is basically a run-resource in disguise

borkdude09:02:36

Morning. In about 9.5 hours from now (20:00 GMT+1) @ericdallo will present clojure-lsp at the Dutch (online) Clojure meetup. All welcome.

🎉 3
clojure-lsp 3
ikitommi10:02:52

doesn’t this work (reitit + liberator)?

["/my-resource" field-search]
… which expands to:
["/my-resource {:handler field-search}]
… which mean “all requests to /my-resource handled by ring-handler, defined as field-search”.

ordnungswidrig10:02:09

> So our code base is littered with `:handler ((liberator-resource foo bar baz) req)` I’m not an retit expert but looking at this again this is weird. I had expected :handler (liberator/resource foo bar baz) do be sufficient. :thinking_face:

ikitommi11:02:18

I’m not a liberator expert, but would assume you example would work too.

otfrom12:02:28

I'm setting up clojure-lsp (a bit mixed atm) and not sure how I turned on this

borkdude12:02:08

@otfrom Disable lsp-ui. I find it too noisy

otfrom13:02:35

@borkdude thx. I thought it might have been that. I like some of the things from it, but overall it is a bit noisy

otfrom13:02:47

I bet is has all the configurations

borkdude13:02:03

I have turned off most of the noisy stuff

borkdude13:02:34

I mostly use lsp for find-definition (navigates to definition) and find-references.

otfrom13:02:44

why did you turn off lens?

ericdallo13:02:21

Yeah, recently we introduced some visual simple feedbacks in the modeline, so lsp-ui is kind of redundant for some features

borkdude13:02:55

You can also do lsp-describe-thing-at-point which will give you the same info a lens, but then on request. I prefer that

otfrom13:02:11

ah, that sounds good

borkdude13:02:20

or actually it gives less info, but I'm not sure why not all the info is in there.

borkdude13:02:49

e.g. the amount of usages, etc could also be inside describe-thing-at-point @ericdallo?

ericdallo13:02:04

It could, it's not common for lsp-servers return that kind of info on the hover information though

ericdallo13:02:18

But is something to think about

borkdude13:02:18

I'm not talking about hover, just M-x lsp-describe-thing-at-point

borkdude13:02:36

E.g. also show the docstring there (oh that already works!)

ericdallo13:02:07

Yeah, I don't remember what lsp-describe-thing-at-point calls, I thought it was hover

borkdude13:02:47

@ericdallo Ah I can just toggle lsp-lens-mode anyway, so never mind :)

ericdallo13:02:41

Yes :) most lsp-mode features have their own minor-modes/lsp-*-enable flags to make almost everything opt-in/out

otfrom13:02:00

I think

(setq lsp-ui-sideline-show-code-actions nil)
got rid of the bit that I found extra annoying. I quite like the rest of the chrome

otfrom14:02:46

@ericdallo thx for clojure-lsp. Good docs

❤️ 3
otfrom14:02:00

and thx to @borkdude for the bits of kondo that make it more betterer

ordnungswidrig14:02:37

I’m trying lsp now and I’m impressed and confused at the same time

otfrom14:02:01

I'm deffo still in the confused stage. The docs are helping me get through

otfrom14:02:18

I'm having lots of key clashes as well (esp w/ i3 wm)

ericdallo14:02:03

Make sure to check this guide if you use Emacs 🙂 it should help https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/

otfrom14:02:39

so, I know it will place nicely with CIDER, but I'm wondering if I should get rid of clj-refactor

ericdallo15:02:43

I haven't used clj-refactor for a while, IMO you can use clojure-lsp for most features

otfrom15:02:15

I shall give it and see what I miss

borkdude16:02:10

@orestis how is Docker on M1 nowadays?

orestis17:02:58

@borkdude I don’t use docker so I haven’t tried it yet

dharrigan18:02:00

There's a tech preview available

val_waeselynck20:02:27

This has got to be the most beautiful voice I've heard in years: https://www.youtube.com/watch?v=6EyPVbGMC2Y

👍 3
👂 3
val_waeselynck20:02:54

I wonder if the people who don't speak the language find it as moving as I do