Closed guibor closed 7 months ago
How was syntax-checking-enabled-by-default
set to nil
?
In my testing setting this to nil
early on is the key. If set early on, e.g., beginning of init.el
, then flycheck-mode
is not enabled. More specifically if this is set to nil
prior to (configuration-layer/load)
line, then flycheck-mode
is not enabled.
I think we have a race condition in that syntax-checking-enable-by-default
is referenced before it is set. As far as I can tell flycheck-mode
is enabled by the following code.
(defun spacemacs/enable-flycheck (mode)
"Use flycheck in MODE by default, if `syntax-checking-enable-by-default' t."
(when (and syntax-checking-enable-by-default
(listp flycheck-global-modes)
(not (eq 'not (car flycheck-global-modes))))
(add-to-list 'flycheck-global-modes mode)))
When this function is called, syntax-checking-enable-by-default
is t
rather than nil
unless it is set to nil
early enough.
Perhaps. I wonder if it's not related to lsp
?
I think this is the culprit: lsp-mode-20230812.1018/lsp-diagnostics.el:240: (add-hook 'lsp-managed-mode-hook #'lsp-diagnostics--flycheck-report nil t))
This essentially makes all the flycheck
setup meaningless if lsp
is used (which is default for Python
).
Update: Removing the hook doesn't seem to help
Please ignore my previous comments. I cannot reproduce my previous results!
I tested all over again using a vanilla startup file. syntax-checking-enabled-by-default seems to be working as expected, i.e., global-flycheck-mode has the same value as syntax-checking-enabled-by-default within python buffers. This is the case whether lsp is used or not.
Hi, one possible option is to (setq lsp-diagnostics-provider :none)
.
Basically in practice the default lsp provider in lsp is flycheck
and as a result this activates flycheck even the user disabled it. I would consider dealing with this, because the outcome was unexpected to me as a user.
I have added some clarifying comments to the lsp layer. I don't think that we can safely limit the IDE features the LSP layer provides i.e. even if someone does not want to have flycheck in place lsp may use a different provider like flymake to do its job.
If only a part of the IDE feature should be used user's are expected to do manual configuration in there dotfile, the standard use-case should be the full range of IDE features.
Description :octocat:
Flycheck is enabled by default
Reproduction guide :beetle:
In
python-mode
, despite my having configuredsyntax-checking-enabled-by-default
to nil (and as a resultglobal-flycheck-mode
is off),flycheck-mode
is on in Python-mode. In order to solve, I need to explicitly(add-hook 'python-mode-hook (lambda () (flycheck-mode -1)))
python
bufferObserved behaviour: :eyes: :broken_heart:
flycheck-mode
is onExpected behaviour: :heart: :smile:
flycheck mode
if offSystem Info :computer:
Backtrace :paw_prints: