Make a mage task to generate resolve-as XML from clj-kondo lint-as data (#70342)
This commit is contained in:
10
bb.edn
10
bb.edn
@@ -247,6 +247,14 @@
|
||||
:requires [[mage.util :as u]]
|
||||
:task (task! (u/print-tasks parsed))}
|
||||
|
||||
generate-cursive-resolve-as
|
||||
{:doc "Generate XML configuration for Cursive's symbol resolution based on the current clj-kondo lint-as configuration."
|
||||
:examples [["./bin/mage generate-cursive-resolve-as" "Generate resolve-as XML configuration"]
|
||||
["./bin/mage generate-cursive-resolve-as > /Users/bgrabow/Library/Application\\ Support/JetBrains/IntelliJIdea2025.3/options/ClojureResolveSettings.xml"
|
||||
"Generate resolve-as XML configuration and install it in your global editor configuration"]]
|
||||
:requires [[mage.cursive-resolve-as :as cursive-resolve-as]]
|
||||
:task (task! (cursive-resolve-as/do-it))}
|
||||
|
||||
analytics:setup
|
||||
{:doc "Set up usage analytics development mode"
|
||||
:examples [["./bin/mage analytics:setup" "Enable usage analytics dev mode and import content"]]
|
||||
@@ -302,7 +310,7 @@
|
||||
"If you see 'gh: command not found' or auth errors, run: gh auth login"))
|
||||
:requires [[mage.ci-report :as ci-report]]
|
||||
:task (task! (ci-report/generate-report! parsed))}
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Private Tasks:
|
||||
;; These tasks are more for internal tooling, e.g. for use from git hooks etc.
|
||||
|
||||
20
mage/src/mage/cursive_resolve_as.clj
Normal file
20
mage/src/mage/cursive_resolve_as.clj
Normal file
@@ -0,0 +1,20 @@
|
||||
(ns mage.cursive-resolve-as
|
||||
(:require [clojure.edn :as edn]
|
||||
[clojure.string :as str]))
|
||||
|
||||
(defn clj-kondo-lint-as->cursive-resolve-as
|
||||
[lint-as]
|
||||
(str/join \newline
|
||||
(reduce concat
|
||||
[]
|
||||
[["<application>" " <component name=\"ClojureResolveSettings\">"]
|
||||
(for [[left right] lint-as]
|
||||
(format " <item key=\"%s\" resolves-as=\"%s\" />" left right))
|
||||
[" </component>" "</application>"]])))
|
||||
|
||||
(defn do-it
|
||||
[]
|
||||
(println (clj-kondo-lint-as->cursive-resolve-as
|
||||
(:lint-as (edn/read-string (slurp ".clj-kondo/config.edn"))))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user