Fork me on GitHub
#lsp
<
2023-11-08
>
lispyclouds12:11:34

@ericdallo i use an automated process based on the https://clojure-lsp.io/installation/#script method of installation and since the script uses the https://github.com/clojure-lsp/clojure-lsp/blob/master/install#L77 to get the latest version and if the version there is unreleased like its now, it errors my tooling out. would it be possible to use a different file? like how we do in bb wth BABASHKA_RELEASED_VERSION? i can do a PR for this if you think this is useful.

ericdallo12:11:50

ah forgot about that..

ericdallo12:11:08

yeah, I think so, would avoid errors like that, a PR would help a lot, thanks!

lispyclouds12:11:34

awesome, will take a look at the release process and add in the new file!

borkdude12:11:30

You could also just look at the latest GitHub release probably

ericdallo12:11:57

yeah, that sounds better I guess

lispyclouds12:11:59

that would need some json parsing i think

lispyclouds12:11:25

not as easy just looking at this one file

ericdallo12:11:30

yeah, or just do a raw grep for the version

lispyclouds12:11:32

lemme see if getting it from github isnt too complex/needs more moving parts, then can try that

borkdude12:11:43

Bb exists for a reason ;-)

lispyclouds12:11:03

well this is the install script, needs bb before 😛

lispyclouds12:11:26

often i run this on bare things

ericdallo12:11:16

yeah, agreed would be nice if we don't depend on bb, jet or any other tool

borkdude12:11:02

Ah I thought this was just lispycloud his script, makes sense

lispyclouds13:11:54

@ericdallo does the version file get updated automatically somewhere?

ericdallo13:11:24

nope, it's only available in the jar or the repo code itself

lispyclouds13:11:10

so its pretty much manually updated when we want to release? not even some script that does it? how about https://github.com/clojure-lsp/clojure-lsp/blob/master/release ? is this used somewhere?

ericdallo13:11:45

ah yes, the script that changes that version is the release one

ericdallo13:11:18

but we don´t upload the version to anywhere, although I don't see much problem update that to the release as well if that makes sense

Ingy döt Net22:11:54

Not sure if this is the right channel... When I

(defn Vec ...)
I get this warning (in Calva) Vec already refers to #'clojure.core/Vec clj-kondo(redefined-var) But I then I also see
user=> clojure.core/Vec
Syntax error compiling at (/tmp/form-init15592520369737587153.clj:1:7899).
No such var: clojure.core/Vec

ericdallo22:11:01

since this belongs to how clj-kondo lints, #CHY97NXE2 is the best channel

Ingy döt Net22:11:39

thanks. I'm not in there yet, so didn't see it in my channels

borkdude22:11:49

user=> (resolve 'clojure.core.Vec)
clojure.core.Vec

borkdude22:11:41

you can get rid of this warning by writing:

(:refer-clojure :exclude [Vec])

Ingy döt Net22:11:47

is the kondo warning wrong?

borkdude22:11:30

the clj-kondo warning is slightly misleading since Vec isn't a var

Ingy döt Net22:11:02

but why does the warning say #'clojure.code/Vec not clojure.core.Vec ok, I'll report it to #clj-kondo

borkdude22:11:43

the answer is because deftype and defrecord are a bit lumped together, records do create vars

Ingy döt Net22:11:22

but kondo could do better there, right?

borkdude22:11:39

I think it's done this way since it's easier to implement navigation information etc like this to just regard them as vars, even though it's not technically correct

borkdude22:11:56

There are also vars created like ->Foo and map->Foo

borkdude22:11:04

e.g.:

Clojure 1.11.0-alpha4
user=> (defn ->Vec [])
WARNING: ->Vec already refers to: #'clojure.core/->Vec in namespace: user, being replaced by: #'user/->Vec

borkdude22:11:12

so I'd kinda recommend just using :refer-clojure :exclude for these names, even though technically Vec isn't already a var. Feel free to post a Github issue about this though

Ingy döt Net22:11:00

👍 I did already :exclude and I linked to this thread in #CHY97NXE2

👍 1
seancorfield22:11:26

> 1.11.0-alpha4 👀

borkdude22:11:35

this is an old laptop

borkdude22:11:57

that I only use to watch tv at night, but incidentally, answer slack questions if they pop up ;)

metal 1
🙏 1
borkdude12:11:20

I also found this edge case:

user=> (deftype Dev []) (defn Dev [])
user.Dev
Syntax error compiling def at (REPL:1:1).
Expecting var, but Dev is mapped to class user.Dev

Ingy döt Net12:11:55

adding deftype support to SCI? 🙂

borkdude12:11:25

SCI already has (limited) deftype support btw

borkdude12:11:59

but as explained previously (I think) this is only for compatibility with some clj libraries (yes nbb too, same SCI), not something that I really recommend using

borkdude12:11:04

I was just reporting another edge case I found in (JVM) clojure concerning deftype + var name clashes. Nothing more than that

1
borkdude11:12:04

I'm fixing this anyway since I ran into another issue which hits this case:

$ clj -M:clj-kondo/dev --lint - <<< '(def Vec 1)'
linting took 49ms, errors: 0, warnings: 0