emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.72k stars 860 forks source link

A couple minor fixes for Flymake diagnostics #4435

Open brownts opened 2 months ago

brownts commented 2 months ago

I decided to take a different approach with respect to the default severity level. Instead of adding an additional defcustom for Flymake (which seemed clunky to have two separate configurations for the same thing), I decided to make it more general and elevate it out of lsp-diagnostics to lsp-mode. The reason for this is because there were multiple places that really need this value. The lsp-modeline, lsp-headerline, lsp-mode and lsp-diagnostics all need this information. I also noticed that in those places the absence of the severity provided by the server manifested differently. Some didn't handle it at all (which caused an error to be raised), some ignored it completely, and some hard-coded it as an "error", which might have been inconsistent to the existing Flymake defcustom. Due to the needs outside of the lsp-diagnostics package, I made this more general. Now, any place that needs the severity and it isn't provided, will utilize this defcustom.

On a side note, I have also seen lsp-treemacs cause an error as well, since it's not checking whether the server provided a severity before attempting to use it, but that's another fix in another repo, lol.