File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -202,9 +202,7 @@ from the language server."
202
202
203
203
(defvar lsp-diagnostics-mode ) ; ; properly defined by define-minor-mode below
204
204
205
- (defun lsp-diagnostics-flycheck-enable (&rest _ )
206
- " Enable flycheck integration for the current buffer."
207
- (require 'flycheck )
205
+ (defun lsp-diagnostics-lsp-checker-if-needed ()
208
206
(unless (flycheck-valid-checker-p 'lsp )
209
207
(flycheck-define-generic-checker 'lsp
210
208
" A syntax checker using the Language Server Protocol (LSP)
@@ -215,10 +213,15 @@ See https://github.com/emacs-lsp/lsp-mode."
215
213
:predicate (lambda () lsp-diagnostics-mode)
216
214
:error-explainer (lambda (e )
217
215
(lsp-diagnostics-flycheck-error-explainer
218
- e (lsp--workspace-server-id (car-safe (lsp-workspaces)))))))
216
+ e (lsp--workspace-server-id (car-safe (lsp-workspaces))))))))
217
+
218
+ (defun lsp-diagnostics-flycheck-enable (&rest _ )
219
+ " Enable flycheck integration for the current buffer."
220
+ (require 'flycheck )
221
+ (lsp-diagnostics-lsp-checker-if-needed)
219
222
(and (not lsp-diagnostics--flycheck-enabled)
220
- (not (eq flycheck-checker 'lsp ))
221
- (setq lsp-diagnostics--flycheck-checker flycheck-checker))
223
+ (not (eq flycheck-checker 'lsp ))
224
+ (setq lsp-diagnostics--flycheck-checker flycheck-checker))
222
225
(setq-local lsp-diagnostics--flycheck-enabled t )
223
226
(flycheck-mode 1 )
224
227
(flycheck-stop)
Original file line number Diff line number Diff line change @@ -8190,9 +8190,11 @@ This avoids overloading the server with many files when starting Emacs."
8190
8190
8191
8191
(declare-function flycheck-checker-supports-major-mode-p "ext:flycheck")
8192
8192
(declare-function flycheck-add-mode "ext:flycheck")
8193
+ (declare-function lsp-diagnostics-lsp-checker-if-needed "lsp-diagnostics")
8193
8194
8194
8195
(defun lsp-flycheck-add-mode (mode)
8195
8196
"Register flycheck support for MODE."
8197
+ (lsp-diagnostics-lsp-checker-if-needed)
8196
8198
(unless (flycheck-checker-supports-major-mode-p 'lsp mode)
8197
8199
(flycheck-add-mode 'lsp mode)))
8198
8200
You can’t perform that action at this time.
0 commit comments