Fork me on GitHub
#calva
<
2022-10-26
>
orestis10:10:19

I just learned that CIDER will "highlight" reflection warnings when evaluating a form that produces them (jumping to the offending location in the code). Should I raise an issue to document this for future reference?

pez10:10:31

Please do. 🙏

pez10:10:23

Is this something that clj-kondo can help with statically? If so maybe it should be handled that way. But please file the issue on Calva anyway.

orestis10:10:27

Apparently clj-kondo has a rule to remind you to enable (set! *warn-on-reflection* true) but the actual warning comes when evaluating the form since it depends on what exactly you're calling.

Kari Marttila17:10:53

There is one a bit annoying feature in Calva Paredit: Kill/Delete Right If I have the following row and | marks the cursor:

(count |[:a :b])
... and then I give command Calva Paredit: Kill/Delete Right ... I get:
(count|)
and not:
(count |)
... and therefore if I "paste" the form back I get:
(count[:a :b])
and not:
(count [:a :b])
...which I would like to get. I'd like to know the rationale of the current implementation of Calva Paredit: Kill/Delete Right (i.e. why to remove the space)? I guess the best way to add the "missing space" is to create a custom Joyride script?

pez17:10:52

This is not so much a Kill Right thing as it is a Calva Paredit thing. The edit commands follow up with a format of the current form. That formatting deletes surrounding whitespace. If we can identify the situation correctly we could do a special formatting that would keep that space. File an issue about it please.

pez17:10:11

It can probably be fixed using Joyride, but it is not trivial. You'll need to examine the form to make a decision if a space should be added or not.

skylize18:10:03

That is caused by :remove-surrounding-whitespace? rule in cljfmt. A config to disable that rule would make this go away, but would also break the many cases where applying this rule is desirable. I plan to attempt patching Calva to override this rule by ignoring whitespace directly left of the cursor after any delete/kill that removed any non-whitespace. (But I have no ETA, and definitely would not complain if you beat me to it. 😉 )

skylize18:10:58

..."Ignoring" whitespace left of the cursor is probably not accurate. From my digging so far, I think solving this will require proactively recording the existence of that whitespace, so it can be restored after cljfmt does its thing.

pez21:10:45

Calva already distinguishes between format-on-demand and format-as-you-type, relaxing the formatting for the latter case. It could be that this strategy should be expanded on, or some similar approach should be taken for Paredit-induced formatting (which counts as format-as-you-type).

Kari Marttila18:10:04

Thanks for the answers! I create a ticket for this as you answered. 🙂

🙏 1
Kari Marttila18:10:43

Calva rules ok! 🙂 🚀 to the 🌔

pez19:10:25

Investigating this I realize that we are not using as-you-type formatting for post-Paredit format. This could be a bug, and it could be for good reasons, idk, but here's a build using this. Please take it for a spin, folks, and let me know how you fare. • Read some more about the experiment here: https://github.com/BetterThanTomorrow/calva/pull/1924 • VSIX: https://output.circle-artifacts.com/output/job/94e9e0f1-e680-4ddf-8004-3a54beb13597/artifacts/0/tmp/artifacts/calva-2.0.312-1922-paredit-ontype-formatting-da9c0f34.vsix

❤️ 1
skylize20:10:17

Phone only, yesterday and today. Anxious to try this out.

Erlangga21:10:25

Hello everyone! I'm new in Calva, just moved from another code editor and try doing some adaptation. Everything was fine when I'm doing the hello_repl.clj from Calva: Fire up the Getting Started REPL , but I get stuck (cannot formatting the code) when in ==Editing Code== chapter, when i press 'tab' key nothing happened, Is there any configuration to handle this? Thank you

pez21:10:51

Hi there! Thanks for bringing this to our attention. Can you check if you have something else bound to the tab key?

Erlangga22:10:31

Thanks, I've already do what you suggest and yeah there is 7 keybinding bound from the default source, but when i change the Calva Format: Format Current Form keybinding into another key, it's still nothing happened (I already restart the VSCode)

pez22:10:29

You know what? I can reproduce this error. I think it is a regression from recent. Please file an issue. To try Calva formatting, for now you need to open a folder in VS Code and have some Clojure file opened there. You can copy the code from that Getting Started file.

Erlangga22:10:52

OH WOW! yeah it's work! Automagically, i even don't press tab , but yeah it's obviously work. Thank you so much for helping me, I'll file an issue on Github.

🙏 1
pez22:10:32

Please do. It is super important that this works with the Getting Started REPL files too, as you can imagine.

👍 1
pez22:10:12

@UGNFXV1FA I think we might have not tested those Uri/path changes in the Getting Started REPL. If you have the time, please have a look. Otherwise I'll do this. I'm not sure it is those changes, of course, it's just that the errors I get indicate this (complains about some Uri thing being undefined).

pez22:10:29

You know what? I can reproduce this error. I think it is a regression from recent. Please file an issue. To try Calva formatting, for now you need to open a folder in VS Code and have some Clojure file opened there. You can copy the code from that Getting Started file.