Fork me on GitHub
#lsp
<
2022-10-06
>
jvtrigueros02:10:02

Not sure if this is the right place to post this. When the (ns..) section is folded *and* has some requires, the "thing" that adds the correct import messes up the parens of the ns and doesn't add the require. I made short video first showing it working then having it break.

snoe04:10:20

That looks like an lsp client issue to me, either the fold is affecting the text we're being sent or the edit we send back is being applied incorrectly.

ericdallo10:10:52

Agreed, @U0JAE119P maybe you should open a issue on lsp-mode

👍 1
robert-stuttaford05:10:08

in case it's something that needs resolving:

==> Upgrading 1 outdated package:
clojure-lsp/brew/clojure-lsp-native 2022.09.01-15.27.31 -> 2022.10.05-16.39.51
==> Downloading 
==> Downloading from 
######################################################################## 100.0%
Warning: Cannot verify integrity of '0a2554cd99bc4245ad97e5866120c786db0de2dc912f176718fc712d29807ae1--clojure-lsp-native-macos-aarch64.zip'.
No checksum was provided for this resource.
For your reference, the checksum is:
  sha256 "b5b671d58c21364f1b381c6f5524e6551b8b66ee3324e8b1274545db5ed96f23"

borkdude07:10:21

I've had this with clj-kondo too. The issue is that if the brew recipe is updated and CI does another release for the same version, the hash of the asset changes... One solution is to run the brew recipe generation again. cc @UKFSJSM38 @U0BUV7XSA @U07M2C8TT

ericdallo10:10:56

Yeah, I was aware of that, that we were losing the Sha every release, just not sure how to fix the root cause

borkdude10:10:33

The issue is that the cirrus CI probably has run twice

borkdude10:10:53

but I'm going to make an improvement in gh-release-artifact to prevent doing this

borkdude10:10:02

along with creating a .sha256 option

borkdude11:10:00

the brew package still needs to updated manually though

borkdude11:10:47

What I'll do myself is set :overwrite false when it's not a snapshot release

borkdude11:10:49

So:

(ghr/overwrite-asset {:org "clj-kondo"
                                :repo "clj-kondo"
                                :file file
                                :tag (str "v" current-version)
                                :overwrite (str/ends-with? current-version "SNAPSHOT")})

borkdude12:10:10

I now also added a :sha256 true option which uploads .sha256 files like here: https://github.com/graalvm/graalvm-ce-builds/releases/tag/vm-22.2.0

ericdallo12:10:26

Looks great!

ericdallo12:10:57

Feel free to open a PR otherwise I can take a look at this on the weekend

borkdude12:10:36

@UKFSJSM38 What is the condition on which gh-release-artifact should overwrite an already uploaded file of an existing release?

borkdude12:10:44

never, always or it depends?

ericdallo12:10:59

I think only on nightly?

borkdude12:10:38

how does your nightly releases work?

ericdallo12:10:52

Actually, I can't see why there is a case where we want to overwrite at all

borkdude12:10:05

right. you use 1 release per nightly version right?

borkdude12:10:15

I use 1 release for all snapshots, until I release

ericdallo12:10:25

the nightly is a GH action called nightly.yml which just does a date and append -nightly so yeah, it should have no conflicts AFAIK

borkdude12:10:37

ok then, I'll make it so

borkdude12:10:49

I'll also fix the homebrew package

ericdallo12:10:00

awesome! 🙏

borkdude12:10:51

I can fix it manually but I don't know how that happened

ericdallo12:10:06

yeah, previous release we did the same :/

borkdude12:10:08

Tested and works now. cc @U0509NKGK

ericdallo12:10:24

Merged, thank you!

borkdude13:10:47

The brew package has been fixed, so you can update clojure-lsp-native

🚀 3
athomasoriginal16:10:00

Is it possible to use zprint when formatting instead of clj-format?

borkdude16:10:44

I don't think clojure-lsp has this, but why do you prefer zprint over cljfmt? I'd like to learn about the differences. (Meanwhile, I'm still using clojure-mode)

athomasoriginal16:10:27

TMK zprint has more powerful configuration options and extensive docs. Having said this, I haven't used cljfmt in years.

ericdallo16:10:22

We don't support zprint ATM, only cljfmt

👍 1
ericdallo16:10:48

it would be nice to support both, but one more dep/integration

🙏 1
borkdude16:10:01

I would keep an eye on compilation time and binary size. Some libs with dynamic requires can blow that up

👍 1
snoe19:10:51

https://github.com/greglook/cljstyle was interesting to me, since it seemed to expand on cljfmt

👍 2
ericdallo19:10:25

Looks interesting

lispyclouds04:10:29

+1 for zprint from me too! Very flexible and much more configurable. Too much configurable at times, but also has sane defaults like using the community style guide etc.

lispyclouds05:10:36

Haven’t used it via lsp yet, mostly via neovim’s buffer formatting. But nvim 0.8 has native lsp formatting support so would be great! 😄

practicalli-johnny08:10:16

I use https://github.com/greglook/cljstyle on the command line (it's available as a binary) and included in setup-clojure GitHub Action. Cljstyle was fairly easy to set up with the https://github.com/practicalli/dotfiles/blob/main/.cljstyle, so very small learning curve. I've added zprint as a aliases to https://github.com/practicalli/clojure-deps-edn, although haven't read up enough about zprint to know how to use it, seems quite different in approach (probably just need to spend time reading the docs)

Noah Bogart10:10:19

zprint aims to handle adding and removing newlines, which I believe cljfmt/cljstyle does not. It tries to handle produce the same output for a given input regardless of how the input is currently formatted. It’s significantly more powerful and customizable and it’s worked well at Crossbeam (where I work), but it can produce some really odd formatting lol. I go back and forth whether I like it or don’t.

ericdallo12:10:30

I thought cljfmt already supports removing newlines :thinking_face:

practicalli-johnny16:10:51

Yes, cljfmt and cljstyle both remove (and add) lines according to the rules set. I found cljfmt a bit draconian by default, ensuring there was only one line between top-level forms. A little to restrictive for me, especially with LSP auto formatting, I quickly modified that rule to a nice 2 line gap, which feels much nicer to work with to me. Zprint seems very powerful indeed and with great power comes a longer time needed to read the docs. Would like to learn more about zprint when I get the time or find a nice blog that specifically covers lining of a Clojure code base. I got the impression from the docs that there are many more uses that zprint can support though.

ericdallo16:10:42

Yeah, I think we should consider supporting zprint as long term but we can't drop cljfmt because of breaking changes, feel free to create a issue so we can discuss more about it @U6GNVEWQG

👍 1
athomasoriginal16:10:12

https://github.com/clojure-lsp/clojure-lsp/issues/1315 - let me know if you want me to add any additional information 🙂