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:
@@ -64,5 +64,6 @@ export const servers: ServerConfig[] = [
|
|||||||
args: ["--lsp"],
|
args: ["--lsp"],
|
||||||
rootMarkers: [".oxlintrc.json", "oxlint.config.json"],
|
rootMarkers: [".oxlintrc.json", "oxlint.config.json"],
|
||||||
languageId: "typescript",
|
languageId: "typescript",
|
||||||
|
diagnosticsOnly: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ export function isServerAvailable(server: ServerConfig): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pick Server By File Extension - match[] entries are matched against the
|
// 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 {
|
export function pickServer(filePath: string): ServerConfig {
|
||||||
const ext = path.extname(filePath).replace(/^\./, "");
|
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) {
|
if (!hit) {
|
||||||
throw new UnsupportedExtensionError(`.${ext}`);
|
throw new UnsupportedExtensionError(`.${ext}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ export interface ServerConfig {
|
|||||||
// Idle TTL - Daemon keeps one server alive per (id, rootDir) and evicts
|
// Idle TTL - Daemon keeps one server alive per (id, rootDir) and evicts
|
||||||
// it after this many ms of inactivity. Defaults to 5 minutes.
|
// it after this many ms of inactivity. Defaults to 5 minutes.
|
||||||
idleTtlMs?: number;
|
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
|
// Supported high-level commands exposed via the CLI. Extend this union
|
||||||
|
|||||||
Reference in New Issue
Block a user