03da2e94a2
Replace the hardcoded 4-server list in doctor LSP check with getAllServers()
from server-resolution.ts, which covers all 40+ builtin servers plus user
config. Output now shows server count with supported extensions, and verbose
mode expands to per-server detail lines.
Status: LSP 3 servers (.go, .py, .pyi, .ts, .tsx)
Verbose: LSP 3 servers (.go, .py, .pyi, .ts, .tsx)
typescript (.ts, .tsx, .js, .jsx)
pyright (.py, .pyi)
gopls (.go)
Closes #2587
38 lines
1.6 KiB
TypeScript
38 lines
1.6 KiB
TypeScript
import color from "picocolors"
|
|
import type { DoctorResult } from "./types"
|
|
import { formatHeader, formatStatusMark } from "./format-shared"
|
|
|
|
export function formatStatus(result: DoctorResult): string {
|
|
const lines: string[] = []
|
|
|
|
lines.push(formatHeader())
|
|
|
|
const { systemInfo, tools } = result
|
|
const padding = " "
|
|
|
|
const opencodeVer = systemInfo.opencodeVersion ?? "unknown"
|
|
const pluginVer = systemInfo.pluginVersion ?? "unknown"
|
|
const bunVer = systemInfo.bunVersion ?? "unknown"
|
|
lines.push(` ${padding}System ${opencodeVer} · ${pluginVer} · Bun ${bunVer}`)
|
|
|
|
const configPath = systemInfo.configPath ?? "unknown"
|
|
const configStatus = systemInfo.configValid ? color.green("(valid)") : color.red("(invalid)")
|
|
lines.push(` ${padding}Config ${configPath} ${configStatus}`)
|
|
|
|
const serverCount = tools.lspServers.length
|
|
const lspMark = formatStatusMark(serverCount > 0)
|
|
const lspText = serverCount > 0 ? `${serverCount} server${serverCount === 1 ? "" : "s"}` : "none"
|
|
const astGrepMark = formatStatusMark(tools.astGrepCli)
|
|
const ghMark = formatStatusMark(tools.ghCli.installed && tools.ghCli.authenticated)
|
|
const ghUser = tools.ghCli.username ?? ""
|
|
lines.push(` ${padding}Tools LSP ${lspMark} ${lspText} · AST-Grep ${astGrepMark} · gh ${ghMark}${ghUser ? ` (${ghUser})` : ""}`)
|
|
|
|
const builtinCount = tools.mcpBuiltin.length
|
|
const userCount = tools.mcpUser.length
|
|
const builtinText = builtinCount > 0 ? tools.mcpBuiltin.join(" · ") : "none"
|
|
const userText = userCount > 0 ? `+ ${userCount} user` : ""
|
|
lines.push(` ${padding}MCPs ${builtinText} ${userText}`)
|
|
|
|
return lines.join("\n")
|
|
}
|