From 77e59d0b39cdfce8a93bae435a040a2fd799d3e6 Mon Sep 17 00:00:00 2001 From: Vladislav Annenkov Date: Tue, 7 Jul 2026 23:08:31 +0200 Subject: [PATCH] RIDER-140279 [rider-mcp]: return code-style warnings from get_file_problems/lint_files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The backend error checker protocol expressed severity as a two-valued BackendErrorSeverity (WARNING/ERROR), so after MCP lint switched to the backend error checker channel, ReSharper highlightings below WARNING (HINT/SUGGESTION — e.g. "use var", missing braces) could neither be requested nor transmitted, and get_file_problems(errorsOnly=false) silently dropped them. Widen BackendErrorSeverity to Error/Warning/Suggestion/Hint: a "warning" request now travels as Hint and is filtered on the backend as Severity.HINT, so HINT/SUGGESTION problems are collected and reported as WEAK WARNING. Additionally, honor the new DaemonCustomDataConstants.MinimalSeverityKey in the daemon dispatcher: the error-check daemon runs as SOLUTION_ANALYSIS, where the default SWEA warnings mode (DoNotShowAndDoNotRun) used to raise the minimal severity to ERROR and skip hint-only analyzers entirely. Also extract the platform LintMinSeverity enum into LintFilesRequestSupport and reuse it in RiderAnalysisToolset instead of hardcoded "warning"/"error" severity strings. RIDER-140279 fix IJ-MR-214874 GitOrigin-RevId: 69b6422f1f277efea12b00f31c4c903d6e3bedd2 --- .../toolsets/general/AnalysisToolset.kt | 18 +----------------- .../general/LintFilesRequestSupport.kt | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/plugins/mcp-server/src/com/intellij/mcpserver/toolsets/general/AnalysisToolset.kt b/plugins/mcp-server/src/com/intellij/mcpserver/toolsets/general/AnalysisToolset.kt index c45ae73da494..3e130fec2124 100644 --- a/plugins/mcp-server/src/com/intellij/mcpserver/toolsets/general/AnalysisToolset.kt +++ b/plugins/mcp-server/src/com/intellij/mcpserver/toolsets/general/AnalysisToolset.kt @@ -11,7 +11,6 @@ import com.intellij.build.events.FileMessageEvent import com.intellij.build.events.FinishBuildEvent import com.intellij.build.events.MessageEvent import com.intellij.build.events.StartBuildEvent -import com.intellij.lang.annotation.HighlightSeverity import com.intellij.mcpserver.McpProjectDependenciesProvider import com.intellij.mcpserver.McpServerBundle import com.intellij.mcpserver.McpToolset @@ -109,7 +108,7 @@ class AnalysisToolset : McpToolset { currentCoroutineContext().reportToolActivity(McpServerBundle.message("tool.activity.collecting.file.problems", filePath)) val lintResult = collectLintFiles( filePaths = listOf(filePath), - minSeverityValue = if (errorsOnly) LintMinSeverity.ERROR.apiValue else LintMinSeverity.WARNING.apiValue, + minSeverityValue = LintMinSeverity.fromErrorsOnly(errorsOnly).apiValue, timeout = timeout, progressTitle = McpServerBundle.message("progress.title.analyzing.file", filePath.substringAfterLast('/').substringAfterLast('\\')), ) @@ -571,18 +570,3 @@ class AnalysisToolset : McpToolset { @JvmField val dependencies: List, ) } - -private enum class LintMinSeverity( - @JvmField val apiValue: String, - @JvmField val highlightSeverity: HighlightSeverity, -) { - WARNING("warning", HighlightSeverity.WEAK_WARNING), - ERROR("error", HighlightSeverity.ERROR); - - companion object { - fun parse(value: String): LintMinSeverity { - val normalized = value.trim().lowercase() - return entries.firstOrNull { it.apiValue == normalized } ?: mcpFail("min_severity must be one of: warning, error") - } - } -} diff --git a/plugins/mcp-server/src/com/intellij/mcpserver/toolsets/general/LintFilesRequestSupport.kt b/plugins/mcp-server/src/com/intellij/mcpserver/toolsets/general/LintFilesRequestSupport.kt index 29f129735cb0..b17fcb4ed53b 100644 --- a/plugins/mcp-server/src/com/intellij/mcpserver/toolsets/general/LintFilesRequestSupport.kt +++ b/plugins/mcp-server/src/com/intellij/mcpserver/toolsets/general/LintFilesRequestSupport.kt @@ -1,11 +1,30 @@ package com.intellij.mcpserver.toolsets.general +import com.intellij.lang.annotation.HighlightSeverity import com.intellij.mcpserver.mcpFail import com.intellij.mcpserver.util.projectDirectory import com.intellij.openapi.project.Project import org.jetbrains.annotations.ApiStatus.Internal import java.nio.file.Path +@Internal +enum class LintMinSeverity( + @JvmField val apiValue: String, + @JvmField val highlightSeverity: HighlightSeverity, +) { + WARNING("warning", HighlightSeverity.WEAK_WARNING), + ERROR("error", HighlightSeverity.ERROR); + + companion object { + fun parse(value: String): LintMinSeverity { + val normalized = value.trim().lowercase() + return entries.firstOrNull { it.apiValue == normalized } ?: mcpFail("min_severity must be one of: warning, error") + } + + fun fromErrorsOnly(errorsOnly: Boolean): LintMinSeverity = if (errorsOnly) ERROR else WARNING + } +} + @Internal data class RequestedLintFile( @JvmField val requestedPath: String,