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 <yimingll@users.noreply.github.com>
This commit is contained in:
parent
ec61df8c17
commit
7093583ec5
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user