From 526efd398a721b4733d4a51820dcbe2ce2833ab3 Mon Sep 17 00:00:00 2001 From: Dhruv Manilawala Date: Fri, 28 Jun 2024 09:31:35 +0530 Subject: [PATCH] Remove `E999` to find diagnostic severity (#12080) ## Summary This PR removes the need to check for `E999` code to find the diagnostic severity in the server. **Note:** This is just removing a redundant check because all `ParseErrors` are converted to `Diagnostic` with default `Error` severity by https://github.com/astral-sh/ruff/blob/63c92586a10bfa9b75db9cb87a9ac08618a2ed95/crates/ruff_server/src/lint.rs#L309-L346 ## Test Plan Verify that syntax errors are still shown with error severity as it did before: Screenshot 2024-06-28 at 09 30 20 --- crates/ruff_server/src/lint.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/ruff_server/src/lint.rs b/crates/ruff_server/src/lint.rs index 39b3f54aa3..d3cd8dc9a6 100644 --- a/crates/ruff_server/src/lint.rs +++ b/crates/ruff_server/src/lint.rs @@ -364,8 +364,7 @@ fn severity(code: &str) -> lsp_types::DiagnosticSeverity { match code { // F821: undefined name // E902: IOError - // E999: SyntaxError - "F821" | "E902" | "E999" => lsp_types::DiagnosticSeverity::ERROR, + "F821" | "E902" => lsp_types::DiagnosticSeverity::ERROR, _ => lsp_types::DiagnosticSeverity::WARNING, } }