Fork me on GitHub
#announcements
<
2021-07-01
>
ericdallo14:07:04

Hello clojurians! clojure-lsp Released https://clojure-lsp.github.io/clojure-lsp/ with fixes and exciting new features, clojure-lsp is not a editor only tool anymore, it has its own API and CLI 🎉 It's possible now to run clojure-lsp via terminal telling to clean all ns forms of your project, removing unused vars, sorting required/refers/imports 🚀 For more information, check #lsp.

clojure-lsp 92
😱 22
catjam 24
borkdude14:07:07

Excellent, I can now deprecate carve? :)

😂 8
ericdallo14:07:17

hahah I expect carve to have a better configurability ATM, but it's easy to improve on clojure-lsp 🙂 carve seems a valid another approach not using the LSP protocol so having both options sounds good for community 😄

ericdallo14:07:40

Also, not sure all features carve provide, if all of them are alreday included in the clean-ns refactoring

borkdude14:07:49

Does clojure-lsp also offer a REPL API?

ericdallo14:07:25

Yes @U04V15CAJ with that release, the clojure-lsp.api should provide those features 🙂 https://clojure-lsp.github.io/clojure-lsp/api/

🎉 4
👍 2
rafaeldelboni15:07:21

This is quite cool! For some reason I need to do this clojure-lsp -p ./ clean-ns to manage the clean-ns work in my repos, is that intended?

ericdallo15:07:39

the default of the -p flag is the current dir, what error you were getting @UMMMKKADU?

rafaeldelboni15:07:53

no errors, is just not doing anything

ericdallo15:07:52

it's correct, it have no namespaces to clean 😅 Maybe a Cleaned! print is missing 🙂

ericdallo15:07:08

it will print the namespace cleaned only if it needs to clean anything

ericdallo15:07:30

you can confirm that, adding a unused var or sorting differently

rafaeldelboni15:07:00

yeah it only shows up when I use -p

2
rafaeldelboni15:07:22

instead it just prints 0ms

ericdallo15:07:10

Thanks! will investigate further more soon your project issue

borkdude15:07:12

Perhaps it's related to not having an .lsp/config.edn ?

rafaeldelboni15:07:12

I do have only an ~/.lsp/config.edn and just the ./clj-kondo/config.edn at projects level

borkdude15:07:30

yes, I meant the project level

borkdude15:07:48

could be related, dunno. I think it should be optional

ericdallo15:07:28

I don't think so, it probably some issue with the -p default value, in this case (io/file (System/getProperty "user.dir"))

rafaeldelboni15:07:59

I copied my personal .lsp/config.edn at project level and still having the same behaviour

ericdallo15:07:54

yeah, it's not related with the config

rafaeldelboni15:07:17

Want me to open a issue?

borkdude18:07:30

@UKFSJSM38 Sorry to interrupt your release Eric, but I don't think your recent commits fixed anything :)

borkdude18:07:41

The problem is that you are capturing values at build time

borkdude18:07:24

(System/getProperty "user.dir") should work, but not when you put it in a top level def

borkdude18:07:55

This is because static initializers are initialized at build time in graalvm native image with the --initialize-at-build-time option

ericdallo18:07:06

Hum, it makes sense, but I tested with the @UMMMKKADU project, let me double check

borkdude18:07:18

Perhaps your commit fixed something because the path is relative now, but this is the real reason it was broken

borkdude18:07:19

I guess the commits do work, but I was surprised you were still using top level defs, which is probably not a good idea

ericdallo18:07:36

you are right, it's missing running it in a function, or using default-fn instead of default

borkdude18:07:07

I mean for storing values that can be different over systems

ericdallo18:07:15

yeah, it's probably a good idea I change that cli-options to be a function

borkdude18:07:53

The CLI options are alright, but the defaults should just be handled dynamically, probably not using tools.cli itself

borkdude18:07:03

just using or in the main function or so

ericdallo18:07:42

why it's a problem handling in tools.cli if that cli-options would be a function?

borkdude18:07:14

that works too

ericdallo18:07:15

alright, I'll improve that to be a function, thanks for the heads up 🙂

borkdude18:07:05

a delay works too

ericdallo18:07:02

yes, but I think changing

:default (io/file "")
to
:default-fn #(io/file "")
is enough

ericdallo18:07:15

what is best, change to that ☝️ or change cli-optiosn to be a function?

borkdude19:07:04

oh I didn't know you vould provide a function for :default-fn, yeah that works too

ericdallo19:07:36

yeah, that looks better 🙂 I just need to remember for every new option facepalm

borkdude19:07:02

maybe make a note ;)

😹 2
ericdallo20:07:47

Released the fix!

Jonas21:07:54

Hey all! I've been working in the last weeks on a https://github.com/sauercrowd/clojureflare to make it easy to use Clojurescript with Cloudflare workers It's super experimental right now, but four lines are enough to get your worker up and running! Check it out

(ns new-worker.core
  (:require [clojureflare.core :as clfl]))

(clfl/worker
  (clfl/route "GET" "/worker" "hello from my worker"))

👍 21
nice 10
2