This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-04
Channels
- # announcements (2)
- # beginners (30)
- # calva (30)
- # cider (10)
- # cljs-dev (4)
- # clojure (59)
- # clojure-nl (2)
- # clojurescript (21)
- # cursive (22)
- # datascript (3)
- # datomic (5)
- # duct (5)
- # figwheel-main (1)
- # flambo (2)
- # fulcro (8)
- # jackdaw (1)
- # joker (9)
- # off-topic (24)
- # pathom (1)
- # re-frame (2)
- # rewrite-clj (4)
- # shadow-cljs (163)
- # sql (14)
- # tools-deps (6)
- # vim (24)
- # yada (3)
I have a "dev-src" alias in my deps.edn in which I keep development time sources and dependencies: :dev-src {:extra-paths ["dev-src"] :extra-deps {org.clojure/tools.namespace {:mvn/version "0.2.11"}}} If I open a file in that "dev-src" IntelliJ IDEA complains that the file "is not under a source root". I can use clojure namespaces defined in that "dev-src", everything works just fine in REPL but there is just that "is not under a source root" IntelliJ IDEA warning in the beginning of the editor window. I can live with that but I was wondering if there is an easy way to disable it?
The warning disappears if I add the "dev-src" to paths: :paths ["src", "dev-src"] , of course. But I understood that with deps.edn paths defines the "production code" and you can define other "extra-paths" using aliases, as creating an alias for development time code (used with REPL) as I did.
You can right click a directory in the project pane, then Mark directory as Sources Root.
@U76D9RZRR In the Clojure Deps toolwindow, open the Aliases tree, select the dev-src
alias there and then refresh your project.
Thanks @U0567Q30W! That solved my problem. I'm also trying to learn how to use Cursive effectively with deps.edn.
I am experimenting with shadow-cljs, and to resolve cljs deps, I am using shadow-cljs pom
, then having intellij import that pom.
Not sure how to get cursive to resolve the npm deps, though.
I.e, things like (:require ["foo" :as bar])
. Is it possible?
I don't think the pom is required. At least, I don't use it - all my dependencies are in deps.edn
, and Cursive knows how to handle it, as well as Shadow CLJS.
By "resolve NPM deps" you mean correct highlighting and declaration following when requiring NPM deps from CLJS files? If so, it's not yet implemented AFAIK.
I am not using deps.edn
(only shadow-cljs.edn
for clj/s deps and package.json for npm deps)
And it knows about e.g. goog.async
(but I guess those are defined in the maven deps somewhere, not in the npm deps)
AFAIK js/console
comes from the built-in externs and goog.async
is probably a dependency of CLJS itself.
Just in case - if you don't want to regenerate the pom each time you change the dependencies, you can just switch to deps.edn
+ shadow-cljs.edn
: https://shadow-cljs.github.io/docs/UsersGuide.html#deps-edn
This is correct, Cursive knows about some built-ins (using the ones from Tern: http://ternjs.net/) and also indexes JS code attached via Maven (e.g. Closure itself).
It doesn’t yet index JS from node_modules or understand the node require syntax, but I’m actually re-vamping the JS parsing right now and hopefully that will make it in as part of this change.