fix(migration): make 'lsp' migration guidance self-contained and update stale docs (addresses codex P2 on #4279)

The migration log message previously pointed users to docs/reference/configuration.md for the new LSP config location, but that doc section still showed the obsolete plugin-level 'lsp' block. A user following the guidance would re-add the same 'lsp' key, see it stripped again on next startup, and never reach a usable config.\n\nFix both sides: rewrite the log message so it is self-contained (states the new path .opencode/lsp.json and the consumer directly) and rewrite the LSP section in docs/reference/configuration.md to describe the actual current architecture (LSP served by the 'lsp' MCP server, reading server map from .opencode/lsp.json via LSP_TOOLS_MCP_PROJECT_CONFIG, schema lives in packages/lsp-tools-mcp).\n\nVerification: bun test src/shared/migration/ -> 26/26 pass. bun run typecheck -> exit 0. Manual probe -> migration still strips lsp from both in-memory and persisted file.
This commit is contained in:
MoerAI
2026-05-22 18:10:12 +09:00
parent a7429cc223
commit 6062df8262
2 changed files with 21 additions and 30 deletions
+8 -6
View File
@@ -106,17 +106,19 @@ export function migrateConfigFile(
}
// The legacy `lsp` config key was retired when LSP moved from native plugin
// tools to the `lsp` MCP server backed by `packages/lsp-tools-mcp`. Custom
// LSP servers are now configured via `.opencode/lsp.json` (project) or
// `~/.codex/lsp-client.json` (user). The Zod schema strips unknown keys
// silently, so without this migration a stale `lsp` block lingers in the
// user's config file with no signal that it has stopped doing anything.
// tools to the `lsp` MCP server backed by `packages/lsp-tools-mcp`. The
// server now reads its server map from `.opencode/lsp.json` in the project
// root (path is hard-coded in `src/mcp/lsp.ts` via the
// `LSP_TOOLS_MCP_PROJECT_CONFIG` env var passed to the stdio MCP). The Zod
// schema strips unknown keys silently, so without this migration a stale
// `lsp` block lingers in the user's config file with no signal that it has
// stopped doing anything.
if (copy.lsp !== undefined) {
const droppedServers = copy.lsp && typeof copy.lsp === "object"
? Object.keys(copy.lsp as Record<string, unknown>)
: []
log(
"Removed obsolete 'lsp' config key from config file. LSP servers are now configured via .opencode/lsp.json -- see docs/reference/configuration.md for the new location.",
"Removed obsolete 'lsp' config key from oh-my-opencode config. Custom LSP servers are now configured in .opencode/lsp.json at the project root (consumed by the 'lsp' MCP server). Move any server definitions there to restore them.",
{ configPath, droppedServers },
)
delete copy.lsp