Closed xiliuya closed 1 year ago
Sorry, I didn't quite understand what's wrong here. How would I reproduce this?
Sorry, I didn't quite understand what's wrong here. How would I reproduce this?
I added the configuration in init-local.el.
(add-hook 'c-mode-common-hook 'eglot-ensure)
Then close all the c files, restart emacs, open C file will pop up this error.
Sorry, I didn't quite understand what's wrong here. How would I reproduce this?
Is my configuration incorrect? But even if I don't use eglot. If I don't comment out the above lines (flymake-flycheck). Opening the c project *Flymake diagnostic gives an error similar to the following: The test project is xv6-riscv
1 9 error ( 'kernel/types.h' file not found [c/c++-clang]
Sorry, I didn't quite understand what's wrong here. How would I reproduce this?
I found that the value of flymake-diagnostic-functions
is different
flymake-check
does not open:
Its value is (eglot-flymake-backend)
When flymake-check
is on:
Its value is
(eglot-flymake-backend #f(compiled-function
(report-fn &rest _)
#<bytecode 0x5319205130afeb4>))
Yeah, I guess it's possible that if some flycheck backends are enabled, then they will be used via flymake-flycheck
alongside eglot
. I'll have a think about how to tackle this. In the meantime you can probably add unwanted flycheck backends to flycheck-disabled-checkers
.
Yeah, I guess it's possible that if some flycheck backends are enabled, then they will be used via
flymake-flycheck
alongsideeglot
. I'll have a think about how to tackle this. In the meantime you can probably add unwanted flycheck backends toflycheck-disabled-checkers
.
It's very effective. Thank you for your help.
(setq-default flycheck-disabled-checkers
(append (default-value 'flycheck-disabled-checkers)
'(c/c++-clang c/c++-gcc c/c++-cppcheck)))
Thanks for confirming that this helped you!
I also want to disable c/c++-clang
and enable eglot-flymake-backend
. I tried to put in init-local.el
(with-eval-after-load 'flycheck (add-to-list 'flycheck-disabled-checkers 'c/c++-clang))
as suggested in the link.
However, it does not work unless I delete (add-hook 'flymake-mode-hook 'flymake-flycheck-auto)
in init-flymake.el
and add it after (add-to-list 'flycheck-disabled-checkers 'c/c++-clang)
in init-local.el
.
I wonder if there is any way to reconcile without modifying anything in init-flymake.el
. I want to keep things synchronized with you and avoid corruption from my changes.
Another things is that after I disable c/c++-clang
in a dirty way, the backend eglot-flymake-backend
cannot be enabled automatically.Executing M-x flymake-running-backends
gives me nothing. I have to execute M-X eglot
in the buffer manually and eglot checker got invoked. Is there suggestions to overcome this step and make things consistent with flymake-flycheck
?
Many thanks!
Edited: It is not necessary to invoke
(add-hook 'flymake-diagnostics-functions 'eglot-flymake-backend nil t)
instead, I have to do
(add-hook 'c++-ts-mode-hook 'eglot-ensure)
(add-hook 'c++-mode-hook 'eglot-ensure)
@yszhang95 Thanks for the info. What do you mean by "the backend eglot-flymake-backend cannot be enabled automatically"? Do you mean when eglot is active in a project, and you open a new buffer, for example? I'm interested in how to reproduce this issue step-by-step specifically, because I'd like to fix it.
Thank you for the quick reply @purcell !
When I tried to prepare for a minimal example to reproduce, I found I have to include
(add-hook 'c++-ts-mode-hook 'eglot-ensure)
(add-hook 'c++-mode-hook 'eglot-ensure)
Sorry for the misleading question. I will update my last comment to avoid misleading others.
The remaining question is the first one, how to avoid corrupting your setup.
Best regards!
This plugin uses eglot and clangd to report the following errors and cannot be checked properly:
Comment out these lines:
init-flymake.el
: 7-22 (when (maybe-require-package 'flymake-flycheck)