summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuofang.Tang <[email protected]>2026-01-07 01:29:06 +0800
committerGitHub <[email protected]>2026-01-06 11:29:06 -0600
commit8265621d48a13f3f630de880ce568ec04d485f11 (patch)
tree73e7398cf66d10f4ae98dbeb443a7e12287a66b7
parent1016a52cf1c28656ddd5c66689cf97b6d028c2f6 (diff)
downloadopencode-8265621d48a13f3f630de880ce568ec04d485f11.tar.gz
opencode-8265621d48a13f3f630de880ce568ec04d485f11.zip
fix: prevent jdtls path checks from throwing (#7052)
-rw-r--r--packages/opencode/src/lsp/server.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/opencode/src/lsp/server.ts b/packages/opencode/src/lsp/server.ts
index 0e2dba675..e68ed6628 100644
--- a/packages/opencode/src/lsp/server.ts
+++ b/packages/opencode/src/lsp/server.ts
@@ -13,6 +13,7 @@ import { Archive } from "../util/archive"
export namespace LSPServer {
const log = Log.create({ service: "lsp.server" })
+ const pathExists = async (p: string) => fs.stat(p).then(() => true).catch(() => false)
export interface Handle {
process: ChildProcessWithoutNullStreams
@@ -1145,7 +1146,7 @@ export namespace LSPServer {
}
const distPath = path.join(Global.Path.bin, "jdtls")
const launcherDir = path.join(distPath, "plugins")
- const installed = await fs.exists(launcherDir)
+ const installed = await pathExists(launcherDir)
if (!installed) {
if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
log.info("Downloading JDTLS LSP server.")
@@ -1163,7 +1164,7 @@ export namespace LSPServer {
.nothrow()
.then(({ stdout }) => stdout.toString().trim())
const launcherJar = path.join(launcherDir, jarFileName)
- if (!(await fs.exists(launcherJar))) {
+ if (!(await pathExists(launcherJar))) {
log.error(`Failed to locate the JDTLS launcher module in the installed directory: ${distPath}.`)
return
}