This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-10-13
Channels
- # ai (5)
- # announcements (4)
- # babashka (34)
- # beginners (78)
- # biff (6)
- # calva (41)
- # cider (47)
- # clerk (1)
- # clj-commons (3)
- # clj-http (1)
- # clojure (72)
- # clojure-europe (51)
- # clojure-nl (1)
- # clojure-norway (87)
- # clojure-romania (1)
- # clojure-uk (5)
- # clojuredesign-podcast (2)
- # community-development (1)
- # conjure (2)
- # cursive (11)
- # datomic (6)
- # docker (4)
- # emacs (13)
- # exercism (20)
- # hyperfiddle (56)
- # matrix (6)
- # membrane (4)
- # nbb (11)
- # off-topic (88)
- # pathom (7)
- # pedestal (1)
- # polylith (20)
- # portal (16)
- # practicalli (1)
- # re-frame (13)
- # reagent (4)
- # reitit (2)
- # remote-jobs (7)
- # shadow-cljs (49)
- # sql (4)
Trying to help out our IntelliJ users, i'm getting a lot of unresolved references like here's 2 examples. In both cases the code for this is in bases/foo/src and the dependency for each of these is listed in bases/foo/deps.edn
By design IntelliJ treats every instance deps.edn as a separate module, with its own dependency list, and because we don't specify in inter-component dependencies (e.g. :local/root in one component to another), some of the symbols won't resolve.... when working in components/*/src
Unless i've missed something. I may have a workaround, but it's patching the intellij XML project files.
if you add the inter dependencies like so, that solves it, but tedious to do in the UI
I’ve not used Intellij for a long while now, so I do not know what the exact issue is. @U1G0HH87L, you still use Intellij, do you have any ideas? @U0J3J79FE, there are these two issues that might be related to this: https://github.com/cursive-ide/cursive/issues/2554 https://github.com/cursive-ide/cursive/issues/2828
I don't have these issues. To be honest, I'm not very good at these kind of stuff. The closest to expert I know is @U08BJGV6E.
@U1G0HH87L, Is https://cljdoc.org/d/polylith/clj-poly/0.2.18-SNAPSHOT/doc/development?q=calva#_intellij_idea_with_cursive_setup the latest documentation for the Intellij IDEA setup?
is what i was missing, i had checked the box before, hoping it was the solution I needed, but it was glitching for me, i had to restart IDE to see effect.
hopefully this wasn't too obvious mistake, i searched all your docs for intellij instructions
This is the new clj-doc based documentation that we are currently working on, which matches what's in the master
branch. It hasn't been released yet as 0.2.18
(as you already know @U2BDZ9JG3).
Yeah, I shared the snapshot version of the doc but I agree the search on cljdoc didn’t find anything when I search Intellij. Luckily I knew where it was 😂
There can still be glitches with poly support in Cursive, I think this one I reported last week is somewhat related to Colin's work on poly support https://clojurians.slack.com/archives/C0744GXCJ/p1696509602605699
Yeah, I shared the snapshot version of the doc but I agree the search on cljdoc didn’t find anything when I search Intellij. Luckily I knew where it wasI'm not yet sure what is going on here. I know the search index is cached client-side for a max of 1 day... but... I think that text has been there for a while. I've created an issue for cljdoc https://github.com/cljdoc/cljdoc/issues/847 @U2BDZ9JG3 and @U0J3J79FE, are any cljdoc searches within clj-poly 0.2.18-SNAPSHOT working for you?
@UE21H2HHD Seems to work for me:
Thanks @U04V70XH6! If anybody notices any search issues for clj-poly on cljdoc, please do let me know here or over at #C8V0BQ0M6.
I created a script to patch the IntelliJ project *.iml file, it's not as necessary as I thought it was going to be, but still going to help with new users getting setup. It configures mainly the 'Mark as Sources/Test/Resources Root' and exclusions Here it is if anyone wants it, your mileage will vary. I put this in our build.clj file.
(ns build
(:require
[clojure.core.match :refer [match]]
[clojure.data.xml :as xml]
[clojure.walk :as walk]
[clojure.string :as str]
[clojure.tools.build.api :as b])
(:import
(java.nio.file Paths)
(java.net URI)))
(defn aliases->paths [aliases re]
{:pre [(set? aliases)]}
(disj (->> (b/create-basis {:project "deps.edn", :aliases aliases})
(all-paths )
(filter #(re-matches re %))
(map (fn [p]
(if (str/starts-with? p "/")
(.relativize
(Paths/get (URI. (str "file://" (System/getProperty "user.dir"))))
(Paths/get (URI. (str "file://" p))))
p)))
(into #{}))
"src"))
(defn patch-intellij-module-iml
"Patches intellij *.iml file and automatically annotates/marks which folders are 'Sources Root' and 'Test Sources Root'."
[_]
(->> (xml/parse (java.io.StringReader. (slurp "NAME_OF_PROJECT.iml")))
(walk/postwalk
(fn [form]
(match form
{:tag :content, :attrs {:url "file://$MODULE_DIR$"}, :content _}
{:tag :content
:attrs {:url "file://$MODULE_DIR$"}
:content (interpose "\n"
(concat
(for [p (aliases->paths #{:dev :+repl} #".*src$")]
{:tag :sourceFolder,
:attrs {:url (str "file://$MODULE_DIR$/" p)
:isTestSource "false"}})
(for [p (aliases->paths #{:dev :+repl} #".*resources$")]
{:tag :sourceFolder,
:attrs {:url (str "file://$MODULE_DIR$/" p)
:type "java-resource"}})
(for [p (aliases->paths #{:test} #".*src$")]
{:tag :sourceFolder,
:attrs {:url (str "file://$MODULE_DIR$/" p)
:isTestSource "true"}})
(for [p (aliases->paths #{:test} #".*resources$")]
{:tag :sourceFolder,
:attrs {:url (str "file://$MODULE_DIR$/" p)
:type "java-test-resource"}})
;; excluded
(for [p (concat
[
"/.clj-kondo/"
"/.cpcache/"
"/.dir-locals.el"
"/.dockerignore"
"/.gitignore"
"/.gitlab/"
"/.ignore"
"/.lsp/"
"/.nrepl-port"
"/.projectile"
])]
{:tag :excludeFolder,
:attrs {:url (str "file://$MODULE_DIR$" p)}})))}
;;
:else
form)))
(xml/indent-str)
(str/split-lines)
(remove (comp empty? str/trim))
(map (fn [s] (str/replace s "/>" " />")))
(interpose "\n")
(apply str)
(spit "NAME_OF_PROJECT.iml")))