RIDER-140279 [rider-mcp]: return code-style warnings from get_file_problems/lint_files

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: 083b40375865c0bfcce79248a47e47884e221a39
This commit is contained in:
Vladislav Annenkov
2026-07-25 08:07:53 +00:00
committed by intellij-monorepo-bot
parent 9642ceb171
commit 2cc618bdfd
2 changed files with 20 additions and 17 deletions
@@ -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<DependencyInfo>,
)
}
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")
}
}
}
@@ -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,