This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # adventofcode (1)
- # announcements (1)
- # beginners (244)
- # calva (20)
- # cider (11)
- # cljs-dev (34)
- # clojure (50)
- # clojure-spec (1)
- # clojure-uk (3)
- # clojurebridge (1)
- # clojurescript (21)
- # code-reviews (1)
- # cursive (19)
- # events (1)
- # expound (1)
- # fulcro (65)
- # hyperfiddle (6)
- # luminus (3)
- # nrepl (3)
- # off-topic (23)
- # protorepl (4)
- # re-frame (18)
- # rum (11)
- # shadow-cljs (77)
- # spacemacs (8)
- # tools-deps (2)
- # unrepl (1)
- # vim (2)
I am just a silent listener. But I think it is necessary to step out of darkness and to let you know that your work is appreciated a lot. I also think it is a very import step in the right direction to make clojure more accessible for beginners. :thumbsup:
@lilactown I just found two bugs with the
enclosing? function. One is that it doesn’t disregard brackets inside strings, a rather tricky problem to solve, I imagine. So:
Another is that it croaks when there is balance at the edges of the range, but unbalance within, but only if it is different kinds of brackets that are balanced/unbalanced. Hmmm, I did not explain that very good… Look at this:
(enclosing? "(\"(\")") => false
(enclosing? "[)]") => Error: IllegalArgumentException Don't know how to create ISeq from: clojure.lang.Reduced clojure.lang.RT.seqFrom (RT.java:550) (enclosing? "]") => false
I’ll try to see if I can see how the latter can be fixed, but I need to start with adding a workaround for when it happens so that I can send out an intermediate fix asap. If you (or anyone else) have some time to look at it, I would love the help. The string issue is somewhat less urgent, but I would be happy to get ideas on how to tackle it. We have both paredit and that AST, after all…
I have updated the repo with tests that expose the above errors:
Testing calva.fmt.util-test ERROR in (enclosing?) (Error:NaN:NaN) expected: (= true (sut/enclosing? "([)")) actual: #object[Error Error: [object Object] is not ISeqable] FAIL in (enclosing?) (cljs-runtime/cljs/test.cljs:475:6) expected: (= true (sut/enclosing? "(\"(\")")) actual: (not (= true false))
That repo is here: https://github.com/BetterThanTomorrow/calva-fmt , if anyone wants to pack PRs.
Also filed two issues about it. Here’s the one about strings: https://github.com/BetterThanTomorrow/calva-fmt/issues/7
I know that for me such a grant doesn’t make sense, since I have a full time job and the grant isn’t big enough for me to afford taking a leave of absence.
@slipset This has been suggested at times. I am happy people think this project is so important. However, my work situation is such that right now is not a good time for applying.
But I think Clojurists Together would be interested in finding ways to support smaller projects with smaller grants.
I have fixed the enclosing problem with brackets in strings and improved the situation with unbalanced expressions inside enclosing list types (returns
false instead of croaking). It’s a bit of a Schrödinger’s fragment anyway, I am not sure if it should answer true or false.
enclosing? function looks like so:
(defn enclosing? [text] (let [ast (cljify (paredit/parse text)) children (:children ast)] (and (= 1 (count children)) (= "list" (:type (first children)))))) (comment (enclosing? "") => false (enclosing? "()") => true (enclosing? "([)") => false (enclosing? "[\"[\"]") => true (enclosing? "(\"[\")") => true (enclosing? "\"foo\"") => false )
Some ideas thrown into a PR here: https://github.com/BetterThanTomorrow/calva/pull/88
Here’s a mystery. Calva Formatter formats the contents of some strings. (It shouldn’t!) I’ve tried with versions from months back and they all do it, so it is nothing new. Here’s an example:
Place the cursor right inside the first paren in the third string and press TAB (assuming default keybindings). It doesn’t happen in the first two strings.
(comment "([\\])" "([\\]\\])" "([\\[\\]\\])")
It’s super late here, @marc-omorain, I’ll have a look at that PR tomorrow. 😃 Sounds good to use TS types to get some hold on the responses.