This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-03
Channels
- # announcements (2)
- # babashka (154)
- # beginners (63)
- # calva (4)
- # cider (2)
- # clara (19)
- # clj-kondo (94)
- # cljfx (8)
- # cljs-dev (6)
- # clojars (2)
- # clojure (82)
- # clojure-australia (1)
- # clojure-europe (134)
- # clojure-italy (4)
- # clojure-nl (5)
- # clojure-serbia (11)
- # clojure-taiwan (1)
- # clojure-uk (39)
- # clojurescript (83)
- # community-development (108)
- # conjure (10)
- # cursive (32)
- # data-oriented-programming (1)
- # datomic (22)
- # defnpodcast (9)
- # depstar (4)
- # docker (3)
- # events (3)
- # figwheel-main (2)
- # funcool (9)
- # graalvm (19)
- # honeysql (23)
- # jackdaw (4)
- # jobs (4)
- # jobs-discuss (2)
- # kaocha (24)
- # leiningen (1)
- # lsp (12)
- # membrane (6)
- # off-topic (21)
- # pathom (13)
- # polylith (1)
- # releases (7)
- # remote-jobs (2)
- # reveal (8)
- # ring (7)
- # sci (2)
- # shadow-cljs (9)
- # sql (10)
- # tools-deps (21)
Is there a way to get cljsjs function resolution to work? For things like (.useState js/React 0)
it is saying that .useState
cannot be resolved.
I did realize that changing it to (js/React.useState 0)
doesn't throw the false positive
But (js/document.getElementById ...)
does throw the false positive
minor thing - dotted aliases get a warning when defining a REPL using deps.edn - it works but it's a bit confusing
aliases are keywords and according to the reader https://clojure.org/reference/reader, "They cannot contain '.' in the name part, or name classes."
:java.lang.String
reduce
and java.lang.String
are both symbols but follow different paths in resolution so class names are special cases. I assume keywords disallow class names for some place where this collides, but I don't actually know where. iow, I'm not totally sure why this restriction exists.
I see, TIL 🙂 I still wonder why the doubling down there matters. If a keyword doesn't contain a period, it cannot be a class name either?
I guess you'd be more likely to run into a problem with destructuring keyword to symbol
(let [{:keys [java.lang.String]} m] ...)
the period restriction I think is primarily intended to push hierarchical naming to namespaces, not in names
That's a good point re :keys
. On that note, which one is more idiomatic, :keys [foo]
or :keys [:foo]
?
the former
keywords were primarily (only?) allowed in :keys originally to support autoresolved keyword resolution
using ::keys
or ::alias/keys
etc is now preferred
but this harder to copy/paste or grep, unfortunately... https://clojurians.slack.com/archives/C0744GXCJ/p1614783163120500?thread_ts=1614780607.115600&cid=C0744GXCJ
so I think that's actually a correct warning
@dnolen some reason you're not using namespaced aliases instead? :my/alias
instead of :my.alias
?
not sure that's actually enforced anywhere
I also recently learned about that restriction. Honestly I think a lot of people are just using this without knowing this restriction. Tracking an issue about that here: https://github.com/clj-kondo/clj-kondo/issues/1179
Hi @cfleming! What is the status of support for navigating to keywords? Mr. @smith.adriane is using namespaced keywords in #membrane for https://github.com/phronmophobic/membrane/issues/16#issuecomment-790070882 (i.e. an intent is [::some-kwd]
and there is (defeffect :the.ns/some-kwd ...)
) is it possible to jump from the former to the latter? is/will there be a general support for that or does Cursive require per-framework extension? Thank you!!!
It looks like https://cursive-ide.com/userguide/macros.html might have an answer. It seems like you can tell cursive how to resolve a symbol for a given macro. There's already built in support for the re-frame macros, I wonder if membrane could piggyback on one of those.
Yes, I think so. I think resolving them as one of the re-frame forms should work. I think I’ll also add a generic keyword def that can be used for this purpose, since the re-frame ones will also affect the icon that’s shown in the structure view etc.
awesome!