Open jonmoore opened 10 months ago
I am seeing the same error in a LaTeX file. I am using a clean environment using the following command: M-x lsp-start-plain
.
Steps to reproduce:
\documentclass{article}
\begin{document}
\section{One section}
\label{sec:one-section}
\end{document}
(package-initialize)
M-x lsp-start-plain
find-file
the above LaTeX filelsp
. I am using the latest (5.13.0) texlab:
LSP :: Connected to [texlab2:1806426/starting /home/ramon/tmp].
LSP :: texlab2:1806426 initialized successfully in folders: (/home/ramon/tmp
Invalid face reference: lsp-flycheck-info-unnecessary [131 times]
While editing Python files when using lsp-mode together with pyright, lsp-ui, lsp-ui-sideline and flycheck, warning messages like "Invalid face reference: lsp-flycheck-info-unnecessary" occur repeatedly in the "*Messages*" buffer.
This can be seen by e.g. creating a buffer with an unused import, saving it, and moving the cursor on and off the import line when the sideline is in use.
It occurs because lsp-flycheck-info-unnecessary is not a face (the corresponding face is lsp-flycheck-info-unnecessary-face) but is treated as such by lsp-ui-sideline--diagnostics.
Both are generated by lsp--diagnostics-flycheck-level, which generates a "level" from an original flycheck level (e.g. 'error, 'warning) and a list of tags.
Some of the levels returned from lsp-diagnostics--flycheck-calculate-level are themselves faces but those constructed with tags are not.
However lsp-ui-sideline--diagnostics may set a face variable directly from such a level and pass it to add-face-text-property. https://github.com/emacs-lsp/lsp-ui/blob/0dd39900c8ed8145d207985cb2f65cedd1ffb410/lsp-ui-sideline.el#L469-L474
When that occurs this triggers an "Invalid face" warnings. This can be fixed by replacing https://github.com/emacs-lsp/lsp-ui/blob/0dd39900c8ed8145d207985cb2f65cedd1ffb410/lsp-ui-sideline.el#L470
by
Related from lsp-mode