A lot of Emacs users would prefer to work with flycheck directly instead of lsp-ui. There are a number of reasons for this.
There can be many more reasons listed, but one can see the point. Because of these, it would be much better to have flycheck support within lsp-mode. lsp-ui can provide the additional UI elements for those who need it. But lsp-mode should be a standalone package in itself.
Hi @amol-mandhane,
lsp-ui elements interfere with basic text editing
You can disable all the features and keep only flycheck if you want:
(setq lsp-ui-doc-enable nil
lsp-ui-peek-enable nil
lsp-ui-sideline-enable nil
lsp-ui-imenu-enable nil
lsp-ui-flycheck-enable t)
lsp-ui requires a bit of mouse interactions
When do you need mouse ? I never use it with lsp-ui, the flycheck buffer is still available, with or without lsp-ui
flycheck has moved to lsp-ui because it's a package external to emacs, where lsp-mode is supposed to be merged in some future
lsp-ui-flycheck also interferes with basic editing by overlaying text on top of buffer text. I suppose some users with wide windows find that helpful but a lot of users who use split-windows find the overlays extremely frustrating. There should be options to use all the LSP features without using any LSP UI features (in fact, in Emacs conventions, it should be the default).
If there's a concern about using flycheck and merging LSP to emacs, you can use flymake instead, which is built into Emacs. In Emacs 26, flymake has significant improvements so LSP can use it.
lsp-ui-flycheck doesn't create any overlay. lsp-ui-flycheck is exactly identical to lsp-flycheck when it was in lsp-mode.
If there are overlays in your buffer, they are made by flycheck itself or by another package.
you can use flymake instead
That's another issue. But I think lsp-mode should stay independent from any other packages.
That's what @vibhavp express too in this conversation.
Keep lsp-mode as a simple library is another reason flycheck support was moved out of lsp-mode
lsp-mode already integrates with eldoc, xref, imenu etc. Integration with flymake wouldn't be any different from those. It will make lsp-mode standalone in itself with all the important features that LSP provides.
Flymake support sounds good, given that Emacs 26 has a more extensible flymake API.
i think you can just add another checker in the hook of the mode you wish to customize
here i add mypy flycheck after lsp-ui
(use-package flycheck-mypy
:ensure t
;; :hook (python-mode . flycheck-mode)
:ensure-system-package ((mypy . "pip install mypy")
(monkeytype . "pip install MonkeyType"))
:init
(add-to-list 'flycheck-checkers 'python-mypy t)
:config
(flycheck-define-checker
python-mypy ""
:command ("mypy"
"--ignore-missing-imports"
"--fast-parser"
"--python-version" "3.6"
"--python-executable" "/Users/greg/anaconda/bin/python3.6"
source-original)
:error-patterns
((error line-start (file-name) ":" line ": error:" (message) line-end))
:modes python-mode)
:hook ((python-mode . (lambda()
(flycheck-add-next-checker 'lsp-ui '(t . python-mypy )))))
Closing in faviour of #463 , please reopen if you disagree.
Most helpful comment
Flymake support sounds good, given that Emacs 26 has a more extensible flymake API.