Add ability to disable specific diagnostics#2777
Conversation
Minimal POC for phpactor#2728. Currently doesn't work with WorseReflection diagnostics (e.g. missing return). Signed-off-by: Bart Jaskulski <[email protected]>
|
With this, you can add to your phpactor config: {
"language_server.disabled_diagnostics": [
"fix_namespace_class_name"
]
} |
|
I don't know if there's a reliable way to discover existing diagnostics identifiers right now |
Signed-off-by: Bart Jaskulski <[email protected]>
This reverts commit 8c7da5c.
|
actually think I was rather hasty there. this disables diagnostic providers not diagnostics, would revert in #2780 unless I can quickly fix it. |
|
Well, I could marked it as draft, as I planned on adding tests and other providers to exclude (like mentioned, this did not work with WorseRef extension). Tbh, there's no way to disable specific diagnostic, only it's provider. I assumed it was fine (it's how rules mechanism works e.g. in PhpCodeSniffer), but I can also refactor it to add identifiers for diagnostics and a way for filtering them. Besides, for what I understand, currently there are two levels of diagnostics providers:
And atm you can allow for specific groups to be enabled. As it is a broad scope, it would be nice too to use deny list for unwanted providers (or specific diagnostics). Happy to further discuss it, as it may be my overengineering of related issue problem. |
|
I've had a "quick" (heh, hours) go at adding diagnostic codes to all diagnostics: I think this is the way forward as it's a pretty generic solution... needs a little bit of reflection and change in the language-server package. |
Minimal POC for #2728. Currently doesn't work with WorseReflection diagnostics (e.g. missing return).