Bug 480399 - allow filtering diagnostics by severity / pattern
Summary: allow filtering diagnostics by severity / pattern
Status: RESOLVED WORKSFORME
Alias: None
Product: kate
Classification: Applications
Component: application (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-27 18:23 UTC by Diggory Hardy
Modified: 2024-02-19 06:01 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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"
                        ]
                    }
                }
            }
        }
    }

```