Bug 480399

Summary: allow filtering diagnostics by severity / pattern
Product: [Applications] kate Reporter: Diggory Hardy <kde2>
Component: applicationAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: wishlist CC: christoph, waqar.17a
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Diggory Hardy 2024-01-27 18:23:25 UTC
SUMMARY
***
Request: allow diagnostics to be ignored by [diagnostic severity](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticSeverity) and/or pattern.

Rust supports disabling code at compile-time via feature flags. Its LSP server, rust-analyzer, will report an *information* diagnostic whenever it encounters code which is code which is disabled this way (I find this behaviour dubious, but rust-analyzer is tested against VS Code and is presumably okay there).

In Kate, these diagnostics result in each line of the disabled code section being underlined and an info pop-up on mouse-over anywhere here. This behaviour is useless and distracting. (Even if it were easy enough to switch the current set of feature-flags to enable scanning of this code section, this behaviour would still not be desirable since it is common to need to edit code both with and without some feature, and the current underline is quite ugly for a block of code while the pop-up just gets in the way.)
***


STEPS TO REPRODUCE
1. Set up a project with rust-analyzer
2. Add some code like: #[cfg(feature = "foo")] println("this message is only printed with feature 'foo'");
Comment 1 Waqar Ahmed 2024-02-19 06:01:32 UTC
You can suppress a diagnostic using a pattern, see https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-lspclient.html

Alternatively you can disable on this on the server side:

```
    "lspclient": {
        "servers": {
            "rust": {
                "initializationOptions": {
                    "diagnostics": {
                        "disabled": [
                            "inactive-code"
                        ]
                    }
                }
            }
        }
    }

```