Fork me on GitHub

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)


Yeah, I meant correctly highlighting the symbols imported from npm deps


I notice Cursive does highlight some js stuff it seems to magically know about


E.g. it knows about js/console


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:


This is correct, Cursive knows about some built-ins (using the ones from Tern: 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.


Since a lot more projects are using it these days.


I’m currently switching over the JS parsing to use the Google Closure JS parser rather than the Rhino one, which has been giving a lot of problems recently.


That's great to hear, cfleming. Thanks!


(where "foo" is in node_modules)


Adding node_modules as src folder doesn't seem to help