Skip to content

Commit 13b92b0

Browse files
authored
Fix defcustom types (#402)
1 parent a1aff85 commit 13b92b0

File tree

1 file changed

+54
-43
lines changed

1 file changed

+54
-43
lines changed

lsp-java.el

Lines changed: 54 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Use http://download.eclipse.org/che/che-ls-jdt/snapshots/che-jdt-language-server
6262
"Java progress status as reported by the language server.")
6363

6464
(defface lsp-java-progress-face
65-
'((t (:inherit 'success)))
65+
'((t (:inherit success)))
6666
"face for activity message"
6767
:group 'lsp-java)
6868

@@ -113,13 +113,17 @@ deduplication with the G1 Garbage collector"
113113
(defcustom lsp-java-errors-incomplete-classpath-severity "warning"
114114
"Specifies the severity of the message when the classpath is
115115
incomplete for a Java file"
116-
:type '(choice (:tag "ignore" "info" "warning" "error"))
116+
:type '(choice (const "ignore")
117+
(const "info")
118+
(const "warning")
119+
(const "error"))
117120
:group 'lsp-java)
118121

119122
(defcustom lsp-java-dependency-package-representation "flat"
120123
"Specifies the severity of the message when the classpath is
121124
incomplete for a Java file"
122-
:type '(choice (:tag "flat" "hierarchical"))
125+
:type '(choice (const "flat")
126+
(const "hierarchical"))
123127
:group 'lsp-java)
124128

