This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-17
Channels
- # announcements (7)
- # babashka (24)
- # beginners (11)
- # boot (16)
- # calva (46)
- # cider (5)
- # clara (3)
- # clj-kondo (2)
- # cljfx (5)
- # clojure (122)
- # clojure-brasil (26)
- # clojure-dev (20)
- # clojure-europe (20)
- # clojure-germany (1)
- # clojure-nl (1)
- # clojure-norway (54)
- # clojure-uk (2)
- # clojurescript (6)
- # core-matrix (23)
- # datomic (85)
- # graalvm (1)
- # honeysql (9)
- # hyperfiddle (31)
- # lsp (3)
- # malli (9)
- # nbb (2)
- # off-topic (15)
- # pathom (15)
- # pedestal (4)
- # polylith (5)
- # re-frame (5)
- # reitit (9)
- # releases (2)
- # shadow-cljs (63)
- # specter (4)
- # xtdb (7)
Dear Calva friends: https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.386 • Fix: https://github.com/BetterThanTomorrow/calva/issues/2287
Just started using clojure.lsp refactoring things.
Also got extra-indents
working.
It seems like refactoring does not go straight to desired indentation.
I need to tab
the form afterwards.
(aaa
(bbb
(ccc)))
clojure-lsp Refactor: Thread Last All
->
(->> (ccc)
bbb
aaa)
<tab>
->
(->> (ccc)
bbb
aaa)
is just one...
had same experience with Clean NS Form
not sure what you mean. what exactly "works" for you?
can you show your flow like I did above?
Not with extra-indents
which is tonsky style
See this thread https://clojurians.slack.com/archives/CBE668G4R/p1692028185570809
got it, so what happens is that clojure-lsp after applies the refactor with hard coded spaces, and the only refactor that we apply formatting is the clean-ns, maybe we should apply it for other refactorings as well
clean-ns also formatted differently than tab
for me
any refactoring should honor the configured/desired indentation
(ns yamlscript.reader
(:use clojure.pprint)
(:require
[clojure.string :as str]
[fr33m0nk.optional :as optional]
[faux-combinator.parser :as fcp])
(:import
(org.snakeyaml.engine.v2.api LoadSettings)
(org.snakeyaml.engine.v2.api.lowlevel Parse)
(org.snakeyaml.engine.v2.common ScalarStyle)
(org.snakeyaml.engine.v2.events
MappingStartEvent
MappingEndEvent
SequenceStartEvent
SequenceEndEvent
ScalarEvent
AliasEvent)))
clean-ns ->
(ns yamlscript.reader
(:use clojure.pprint)
(:require [fr33m0nk.optional :as optional])
(:import (org.snakeyaml.engine.v2.api LoadSettings)
(org.snakeyaml.engine.v2.api.lowlevel Parse)
(org.snakeyaml.engine.v2.events
AliasEvent
MappingEndEvent
MappingStartEvent
ScalarEvent
SequenceEndEvent
SequenceStartEvent)))
tab ->
(:import (org.snakeyaml.engine.v2.api LoadSettings)
(org.snakeyaml.engine.v2.api.lowlevel Parse)
(org.snakeyaml.engine.v2.events
AliasEvent
MappingEndEvent
MappingStartEvent
ScalarEvent
SequenceEndEvent
SequenceStartEvent)))
is what i got in calva
clean-ns has different built-in formatting settings, check the :clean
setting, but I agree most if not all refactors should apply formatting automatically, feel free to open an issue on clojure-lsp
I think this is a calva issue
is cljfmt handled entirely by clojure-lsp?
`Calva: Load Current File and Dependencies` doesn't seem to forget prior evaluations
this is a problem when I'm wondering if my declare
'd fns are right.
if I delete my (declare ...)
stuff and Calva: Load Current File and Dependencies
things should not work, but they do.
if I shut down the repl and restart it, only then does it fail.
This is by design, and not really a Calva thing. The REPL never forgets anything unless you tell it to. 😃 There are ways to tell it, though nothing built in to Calva. You can build them in yourself via custom repl commands https://calva.io/custom-commands/ (Once you know what functions to use.)
Looks like restarting the repl is my friend here
I mean just running jack-in again after a repl is already started
That’s such a boring way to do it. 😃 Generally, it can be very costly, losing your state and could also be time consuming. I think ns-unmap
might be your friend: https://clojuredocs.org/clojure.core/ns-unmap
Guess it depends. I tried for several minutes to get that to work. I agree it should. But for what I'm testing and where I'm at, restarting the repl from calva is my best flow.
Whatever floats your boat. 😃 But @U018D6NKRA4 might have a message for you: https://twitter.com/CarnunMP/status/1692283044139319784?s=20
The issue to solve here is how to make sure your code will one pass compile, and what needs to be declare
d.
The best solution solution would probably be a clojure-lsp Refactor
one.
Hmm. So the problem is to figure out which declare
s can be safely removed without jeopardising future REPL startups... without restarting the REPL? :thinking_face:
What's going wrong with ns-unmap
?
nothing per se. I just had trouble getting it to work in calva
not sure why.
I'll try again now in lein repl
just to verify
How are you evaluating it?
ok this does what I need:
(->> (keys (ns-publics *ns*)) (map #(ns-unmap *ns* %)))
thanks!An lsp refactor action, or linter thing would still be great for getting declare's right, I think.
I'm still an infant in clj
nice!
This is by design, and not really a Calva thing. The REPL never forgets anything unless you tell it to. 😃 There are ways to tell it, though nothing built in to Calva. You can build them in yourself via custom repl commands https://calva.io/custom-commands/ (Once you know what functions to use.)