This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-10
Channels
- # asami (2)
- # babashka (28)
- # beginners (91)
- # calva (38)
- # cider (7)
- # clj-kondo (20)
- # cljfx (3)
- # clojure (88)
- # clojure-austin (1)
- # clojure-australia (2)
- # clojure-bay-area (10)
- # clojure-europe (68)
- # clojure-france (8)
- # clojure-italy (14)
- # clojure-nl (4)
- # clojure-sanfrancisco (1)
- # clojure-uk (14)
- # clojurescript (37)
- # clojureverse-ops (14)
- # clojurewerkz (1)
- # clr (1)
- # conjure (13)
- # cursive (10)
- # datascript (30)
- # datomic (6)
- # emacs (13)
- # exercism (3)
- # fulcro (10)
- # graalvm (4)
- # graphql (2)
- # instaparse (5)
- # jobs (3)
- # kaocha (10)
- # off-topic (20)
- # pathom (17)
- # polylith (7)
- # re-frame (25)
- # remote-jobs (1)
- # shadow-cljs (60)
- # spacemacs (5)
- # specter (1)
- # startup-in-a-month (1)
- # tools-deps (48)
- # vim (4)
- # xtdb (11)
Thanks for the fix @UKFSJSM38 and @brandon.ringe! There still might be something amiss though? https://github.com/BetterThanTomorrow/calva/issues/1026#issuecomment-776931914
Yeah, this is odd, there is no cache when linting single files anymore so this should work, I'll test it in Emacs and try to reproduce it
It seems like unresolved vars is not working for my project code but maybe working for external deps? I dunno.
I commented on the issue, but I could not make clj-kondo warn about that unknown function too :thinking_face:
So @U04V15CAJ could you help me understand how clj-kondo works for unresolved-var
?
First, I lint the whole src folder to persist on cache with:
clj -Sdeps '{:deps {clj-kondo {:mvn/version "2021.01.21-20210207.143254-18"}}}' -m clj-kondo.main --lint src
then I lint a single file (that should use the cache, right?):
cat test/rewrite_clj/zip_test.cljc | clj -Sdeps '{:deps {clj-kondo {:mvn/version "2021.01.21-20210207.143254-18"}}}' -m clj-kondo.main --lint -
But I get:
<stdin>:10:28: warning: Unresolved var: z/of-string
<stdin>:10:40: warning: Unresolved var: z/unknown
<stdin>:26:26: warning: Unresolved var: z/find-tag-by-pos
<stdin>:27:26: warning: Unresolved var: z/replace
<stdin>:28:26: warning: Unresolved var: z/append-child
<stdin>:29:25: warning: Unresolved var: z/down
<stdin>:30:25: warning: Unresolved var: z/remove
<stdin>:31:25: warning: Unresolved var: z/root-string
<stdin>:47:16: warning: Unresolved var: z/rightmost
<stdin>:48:16: warning: Unresolved var: z/child-sexprs
<stdin>:57:16: warning: Unresolved var: z/up
<stdin>:68:16: warning: Unresolved var: z/right
<stdin>:82:17: warning: Unresolved var: z/insert-child
<stdin>:92:28: warning: Unresolved var: n/map-qualifier-node
<stdin>:106:36: warning: Unresolved var: z/node
<stdin>:106:43: warning: Unresolved var: n/map-context-clear
<stdin>:116:18: warning: Unresolved var: z/sexpr
<stdin>:136:18: warning: Unresolved var: z/reapply-context
linting took 493ms, errors: 0, warnings: 18
this is basically what clojure-lsp does, first lint whole classpath, then every new open file/new changes, lint the single file
so e.g. of-string is imported using some potemkin-like macro. this should need a config
which @lee has here: https://github.com/lread/rewrite-cljc-playground/blob/24a27fbf387e7df4e65c83b469f7bab05ee06673/.clj-kondo/config.edn#L21
yes, he has the same config https://github.com/clj-commons/rewrite-clj/blob/v1/.clj-kondo/config.edn (the repro that I'm using)
so when you lint the project as a whole you get 0 errors, but when you lint 1 file you get unresolved warnings. yeah, that's a clj-kondo issue. feel free to post this specific issue at clj-kondo
it's related to the support we have for potemkin and when you use 1 file, it should load the other ns transitively I think
Got it, I spent too much time on that yesterday, glad to hear is not clojure-lsp' fault
the unresolved var linter is a new addition and it causes false positives in this case, but that's not a regression or anything
it's just a new issue with the unresolved var linter that hasn't been covered yet
yeah, the issue title isn't accurate: the cache is consided for single linted files. it's just something very specific to this potemkin macro
Thanks so much for digging into this and figuring it out @UKFSJSM38 and @U04V15CAJ!
Is there a command which moves the cursor to the last position outside the top level form. In other words, if I am in the middle of comment form, I can evaluate a nested form using alt+enter for calva.evaluateCurrentTopLevelForm. I'd like to be able to move the cursor so that it is at the end of that same evaluated form.
@slack_clojurians The closest you can get is Select Top Level Form, then arrow key right
(or left
to get before the start instead). The chord would be ctrl+alt+w space right
. Change the select shortcut if you find it awkward.
Thank you, this works perfect. I'm using this with the MultiCommand extension and so I now have a way to evaluate several forms in a comment form, one after another, running "calva.evaluateCurrentTopLevelForm", "paredit.rangeForDefun", "cursorRight", "paredit.forwardSexp". Tied to a keybinding, this evaluates one Top Level form and then advances to the next Top Level form in the comment form. I currently used Alt+Shift+Enter to accomplish this, but it looks like in another thread, someone is recommended some other use of that keybinding.