125129
(defcustom lsp-java-configuration-check-project-settings-exclusions t
@@ -132,13 +136,17 @@ excluded from the file explorer."
132136
(defcustom lsp-java-configuration-update-build-configuration "automatic"
133137
"Specifies how modifications on build files update the Java
134138
classpath/configuration"
135-
:type '(choice (:tag "disabled" "interactive" "automatic"))
139+
:type '(choice (const "disabled")
140+
(const "interactive")
141+
(const "automatic"))
136142
:group 'lsp-java)
137143

138144
(defcustom lsp-java-trace-server "off"
139145
"Traces the communication between VS Code and the Java language
140146
server."
141-
:type '(choice (:tag "off" "messages" "verbose"))
147+
:type '(choice (const "off")
148+
(const "messages")
149+
(const "verbose"))
142150
:group 'lsp-java)
143151

144152
(defcustom lsp-java-import-gradle-enabled t
@@ -148,7 +156,8 @@ server."
148156

149157
(defcustom lsp-java-import-gradle-version nil
150158
"Gradle version, used if the gradle wrapper is missing or disabled."
151-
:type 'string
159+
:type '(choice (string)
160+
(const nil))
152161
:group 'lsp-java)
153162

154163
(defcustom lsp-java-import-gradle-jvm-arguments nil
@@ -157,7 +166,7 @@ server."
157166
If set manually, this variable has to be converted to a format
158167
that `json-serialize' can understand. For instance, you cannot
159168
pass a list, only a vector."
160-
:type 'lsp-string-vector
169+
:type '(lsp-repeatable-vector string)
161170
:group 'lsp-java)
162171

163172
(defcustom lsp-java-import-gradle-wrapper-enabled t
@@ -192,7 +201,8 @@ pass a list, only a vector."
192201

193202
(defcustom lsp-java-configuration-maven-user-settings nil
194203
"Path to Maven's settings.xml"
195-
:type 'string
204+
:type '(choice (string)
205+
(const nil))
196206
:group 'lsp-java)
197207

198208
(defcustom lsp-java-format-enabled t
@@ -207,18 +217,19 @@ pass a list, only a vector."
207217

208218
(defcustom lsp-java-import-exclusions ["**/node_modules/**" "**/.metadata/**" "**/archetype-resources/**" "**/META-INF/maven/**"]
209219
"Configure glob patterns for excluding folders when importing for the first time"
210-
:type 'lsp-string-vector
220+
:type '(lsp-repeatable-vector string)
211221
:group 'lsp-java)
212222

213223
(defcustom lsp-java-project-resource-filters ["node_modules" ".metadata" "archetype-resources" "META-INF/maven"]
214224
"Configure glob patterns for excluding folders whenever workspace is refreshed"
215-
:type 'lsp-string-vector
225+
:type '(lsp-repeatable-vector string)
216226
:group 'lsp-java)
217227

218228
(defcustom lsp-java-content-provider-preferred nil
219229
"Preferred content provider (a 3rd party decompiler id,
220230
usually)"
221-
:type 'string
231+
:type '(choice (string)
232+
(const nil))
222233
:group 'lsp-java)
223234

224235
(defcustom lsp-java-autobuild-enabled t
@@ -257,14 +268,14 @@ is selected from as list of code assist proposals."
257268
"Defines a list of static members or types with static members.
258269
Content assist will propose those static members even if the
259270
import is missing."
260-
:type 'lsp-string-vector
271+
:type '(lsp-repeatable-vector string)
261272
:group 'lsp-java)
262273

263274
(defcustom lsp-java-completion-import-order ["java" "javax" "com" "org"]
264275
"Defines the sorting order of import statements. A package or
265276
type name prefix (e.g. 'org.eclipse') is a valid entry. An import
266277
is always added to the most specific group."
267-
:type '(repeat string)
278+
:type '(lsp-repeatable-vector string)
268279
:group 'lsp-java)
269280

270281
(defcustom lsp-java-folding-range-enabled t
@@ -283,13 +294,15 @@ processes on the server."
283294
(defcustom lsp-java-format-settings-url nil
284295
"Specifies the url or file path to the [Eclipse formatter xml
285296
settings](https://github.com/redhat-developer/vscode-java/wiki/Formatter-settings)."
286-
:type 'string
297+
:type '(choice (string)
298+
(const nil))
287299
:group 'lsp-java)
288300

289301
(defcustom lsp-java-format-settings-profile nil
290302
"Optional formatter profile name from the Eclipse formatter
291303
settings."
292-
:type 'string
304+
:type '(choice (string)
305+
(const nil))
293306
:group 'lsp-java)
294307

295308
(defcustom lsp-java-format-comments-enabled t
@@ -306,7 +319,7 @@ settings."
306319
(defcustom lsp-java-bundles nil
307320
"List of bundles that will be loaded in the JDT server."
308321
:group 'lsp-java
309-
:type 'list)
322+
:type '(repeat string))
310323

311324
(defcustom lsp-java-code-generation-hash-code-equals-use-java7objects nil
312325
"Use Objects.hash and Objects.equals when generating the
@@ -338,7 +351,10 @@ and equals methods."
338351

339352
(defcustom lsp-java-code-generation-to-string-code-style "STRING_CONCATENATION"
340353
"The code style for generating the toString method."
341-
:type '(choice (:tag "STRING_CONCATENATION" "STRING_BUILDER" "STRING_BUILDER_CHAINED" "STRING_FORMAT"))
354+
:type '(choice (const "STRING_CONCATENATION")
355+
(const "STRING_BUILDER")
356+
(const "STRING_BUILDER_CHAINED")
357+
(const "STRING_FORMAT"))
342358
:group 'lsp-java)
343359

344360
(defcustom lsp-java-code-generation-to-string-skip-null-values nil
@@ -362,7 +378,7 @@ then list all."
362378
matches the selected filter strings will be ignored in content
363379
assist or quick fix proposals and when organizing imports. For
364380
example 'java.awt.*' will hide all types from the awt packages."
365-
:type 'lsp-string-vector
381+
:type '(lsp-repeatable-vector string)
366382
:group 'lsp-java)
367383

368384
(declare-function dap-debug "ext:dap-mode")
@@ -445,23 +461,27 @@ example 'java.awt.*' will hide all types from the awt packages."
445461
"Use Gradle from the specified local installation directory or
446462
GRADLE_HOME if the Gradle wrapper is missing or disabled and no
447463
'java.import.gradle.version' is specified."
448-
:type 'string)
464+
:type '(choice (string)
465+
(const nil)))
449466

450467
(defcustom lsp-java-import-gradle-java-home nil
451468
"The location to the JVM used to run the Gradle daemon."
452-
:type 'string)
469+
:type '(choice (string)
470+
(const nil)))
453471

454472
(defcustom lsp-java-import-gradle-offline-enabled nil
455473
"Enable/disable the Gradle offline mode."
456474
:type 'boolean)
457475

458476
(defcustom lsp-java-import-gradle-arguments nil
459477
"Arguments to pass to Gradle."
460-
:type 'string)
478+
:type '(choice (string)
479+
(const nil)))
461480

462481
(defcustom lsp-java-import-gradle-user-home nil
463482
"Setting for GRADLE_USER_HOME."
464-
:type 'string)
483+
:type '(choice (string)
484+
(const nil)))
465485

466486
(defcustom lsp-java-maven-update-snapshots nil
467487
"Force update of Snapshots/Releases."
@@ -470,8 +490,7 @@ GRADLE_HOME if the Gradle wrapper is missing or disabled and no
470490
(defcustom lsp-java-project-referenced-libraries ["lib/**/*.jar"]
471491
"Configure glob patterns for referencing local libraries to a
472492
Java project."
473-
:type
474-
'(repeat lsp-string-vector))
493+
:type '(lsp-repeatable-vector string))
475494

476495
(defcustom lsp-java-completion-max-results 0
477496
"Maximum number of completion results (not including
@@ -492,11 +511,13 @@ bracket-based smart selection."
492511

493512
(defcustom lsp-java-configuration-runtimes nil
494513
"Map Java Execution Environments to local JDKs."
495-
:type 'lsp-string-vector)
514+
:type '(lsp-repeatable-vector string))
496515

497516
(defcustom lsp-java-server-launch-mode "Hybrid"
498517
"The launch mode for the Java extension"
499-
:type '(choice (:tag "Standard" "LightWeight" "Hybrid")))
518+
:type '(choice (const "Standard")
519+
(const "LightWeight")
520+
(const "Hybrid")))
500521

501522
(defcustom lsp-java-sources-organize-imports-star-threshold 99
502523
"Specifies the number of imports added before a star-import declaration is used."
@@ -507,31 +528,21 @@ bracket-based smart selection."
507528
star-import declaration is used."
508529
:type 'number)
509530

510-
(defun lsp-java--checksum? (candidate)
511-
"Returns true if CANDIDATE is a vector data structure and
512-
every element of it is of type list, else nil."
513-
(and
514-
(vectorp candidate)
515-
(seq-every-p #'consp candidate)))
516-
517-
(define-widget 'lsp-java-checksum-vector 'lazy
518-
"A vector of zero or more elements, every element of which is a
519-
checksum object."
520-
:offset 4
521-
:tag "Checksum Vector"
522-
:type '(restricted-sexp
523-
:match-alternatives (lsp-java--checksum?)))
524-
525531
(defcustom lsp-java-imports-gradle-wrapper-checksums []
526532
"Defines allowed/disallowed SHA-256 checksums of Gradle Wrappers.
527533
528534
Sample value: [(:sha256 \"504b..\" :allowed t)]"
529-
:type 'lsp-java-checksum-vector)
535+
:type '(lsp-repeatable-vector
536+
(plist :key-type (choice (const :tag "sha256" :sha256)
537+
(const :tag "allowed" :allowed))
538+
:value-type (choice string boolean))))
530539

531540
(defcustom lsp-java-project-import-on-first-time-startup "automatic"
532541
"Specifies whether to import the Java projects, when opening
533542
the folder in Hybrid mode for the first time."
534-
:type '(choice (:tag "disabled" "interactive" "automatic")))
543+
:type '(choice (const "disabled")
544+
(const "interactive")
545+
(const "automatic")))
535546

536547
(defcustom lsp-java-project-import-hint t
537548
"Enable/disable the server-mode switch information, when Java

0 commit comments

Comments
 (0)