feat(server): add diagnosticsOnly flag for lint-only servers

Add diagnosticsOnly?: boolean to ServerConfig. When set, the server is
excluded from pickServer() (hover/definition/references/completion/
documentSymbol) but still included in pickDiagnosticServers() for
lsp_diagnostics and auto-check.

Mark oxlint as diagnosticsOnly: true — it now contributes diagnostics
alongside typescript-language-server without interfering with navigation
or completion tools.
This commit is contained in:
2026-05-04 07:41:39 -04:00
parent b9808a8b1f
commit e40c93fc80
3 changed files with 7 additions and 2 deletions

View File

@@ -64,5 +64,6 @@ export const servers: ServerConfig[] = [
args: ["--lsp"],
rootMarkers: [".oxlintrc.json", "oxlint.config.json"],
languageId: "typescript",
diagnosticsOnly: true,
},
];

View File

@@ -30,10 +30,10 @@ export function isServerAvailable(server: ServerConfig): boolean {
}
// Pick Server By File Extension - match[] entries are matched against the
// file's extension (no dot). First available server in the registry wins.
// file's extension (no dot). First available, non-diagnosticsOnly server wins.
export function pickServer(filePath: string): ServerConfig {
const ext = path.extname(filePath).replace(/^\./, "");
const hit = servers.find((s) => s.match.includes(ext) && isServerAvailable(s));
const hit = servers.find((s) => s.match.includes(ext) && !s.diagnosticsOnly && isServerAvailable(s));
if (!hit) {
throw new UnsupportedExtensionError(`.${ext}`);
}

View File

@@ -34,6 +34,10 @@ export interface ServerConfig {
// Idle TTL - Daemon keeps one server alive per (id, rootDir) and evicts
// it after this many ms of inactivity. Defaults to 5 minutes.
idleTtlMs?: number;
// Diagnostics Only - When true, this server is excluded from
// hover/definition/references/completion/documentSymbol but included
// in lsp_diagnostics and auto-check.
diagnosticsOnly?: boolean;
}
// Supported high-level commands exposed via the CLI. Extend this union