Skip to content

feat(opencode): add lsp_min_severity config option#17877

Open
KKdev15 wants to merge 1 commit intoanomalyco:devfrom
KKdev15:feat/lsp-min-severity
Open

feat(opencode): add lsp_min_severity config option#17877
KKdev15 wants to merge 1 commit intoanomalyco:devfrom
KKdev15:feat/lsp-min-severity

Conversation

@KKdev15
Copy link
Copy Markdown

@KKdev15 KKdev15 commented Mar 17, 2026

Issue for this PR

Closes #17869

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds a min_severity config option per-LSP server to control the minimum diagnostic severity level shown to the AI agent.

Currently, only Error (severity 1) diagnostics are displayed. Many LSP servers report style violations and linting issues as Warnings (severity 2), which are filtered out. This prevents the AI from seeing and fixing these issues.

With this change, users can configure each LSP to show warnings (or info/hints) by adding min_severity to their LSP config:

{
  "lsp": {
    "markdownlint": {
      "command": ["markdownlint-lsp"],
      "extensions": [".md"],
      "min_severity": 2
    }
  }
}

Severity levels: 1=Error (default), 2=Warning, 3=Info, 4=Hint.

Disclaimer: I would like to contribute this feature, as it's something I would really like to have! This MR was created only using AI. I'm not a TypeScript developer, so please be gentle on me :)

How did you verify your code works?

  • Typecheck passes (bun typecheck)
  • All existing tests pass (1332 pass, 1 unrelated flaky test failure)
  • Added new test file test/lsp/min-severity.test.ts with 10 tests covering:
    • Config schema accepts min_severity per-LSP
    • Config schema validates range (1-4, integers only)
    • LSP.Diagnostic.filter() correctly filters by severity level
  • Locally built opencode and integrated markdownlint-lsp server with the new option min_severity set to 4. Afterwards ask opencode to remove empty lines after headings and show the LSP output with severity. Here's a screenshot of the output, which verifies, that the warning for no empty line around headings (MD022) is actually reported as warning and visible to opencode:
    • to reproduce you have to disable formatter for opencode in your opencode.json, because the formatter automatically adds the newline again... ("formatter": false)
image

Screenshots / recordings

N/A - no UI changes

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 17, 2026
@KKdev15 KKdev15 force-pushed the feat/lsp-min-severity branch from 1c3bf7d to e42fc74 Compare March 17, 2026 01:46
@KKdev15 KKdev15 marked this pull request as draft March 17, 2026 01:49
Add configurable minimum severity level for LSP diagnostics on a
per-LSP basis. This allows users to see warnings, info, and hints
from specific LSP servers, not just errors.

Example config:
{
  "lsp": {
    "markdownlint": {
      "command": ["markdownlint-lsp"],
      "extensions": [".md"],
      "min_severity": 2
    }
  }
}

Closes anomalyco#17869
@KKdev15 KKdev15 force-pushed the feat/lsp-min-severity branch from e42fc74 to 7cd1c5c Compare March 17, 2026 01:59
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Configure minimum LSP diagnostic severity level (show Warnings, not just Errors)

1 participant