-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
config.edn
384 lines (300 loc) · 11.8 KB
/
config.edn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
;; ---------------------------------------------------------
;; Clojure LSP user level (global) configuration
;; https://clojure-lsp.io/settings/
;;
;; Complete config.edn example with default settings
;; https://github.com/clojure-lsp/clojure-lsp/blob/master/docs/all-available-settings.edn
;; default key/value are in comments
;; ---------------------------------------------------------
;; Refact config from all-available-settings example
{;; ---------------------------------------------------------
;; Project analysis
;; auto-resolved for deps.edn, project.clj or bb.edn projects
;; :source-paths #{"src" "test"}
;; Include :extra-paths and :extra-deps from project & user level aliases in LSP classpath
;; :source-aliases #{:dev :test}
:source-aliases #{:dev :test :dev/env :dev/reloaded}
;; Define a custom project classpath command, e.g. Clojure CLI
;; :project-specs [{:project-path "deps.edn"
;; :classpath-cmd ["clojure" "-M:env/dev:env/test" "-Spath"]}]
;; Check the default at clojure-lsp.classpath/default-project-specs
;; :project-specs []
;; ignore analyzing/linting specific paths
:source-paths-ignore-regex ["target.*" "build.*" "console-log-.*"]
;; Additional LSP configurations to load from classpath
;; https://clojure-lsp.io/settings/#classpath-config-paths
;; :classpath-config-paths []
;; :paths-ignore-regex []
;; Watch for classpath changes
;; :notify-references-on-file-change true
;; :compute-external-file-changes true
;; Approach for linking dependencies
;; :dependency-scheme "zipfile"
;; generate and analyze stubs for specific namespaces on the project classpath
;; typically for closed source dependencies, e.g. datomic.api
;; https://clojure-lsp.io/settings/#stub-generation
;; :stubs {:generation {:namespaces #{}
;; :output-dir ".lsp/.cache/stubs"
;; :java-command "java"}
;; :extra-dirs []}
;; Java Sources from Ubuntu package openjdk-17-source
;; jdk-source-uri takes precedence
;; :java
;; {:jdk-source-uri "https://raw.githubusercontent.com/clojure-lsp/jdk-source/main/openjdk-19/reduced/source.zip"
;; :home-path nil ;; jdk-source-uri takes precedence
;; :download-jdk-source? false
;; :decompile-jar-as-project? true}
;; :java
;; {:jdk-source-uri "file:///usr/lib/jvm/openjdk-17/lib/src.zip"}
:java nil
;; End of Project analysis
;; ---------------------------------------------------------
;; ---------------------------------------------------------
;; Linter configuration
;; clj-kondo Linter rules
;; https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#enable-optional-linters
;; :linters {:clj-kondo {:level :on
;; :report-duplicates true
;; :ns-exclude-regex ""}
;; :clj-depend {:level :info}} ;; Only if any clj-depend config is found
;; asynchronously lint project files after startup, for features like List project errors
;; :lint-project-files-after-startup? true
;; copy clj-kondo hooks configs exported by libs on classpath during startup
;; :copy-kondo-configs? true
;; End of Linter configuration
;; ---------------------------------------------------------
;; ---------------------------------------------------------
;; Refactor code
;; Namespace format
;; :clean {:automatically-after-ns-refactor true
;; :ns-inner-blocks-indentation :next-line
;; :ns-import-classes-indentation :next-line
;; :sort {:ns true
;; :require true
;; :import true
;; :import-classes {:classes-per-line 3} ;; -1 for all in single line
;; :refer {:max-line-length 80}}}
;; Do not sort namespaces
:clean {sort {:ns false
:require false
:import false}}
;; Automatically add ns form to new Clojure/Script files
;; :auto-add-ns-to-new-files? true
;; use ^private metadata rather than defn-
;; :use-metadata-for-privacy? false
:use-metadata-for-privacy? true
;; Keep parens around single argument functions in thread macro
;; :keep-parens-when-threading? false
:keep-parens-when-threading? true
;; End of Refactor code
;; ---------------------------------------------------------
;; ---------------------------------------------------------
;; Clojure formatting configuration - cljfmt
;; location of cljfmt configuration for formatting
;; Path relative to project root or an absolute path
;; :cljfmt-config-path ".cljfmt.edn"
:cljfmt-config-path "cljfmt.edn"
;; Specify cljfmt configuration within Clojure LSP configuration file
;; :cljfmt {}
;; End of Clojure formatting configuration - cljfmt
;; ---------------------------------------------------------
;; ---------------------------------------------------------
;; Visual LSP components
;; :hover {:hide-file-location? false
;; :arity-on-same-line? false
;; :clojuredocs true}
;; :completion {:additional-edits-warning-text nil
;; :analysis-type :fast-but-stale}
;; :code-lens {:segregate-test-references true}
;; LSP semantic tokens server support for syntax highlighting
;; :semantic-tokens? true
;; Documentation artefacts
;; :document-formatting? true
;; :document-range-formatting? true
;; End of Visual LSP components
;; ---------------------------------------------------------
;; ---------------------------------------------------------
;; LSP general configuration options
;; Exit clojure-lsp if any errors found, e.g. classpath scan failure
;; :api {:exit-on-errors? true}
;; Synchronise whole buffer `:full` or only related changes `:incremental`
;; :text-document-sync-kind :full
;; End of LSP general configuration options
;; ---------------------------------------------------------
;; ---------------------------------------------------------
;; File locations
;; project analysis cache to speed clojure-lsp startup
;; relative path to project root or absolute path
;; :cache-path ".lsp/.cache"
;; Absolute path
;; :log-path "/tmp/clojure-lsp.*.out"
;; End of file locations
;; ---------------------------------------------------------
;; ---------------------------------------------------------
;; LSP snippets
;; https://clojure-lsp.io/features/#snippets
:additional-snippets
[;; Documentation / comments
{:name "comment-heading"
:detail "Comment Header"
:snippet
";; ---------------------------------------------------------
;; ${1:Heading summary title}
;;
;; ${2:Brief description}\n;; ---------------------------------------------------------\n\n$0"}
{:name "comment-separator"
:detail "Comment Separator"
:snippet
";; ---------------------------------------------------------\n;; ${1:Section title}\n\n$0"}
{:name "comment-section"
:detail "Comment Section"
:snippet
";; ---------------------------------------------------------\n;; ${1:Section title}\n\n$0\n\n
;; End of $1\n;; ---------------------------------------------------------\n\n"}
{:name "wrap-reader-comment"
:detail "Wrap current expression with Comment Reader macro"
:snippet "#_$current-form"}
{:name "rich-comment"
:detail "Create rich comment"
:snippet
"(comment
$0
#_()) ;; End of rich comment"}
{:name "rich-comment-rdd"
:detail "Create comment block"
:snippet
"#_{:clj-kondo/ignore [:redefined-var]}
(comment
$0
#_()) ; End of rich comment"}
{:name "rich-comment-hotload"
:detail "Rich comment library hotload"
:snippet
"#_{:clj-kondo/ignore [:redefined-var]}
(comment
;; Add-lib library for hot-loading
(require '[clojure.tools.deps.alpha.repl :refer [add-libs]])
(add-libs '{${1:domain/library-name} {:mvn/version \"${2:1.0.0}\"}$3})
$0
#_()) ; End of rich comment block"}
{:name "wrap-rich-comment"
:detail "Wrap current expression with rich comment form"
:snippet
"(comment
$current-form
$0
#_()) ;; End of rich comment"}
;; Core functions
{:name "def"
:detail "def with docstring"
:snippet "(def ${1:name}\n \"${2:doc-string}\"\n $0)"}
{:name "def-"
:detail "def private"
:snippet "(def ^:private ${1:name}\n \"${2:doc-string}\"\n $0)"}
{:name "defn"
:detail "Create public function"
:snippet "(defn ${1:name}\n \"${2:doc-string}\"\n [${3:args}]\n $0)"}
{:name "defn-"
:detail "Create public function"
:snippet "(defn ^:private ${1:name}\n \"${2:docstring}\"\n [${3:args}]\n $0)"}
{:name "ns"
:detail "Create ns"
:snippet "(ns ${1:name}\n \"${2:doc-string}\"\n ${3:require})"}
;; Clojure CLI alias snippets
{:name "deps-alias"
:detail "deps.edn alias with extra path & deps"
:snippet
":${1:category/name}
{:extra-paths [\"${2:path}\"]
:extra-deps {${3:deps-maven or deps-git}}}$0"}
{:name "deps-alias-main"
:detail "deps.edn alias with extra path & deps"
:snippet
":${1:category/name}
{:extra-paths [\"${2:path}\"]
:extra-deps {${3:deps-maven or deps-git}}
:main-opts [\"-m\" \"${4:main namespace}\"]}$0"}
{:name "deps-alias-exec"
:detail "deps.edn alias with extra path & deps"
:snippet
":${1:category/name}
{:extra-paths [\"${2:path}\"]
:extra-deps {${3:deps-maven or deps-git}}
:exec-fn ${4:domain/function-name}
:exec-args {${5:key value}}}$0"}
{:name "deps-alias-main-exec"
:detail "deps.edn alias with extra path & deps"
:snippet
":${1:category/name}
{:extra-paths [\"${2:path}\"]
:extra-deps {${3:deps-maven or deps-git}}
:main-opts [\"-m\" \"${4:main namespace}\"]
:exec-fn ${4:domain/function-name}
:exec-args {${5:key value}}}$0"}
{:name "deps-maven"
:detail "deps.edn Maven dependency"
:snippet
"${1:domain/library-name} {:mvn/version \"${2:1.0.0}\"}$0"}
{:name "deps-git"
:detail "deps.edn Git dependency"
:snippet
"${1:domain/library-name}
{:git/sha \"${2:git-sha-value}\"}$0"}
{:name "deps-git-tag"
:detail "Git dependency"
:snippet
"${1:domain/library-name}
{:git/tag \"${2:git-tag-value}\"
:git/sha \"${3:git-sha-value}\"}$0"}
{:name "deps-git-url"
:detail "Git URL dependency"
:snippet
"${1:domain/library-name}
{:git/url \"https://github.com/$1\"
:git/sha \"${2:git-sha-value}\"}$0"}
{:name "deps-local"
:detail "deps.edn Maven dependency"
:snippet
"${1:domain/library-name} {:local/root \"${2:/path/to/project/root}\"}$0"}
;; Requiring dependency snippets
{:name "require-rdd"
:detail "require for rich comment experiments"
:snippet "(require '[${1:namespace} :as ${2:alias}]$3)$0"}
{:name "require"
:detail "ns require"
:snippet "(:require [${1:namespace}])$0"}
{:name "require-refer"
:detail "ns require with :refer"
:snippet "(:require [${1:namespace} :refer [$2]]$3)$0"}
{:name "require-as"
:detail "ns require with :as alias"
:snippet "(:require [${1:namespace} :as ${2:alias}]$3)$0"}
{:name "use"
:detail "require refer preferred over use"
:snippet "(:require [${1:namespace} :refer [$2]])$0"}
;; Unit Test snippets
{:name "deftest"
:detail "deftest clojure.test"
:snippet
"(deftest ${1:name}-test
(testing \"${2:Context of the test assertions}\"
(is (= ${3:assertion-values}))$4)) $0"}
{:name "testing"
:detail "testing asserting group for clojure.test"
:snippet "(testing \"${1:description-of-assertion-group}\"\n $0)"}
{:name "is"
:detail "assertion for clojure.test"
:snippet "(is (= ${1:function call} ${2:expected result}))$0"}
;; ---------------------------------------------------------
;; Clojure LSP and Clj-kondo snippets
{:name "lsp-ignore-redefined"
:detail "Ignore redefined Vars"
:snippet
"#_{:clj-kondo/ignore [:redefined-var]}
$0"}
;; End of Clojure LSP and Clj-kondo snippets
;; ---------------------------------------------------------
]
;; End of LSP snippets
;; ---------------------------------------------------------
}