From 7093583ec5549e9f5922c2651e95f2b932d1b287 Mon Sep 17 00:00:00 2001 From: yimingll <116444509+yimingll@users.noreply.github.com> Date: Fri, 23 Jan 2026 15:37:40 +0800 Subject: [PATCH] fix(lsp): add data dir to LSP server detection paths (#992) OpenCode downloads LSP servers (like clangd) to ~/.local/share/opencode/bin, but isServerInstalled() only checked ~/.config/opencode/bin. This caused LSP tools to report servers as 'not installed' even when OpenCode had successfully downloaded them. Add ~/.local/share/opencode/bin to the detection paths to match OpenCode's actual behavior. Co-authored-by: yimingll --- src/tools/lsp/config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/lsp/config.ts b/src/tools/lsp/config.ts index 4cf5107c..ac97c90d 100644 --- a/src/tools/lsp/config.ts +++ b/src/tools/lsp/config.ts @@ -2,7 +2,7 @@ import { existsSync, readFileSync } from "fs" import { join } from "path" import { BUILTIN_SERVERS, EXT_TO_LANG, LSP_INSTALL_HINTS } from "./constants" import type { ResolvedServer, ServerLookupResult } from "./types" -import { getOpenCodeConfigDir } from "../../shared" +import { getOpenCodeConfigDir, getDataDir } from "../../shared" interface LspEntry { disabled?: boolean @@ -201,10 +201,12 @@ export function isServerInstalled(command: string[]): boolean { const cwd = process.cwd() const configDir = getOpenCodeConfigDir({ binary: "opencode" }) + const dataDir = join(getDataDir(), "opencode") const additionalBases = [ join(cwd, "node_modules", ".bin"), join(configDir, "bin"), join(configDir, "node_modules", ".bin"), + join(dataDir, "bin"), ] for (const base of additionalBases) {