Skip to content

Commit dd54b3a

Browse files
kassickseagle0128
andauthored
feat: provide custom variable for diagnosticSeverityOverrides (#105)
Co-authored-by: Vincent Zhang <[email protected]>
1 parent cefab98 commit dd54b3a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lsp-pyright.el

+14
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,18 @@ Only available in Emacs 27 and above."
163163
:type 'list
164164
:group 'lsp-pyright)
165165

166+
(defcustom lsp-pyright-diagnostic-severity-overrides '()
167+
"Overrides certain rules severity leve l"
168+
:group 'lsp-pyright
169+
:type `(alist :key-type (string :tag "Rule Name")
170+
:value-type (choice
171+
(const :tag "No Error" "none")
172+
(const :tag "Warning""warning")
173+
(const :tag "Information" "information")
174+
(const :tag "Error" "error")
175+
(const :tag "An error is generated" t)
176+
(const :tag "No error is generated" ,json-false))))
177+
166178
(defcustom lsp-pyright-basedpyright-inlay-hints-variable-types t
167179
"Whether to show inlay hints on assignments to variables.
168180
@@ -256,6 +268,8 @@ Current LSP WORKSPACE should be passed in."
256268
(,(concat lsp-pyright-langserver-command ".disableOrganizeImports") lsp-pyright-disable-organize-imports t)
257269
(,(concat lsp-pyright-langserver-command ".disableTaggedHints") lsp-pyright-disable-tagged-hints t)
258270
(,(concat lsp-pyright-langserver-command ".typeCheckingMode") lsp-pyright-type-checking-mode)
271+
(,(concat lsp-pyright-langserver-command ".analysis.diagnosticSeverityOverrides") (lambda () (ht-from-alist lsp-pyright-diagnostic-severity-overrides)))
272+
("python.analysis.diagnosticSeverityOverrides" (lambda () (ht-from-alist lsp-pyright-diagnostic-severity-overrides)))
259273
("basedpyright.analysis.inlayHints.variableTypes" lsp-pyright-basedpyright-inlay-hints-variable-types t)
260274
("basedpyright.analysis.inlayHints.callArgumentNames" lsp-pyright-basedpyright-inlay-hints-call-argument-names t)
261275
("basedpyright.analysis.inlayHints.functionReturnTypes" lsp-pyright-basedpyright-inlay-hints-function-return-types t)

0 commit comments

Comments
 (0)