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 { join } from "path"
|
||||||
import { BUILTIN_SERVERS, EXT_TO_LANG, LSP_INSTALL_HINTS } from "./constants"
|
import { BUILTIN_SERVERS, EXT_TO_LANG, LSP_INSTALL_HINTS } from "./constants"
|
||||||
import type { ResolvedServer, ServerLookupResult } from "./types"
|
import type { ResolvedServer, ServerLookupResult } from "./types"
|
||||||
import { getOpenCodeConfigDir } from "../../shared"
|
import { getOpenCodeConfigDir, getDataDir } from "../../shared"
|
||||||
|
|
||||||
interface LspEntry {
|
interface LspEntry {
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
@ -201,10 +201,12 @@ export function isServerInstalled(command: string[]): boolean {
|
|||||||
|
|
||||||
const cwd = process.cwd()
|
const cwd = process.cwd()
|
||||||
const configDir = getOpenCodeConfigDir({ binary: "opencode" })
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" })
|
||||||
|
const dataDir = join(getDataDir(), "opencode")
|
||||||
const additionalBases = [
|
const additionalBases = [
|
||||||
join(cwd, "node_modules", ".bin"),
|
join(cwd, "node_modules", ".bin"),
|
||||||
join(configDir, "bin"),
|
join(configDir, "bin"),
|
||||||
join(configDir, "node_modules", ".bin"),
|
join(configDir, "node_modules", ".bin"),
|
||||||
|
join(dataDir, "bin"),
|
||||||
]
|
]
|
||||||
|
|
||||||
for (const base of additionalBases) {
|
for (const base of additionalBases) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user