Skip to content

Commit 13f400b

Browse files
authored
Fix a number of warnings (#4373)
* lsp-javascript.el: fix incorrect default value in defcustom choices Fixes a warning: lsp-javascript.el:488:12: Warning: in defcustom for ‘lsp-typescript-locale’: ‘nil’ is not a valid type * lsp-mode.el: don't use let* for a single binding `let*` vs `let` are only different in the order of binding the variables, however it doesn't matter when there's just one variable. * lsp-mode.el: remove duplicated `nil` choice in lsp-document-sync-method Worth noting that the two descriptions contradict each other. In the code, the only place where the variable is handled is in `lsp-on-change` function. Specifically, if the variable is nil, it calls `(lsp--workspace-sync-method workspace)` which presumably implies that the description "use method recommended by the lang-server" is the correct one. So remove the other. And while at it, remove the `lsp--sync-none` which was never used. Fixes: lsp-mode.el:489:19: Warning: in defcustom for ‘lsp-document-sync-method’: duplicated value in ‘choice’: ‘nil’ * lsp-mode.el: swap order of :tag and value in defcustom Fixes warning: lsp-mode.el:2150:25: Warning: in defcustom for ‘lsp-progress-function’: misplaced :tag keyword in ‘const’ type * lsp-mode.el: don't quote condition-case handlers And while at it, replace an unused condition-case binding to _err with nil. Fixes warnings: lsp-mode.el:1995:19: Warning: ‘condition-case’ condition should not be quoted: 'quit lsp-mode.el:8686:7: Warning: ‘condition-case’ condition should not be quoted: 'error In lsp--find-root-interactively: lsp-mode.el:8990:7: Warning: ‘condition-case’ condition should not be quoted: 'quit * lsp-diagnostics.el: declare arguments to a `list` in defcustom :type Fixes a warning: lsp-diagnostics.el:68:10: Warning: in defcustom for ‘lsp-diagnostics-attributes’: ‘list’ without arguments
1 parent 802e256 commit 13f400b

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

clients/lsp-javascript.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ TypeScript 2.6.1 or newer in the workspace."
498498
(const "ru")
499499
(const "zh-CN")
500500
(const "zh-TW")
501-
nil)
501+
(const :tag "default" nil))
502502
:package-version '(lsp-mode . "6.1"))
503503

504504
(defcustom lsp-javascript-suggestion-actions-enabled t

lsp-diagnostics.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
List containing (tag attributes) where tag is the LSP diagnostic tag and
6666
attributes is a `plist' containing face attributes which will be applied
6767
on top the flycheck face for that error level."
68-
:type '(repeat list)
68+
:type '(repeat (list symbol plist))
6969
:group 'lsp-diagnostics)
7070

7171
(defcustom lsp-diagnostics-disabled-modes nil

lsp-mode.el

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ level or at a root of an lsp workspace."
459459
:group 'lsp-mode
460460
:package-version '(lsp-mode . "6.3"))
461461

462-
(defconst lsp--sync-none 0)
463462
(defconst lsp--sync-full 1)
464463
(defconst lsp--sync-incremental 2)
465464

@@ -483,8 +482,7 @@ This flag affects only servers which do not support incremental updates."
483482

484483
(defcustom lsp-document-sync-method nil
485484
"How to sync the document with the language server."
486-
:type '(choice (const :tag "Documents should not be synced at all." nil)
487-
(const :tag "Documents are synced by always sending the full content of the document." lsp--sync-full)
485+
:type '(choice (const :tag "Documents are synced by always sending the full content of the document." lsp--sync-full)
488486
(const :tag "Documents are synced by always sending incremental changes to the document." lsp--sync-incremental)
489487
(const :tag "Use the method recommended by the language server." nil))
490488
:group 'lsp-mode)
@@ -1992,9 +1990,9 @@ regex in IGNORED-FILES."
19921990
(let ((number-of-directories (length dirs-to-watch)))
19931991
(or
19941992
(< number-of-directories lsp-file-watch-threshold)
1995-
(condition-case _err
1993+
(condition-case nil
19961994
(lsp--ask-about-watching-big-repo number-of-directories dir)
1997-
('quit)))))
1995+
(quit)))))
19981996
(dolist (current-dir dirs-to-watch)
19991997
(condition-case err
20001998
(progn
@@ -2149,7 +2147,7 @@ PARAMS - the data sent from WORKSPACE."
21492147
(const :tag "Use modeline" lsp-on-progress-modeline)
21502148
(const :tag "Legacy(uses either `progress-reporter' or `spinner' based on `lsp-progress-via-spinner')"
21512149
lsp-on-progress-legacy)
2152-
(const ignore :tag "Ignore")
2150+
(const :tag "Ignore" ignore)
21532151
(function :tag "Other function"))
21542152
:package-version '(lsp-mode . "8.0.0"))
21552153

@@ -4724,9 +4722,9 @@ Added to `before-change-functions'."
47244722
(setq lsp--delayed-requests nil)))))
47254723

47264724
(defun lsp--workspace-sync-method (workspace)
4727-
(let* ((sync (-> workspace
4728-
(lsp--workspace-server-capabilities)
4729-
(lsp:server-capabilities-text-document-sync?))))
4725+
(let ((sync (-> workspace
4726+
(lsp--workspace-server-capabilities)
4727+
(lsp:server-capabilities-text-document-sync?))))
47304728
(if (lsp-text-document-sync-options? sync)
47314729
(lsp:text-document-sync-options-change? sync)
47324730
sync)))
@@ -8685,8 +8683,8 @@ When ALL is t, erase all log buffers of the running session."
86858683
(cl-defmethod lsp-process-send ((process process) message)
86868684
(condition-case err
86878685
(process-send-string process (lsp--make-message message))
8688-
('error (lsp--error "Sending to process failed with the following error: %s"
8689-
(error-message-string err)))))
8686+
(error (lsp--error "Sending to process failed with the following error: %s"
8687+
(error-message-string err)))))
86908688

86918689
(cl-defmethod lsp-process-cleanup (process)
86928690
;; Kill standard error buffer only if the process exited normally.
@@ -8989,7 +8987,7 @@ Select action: "
89898987
(lsp--persist-session session)
89908988
nil)
89918989
(t nil)))
8992-
('quit)))
8990+
(quit)))
89938991

89948992
(declare-function tramp-file-name-host "ext:tramp" (file) t)
89958993
(declare-function tramp-dissect-file-name "ext:tramp" (file &optional nodefault))

0 commit comments

Comments
 (0)