New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support optional Diagnostic.tags #794
Conversation
|
Thanks, this looks like a very useful feature. I would suggest that we should have faces instead of a defconst here, to make it easier for users to customize this with the full power of customize-option+defface. WDYT? |
Done. |
|
FWIW, The "unnecessary" tag never came up before. |
|
I generally think this PR is good to go (after the usual git commit tweaks maybe). @dgutov can you explain what your suggestion is? How can |
|
Oh yeah, do we want a test for this before merging? Pyright sends the Unused property, and that was how I checked my commit. I'm not at home right now, but I can get around to writing a test by tomorrow. |
|
Ah, sorry. I thought you were going to add "deprecated" support for completions, which is also missing in Eglot. |
|
@leungbk A test case would be useful, I think. |
|
@skangas Done. My test case (requires |
|
Actually...hold on, I need to spend some time debugging the test. |
|
@skangas OK, now it works. I used |
8a6da0c
to
45c3a89
Compare
|
This seems to lead to a byte-compiler warning: |
|
Nice. That just means that the Diagnostic type further up in the file must also be changed, informing Eglot that |
I can't reproduce this with |
Hmm, I can reproduce this consistently... but it seems like I can't reproduce this after restarting Emacs, nor can I reproduce it from |
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#diagnosticTag A DiagnosticTag can be either 1 (DiagnosticTag.Unnecessary) or 2 (DiagnosticTag.Deprecated). Following the rendering suggestions in the protocol, we fade out Unnecessary code and strike-through Deprecated code. * eglot.el (eglot-diagnostic-tag-unnecessary-face) (eglot-diagnostic-tag-deprecated-face): New faces. (eglot--tag-faces): New defconst. (eglot--lsp-interface-alist): Add Diagnostic.tags. (eglot-client-capabilities): Advertise supported tags. (eglot-handle-notification): Assign the appropriate properties. * eglot-tests.el (diagnostic-tags-unnecessary-code): New test.
|
I had to increase the test timeout to 5 seconds, but now everything is working here. I see this diagnostic when replicating the test case manually: So I fixed up the commit message slightly (feel free to take a look at the changes) and merged this to master. Thanks for your contribution! |
This can happen if you |
Yes, Eglot is meant to be compiled, then loaded. If you just interpret it you will get some of that trouble when you do try to compile it. So I recommend always Nice test, btw, @leungbk! Seems very clean. And @skangas now that there's a |
Yup, I'll look into it. |
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#diagnosticTag A DiagnosticTag can be either 1 (DiagnosticTag.Unnecessary) or 2 (DiagnosticTag.Deprecated). Following the rendering suggestions in the protocol, we fade out Unnecessary code and strike-through Deprecated code. * eglot.el (eglot-diagnostic-tag-unnecessary-face) (eglot-diagnostic-tag-deprecated-face): New faces. (eglot--tag-faces): New defconst. (eglot--lsp-interface-alist): Add Diagnostic.tags. (eglot-client-capabilities): Advertise supported tags. (eglot-handle-notification): Assign the appropriate properties. * eglot-tests.el (diagnostic-tags-unnecessary-code): New test.
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#diagnosticTag A DiagnosticTag can be either 1 (DiagnosticTag.Unnecessary) or 2 (DiagnosticTag.Deprecated). Following the rendering suggestions in the protocol, we fade out Unnecessary code and strike-through Deprecated code. * eglot.el (eglot-diagnostic-tag-unnecessary-face) (eglot-diagnostic-tag-deprecated-face): New faces. (eglot--tag-faces): New defconst. (eglot--lsp-interface-alist): Add Diagnostic.tags. (eglot-client-capabilities): Advertise supported tags. (eglot-handle-notification): Assign the appropriate properties. * eglot-tests.el (diagnostic-tags-unnecessary-code): New test.
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#diagnosticTag A DiagnosticTag can be either 1 (DiagnosticTag.Unnecessary) or 2 (DiagnosticTag.Deprecated). Following the rendering suggestions in the protocol, we fade out Unnecessary code and strike-through Deprecated code. * eglot.el (eglot-diagnostic-tag-unnecessary-face) (eglot-diagnostic-tag-deprecated-face): New faces. (eglot--tag-faces): New defconst. (eglot--lsp-interface-alist): Add Diagnostic.tags. (eglot-client-capabilities): Advertise supported tags. (eglot-handle-notification): Assign the appropriate properties. * eglot-tests.el (diagnostic-tags-unnecessary-code): New test. #794: joaotavora/eglot#794
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#diagnosticTag A DiagnosticTag can be either 1 (DiagnosticTag.Unnecessary) or 2 (DiagnosticTag.Deprecated). Following the rendering suggestions in the protocol, we fade out Unnecessary code and strike-through Deprecated code. * eglot.el (eglot-diagnostic-tag-unnecessary-face) (eglot-diagnostic-tag-deprecated-face): New faces. (eglot--tag-faces): New defconst. (eglot--lsp-interface-alist): Add Diagnostic.tags. (eglot-client-capabilities): Advertise supported tags. (eglot-handle-notification): Assign the appropriate properties. * eglot-tests.el (diagnostic-tags-unnecessary-code): New test. GitHub-reference: per joaotavora/eglot#794
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#diagnosticTag A DiagnosticTag can be either 1 (DiagnosticTag.Unnecessary) or 2 (DiagnosticTag.Deprecated). Following the rendering suggestions in the protocol, we fade out Unnecessary code and strike-through Deprecated code. * eglot.el (eglot-diagnostic-tag-unnecessary-face) (eglot-diagnostic-tag-deprecated-face): New faces. (eglot--tag-faces): New defconst. (eglot--lsp-interface-alist): Add Diagnostic.tags. (eglot-client-capabilities): Advertise supported tags. (eglot-handle-notification): Assign the appropriate properties. * eglot-tests.el (diagnostic-tags-unnecessary-code): New test. GitHub-reference: per joaotavora/eglot#794
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#diagnosticTag
A DiagnosticTag can be either 1 (DiagnosticTag.Unnecessary) or
2 (DiagnosticTag.Deprecated). Following the rendering suggestions in
the protocol, we fade out Unnecessary code and strike-through
Deprecated code.
(eglot-client-capabilities): Advertise supported tags.
(eglot-handle-notification): Assign the appropriate properties.