From e40c93fc80af97fcb9455bfb0affca77b27a56a6 Mon Sep 17 00:00:00 2001 From: Evan Reichard Date: Mon, 4 May 2026 07:41:39 -0400 Subject: [PATCH] feat(server): add diagnosticsOnly flag for lint-only servers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- server.ts | 1 + src/root.ts | 4 ++-- src/types.ts | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server.ts b/server.ts index 9c94c44..b6e78b7 100644 --- a/server.ts +++ b/server.ts @@ -64,5 +64,6 @@ export const servers: ServerConfig[] = [ args: ["--lsp"], rootMarkers: [".oxlintrc.json", "oxlint.config.json"], languageId: "typescript", + diagnosticsOnly: true, }, ]; diff --git a/src/root.ts b/src/root.ts index ae5eb74..09e8edd 100644 --- a/src/root.ts +++ b/src/root.ts @@ -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}`); } diff --git a/src/types.ts b/src/types.ts index 3a529c9..8e1103f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -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