|
1 |
| -{;; User configuration for Clojure LSP |
| 1 | +;; -------------------------------------------------- |
| 2 | +;; Clojure LSP user level (global) configuration |
| 3 | +;; https://clojure-lsp.io/settings/ |
| 4 | +;; |
| 5 | +;; Complete config.edn example with default settings |
| 6 | +;; https://github.com/clojure-lsp/clojure-lsp/blob/master/docs/all-available-settings.edn |
| 7 | +;; -------------------------------------------------- |
| 8 | + |
| 9 | + |
| 10 | +{;; -------------------------------------------------- |
| 11 | + ;; Project analysis |
| 12 | + |
| 13 | + ;; auto-resolved for deps.edn, project.clj or bb.edn projects |
| 14 | + :source-paths #{"src" "test"} |
| 15 | + |
| 16 | + ;; Include :extra-paths and :extra-deps from project & user level aliases in LSP classpath |
| 17 | + :source-aliases #{:dev :test :env/dev :env/test :lib/reloaded} |
| 18 | + |
| 19 | + ;; Define a custom project classpath command, e.g. Clojure CLI |
| 20 | + ;; :project-specs [{:project-path "deps.edn" |
| 21 | + ;; :classpath-cmd ["clojure" "-M:env/dev:env/test" "-Spath"]}] |
| 22 | + :project-specs [] |
| 23 | + |
| 24 | + ;; Additional LSP configurations to load from classpath |
| 25 | + ;; https://clojure-lsp.io/settings/#classpath-config-paths |
| 26 | + :classpath-config-paths [] |
| 27 | + |
| 28 | + ;; Ignore Clojure files within the specified directories |
| 29 | + ;; - i.e ignore build artefacts placed in target or resources directories |
| 30 | + :ignore-classpath-directories false |
| 31 | + |
| 32 | + ;; Watch for classpath changes |
| 33 | + :notify-references-on-file-change true |
| 34 | + :compute-external-file-changes true |
| 35 | + |
| 36 | + ;; Approach for linking dependencies |
| 37 | + :dependency-scheme :zip |
| 38 | + |
| 39 | + ;; generate and analyze stubs for specific namespaces on the project classpath |
| 40 | + ;; typically for closed source dependencies, e.g. datomic.api |
| 41 | + ;; https://clojure-lsp.io/settings/#stub-generation |
| 42 | + :stubs {:generation {:namespaces #{} |
| 43 | + :output-dir ".lsp/.cache/stubs" |
| 44 | + :java-command "java"} |
| 45 | + :extra-dirs []} |
| 46 | + |
| 47 | + ;; Java Sources from Ubuntu package openjdk-17-source |
| 48 | + :java |
| 49 | + {:jdk-source-uri "file:///usr/lib/jvm/openjdk-17/lib/src.zip" ;; |
| 50 | + :home-path nil ;; jdk-source-uri takes precedence |
| 51 | + :download-jdk-source? false} |
| 52 | + |
| 53 | + ;; End of Project analysis |
| 54 | + ;; -------------------------------------------------- |
| 55 | + |
| 56 | + |
| 57 | + ;; -------------------------------------------------- |
| 58 | + ;; Linter configuration |
| 59 | + |
| 60 | + :linters |
2 | 61 |
|
3 |
| - ;; Add develop folder to default source paths |
4 |
| - :source-paths ["src" "test" "develop"] |
| 62 | + ;; clj-kondo Linter rules |
| 63 | + ;; https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#enable-optional-linters |
| 64 | + {:clj-kondo {:level :on |
| 65 | + :report-duplicates true |
| 66 | + :ns-exclude-regex ""}} |
5 | 67 |
|
6 |
| - :source-aliases #{:env/dev :env/test} |
| 68 | + ;; asynchronously lint project files after startup, for features like List project errors |
| 69 | + :lint-project-files-after-startup? true |
7 | 70 |
|
8 |
| - ;; Use meta data when defining private functions |
| 71 | + ;; copy clj-kondo hooks configs exported by libs on classpath during startup |
| 72 | + :copy-kondo-configs? true |
| 73 | + |
| 74 | + ;; End of Linter configuration |
| 75 | + ;; -------------------------------------------------- |
| 76 | + |
| 77 | + |
| 78 | + ;; -------------------------------------------------- |
| 79 | + ;; Refactor code |
| 80 | + |
| 81 | + ;; namespaces |
| 82 | + :clean {:automatically-after-ns-refactor true |
| 83 | + :ns-inner-blocks-indentation :next-line |
| 84 | + :ns-import-classes-indentation :next-line |
| 85 | + :sort {:ns false |
| 86 | + :require false |
| 87 | + :import false |
| 88 | + :import-classes {:classes-per-line 3} ;; -1 for all in single line |
| 89 | + :refer {:max-line-length 80}}} |
| 90 | + |
| 91 | + ;; Automatically add ns form to new Clojure/Script files |
| 92 | + :auto-add-ns-to-new-files? true |
| 93 | + |
| 94 | + ;; use ^private metadata rather than defn- |
9 | 95 | :use-metadata-for-privacy? true
|
10 | 96 |
|
11 |
| - ;; Snippets with $current-form only work when used in front of a form |
12 |
| - ;; otherwise the snippet will not appear in the auto-complete drop-down |
13 |
| - ;; Custom Snippets |
| 97 | + ;; Keep parens around single argument functions in thread macro |
| 98 | + :keep-parens-when-threading? false |
| 99 | + |
| 100 | + ;; End of Refactor code |
| 101 | + ;; -------------------------------------------------- |
| 102 | + |
| 103 | + ;; -------------------------------------------------- |
| 104 | + ;; Clojure formatting configuration - cljfmt |
| 105 | + |
| 106 | + ;; location of cljfmt configuration for formatting |
| 107 | + ;; Path relative to project root or an absolute path |
| 108 | + :cljfmt-config-path "cljfmt.edn" |
| 109 | + |
| 110 | + ;; Specify cljfmt configuration within Clojure LSP configuration file |
| 111 | + :cljfmt {} |
| 112 | + |
| 113 | + ;; End of Clojure formatting configuration - cljfmt |
| 114 | + ;; -------------------------------------------------- |
| 115 | + |
14 | 116 | ;; --------------------------------------------------
|
15 | 117 | ;; LSP snippets
|
16 | 118 | ;; https://clojure-lsp.io/features/#snippets
|
|
49 | 151 | "#_{:clj-kondo/ignore [:redefined-var]}
|
50 | 152 | (comment
|
51 | 153 | $0
|
52 |
| - #_()) ;; End of rich comment"} |
| 154 | + #_()) ; End of rich comment"} |
53 | 155 |
|
54 | 156 | {:name "rich-comment-hotload"
|
55 | 157 | :detail "Rich comment library hotload"
|
|
60 | 162 | (require '[clojure.tools.deps.alpha.repl :refer [add-libs]])
|
61 | 163 | (add-libs '{${1:domain/library-name} {:mvn/version \"${2:1.0.0}\"}$3})
|
62 | 164 | $0
|
63 |
| - #_()) ;; End of rich comment block"} |
| 165 | + #_()) ; End of rich comment block"} |
64 | 166 |
|
65 | 167 | ;; Core functions
|
66 | 168 | {:name "def"
|
|
186 | 288 |
|
187 | 289 | ;; End of LSP snippets
|
188 | 290 | ;; --------------------------------------------------
|
| 291 | + |
| 292 | + ;; -------------------------------------------------- |
| 293 | + ;; Visual LSP components |
| 294 | + |
| 295 | + :code-lens {:segregate-test-references true} |
| 296 | + |
| 297 | + ;; LSP semantic tokens server support for syntax highlighting |
| 298 | + :semantic-tokens? true |
| 299 | + |
| 300 | + ;; Documentation artefacts |
| 301 | + :document-formatting? true |
| 302 | + :document-range-formatting? true |
| 303 | + |
| 304 | + :hover {:hide-file-location? false |
| 305 | + :arity-on-same-line? false |
| 306 | + :clojuredocs true} |
| 307 | + |
| 308 | + ;; End of Visual LSP components |
| 309 | + ;; -------------------------------------------------- |
| 310 | + |
| 311 | + ;; -------------------------------------------------- |
| 312 | + ;; LSP general configuration options |
| 313 | + |
| 314 | + ;; Exit clojure-lsp if any errors found, e.g. classpath scan failure |
| 315 | + :api {:exit-on-errors? true} |
| 316 | + |
| 317 | + ;; Synchronise whole buffer `:full` or only related changes `:incremental` |
| 318 | + :text-document-sync-kind :full |
| 319 | + |
| 320 | + ;; End of LSP general configuration options |
| 321 | + ;; -------------------------------------------------- |
| 322 | + |
| 323 | + ;; -------------------------------------------------- |
| 324 | + ;; File locations |
| 325 | + |
| 326 | + ;; project analysis cache to speed clojure-lsp startup |
| 327 | + ;; relative path to project root or absolute path |
| 328 | + :cache-path ".lsp/.cache" |
| 329 | + |
| 330 | + ;; Absolute path |
| 331 | + :log-path "/tmp/clojure-lsp.*.out" |
| 332 | + |
| 333 | + ;; End of file locations |
| 334 | + ;; -------------------------------------------------- |
| 335 | + } |
0 commit comments