Lsp-mode: Consider keeping flycheck support within `lsp-mode` instead of `lsp-ui`

Created on 20 Mar 2018  路  7Comments  路  Source: emacs-lsp/lsp-mode

A lot of Emacs users would prefer to work with flycheck directly instead of lsp-ui. There are a number of reasons for this.

  • lsp-ui elements interfere with basic text editing on smaller screens where there isn't enough room to show both code and sideline. Same thing happens when I use split windows on a large screen (a very common practice among Emacs users).
  • lsp-ui requires a bit of mouse interactions every now and then. This makes copying error messages considerably difficult as opposed to just copying them from "errors" buffer with regular flycheck.

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.

Most helpful comment

Flymake support sounds good, given that Emacs 26 has a more extensible flymake API.

All 7 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kmdouglass picture kmdouglass  路  3Comments

xendk picture xendk  路  3Comments

mcraveiro picture mcraveiro  路  3Comments

dchneric picture dchneric  路  3Comments

rsuhada picture rsuhada  路  3Comments