Skip to content

Commit 10433cb

Browse files
authored
fix(windows): fix jdtls download on Windows (anomalyco#9195)
1 parent 073f9d9 commit 10433cb

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

packages/opencode/src/lsp/server.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,10 +1157,24 @@ export namespace LSPServer {
11571157
await fs.mkdir(distPath, { recursive: true })
11581158
const releaseURL =
11591159
"https://www.eclipse.org/downloads/download.php?file=/jdtls/snapshots/jdt-language-server-latest.tar.gz"
1160-
const archivePath = path.join(distPath, "release.tar.gz")
1161-
await $`curl -L -o '${archivePath}' '${releaseURL}'`.quiet().nothrow()
1162-
await $`tar -xzf ${archivePath}`.cwd(distPath).quiet().nothrow()
1163-
await fs.rm(archivePath, { force: true })
1160+
const archiveName = "release.tar.gz"
1161+
1162+
log.info("Downloading JDTLS archive", { url: releaseURL, dest: distPath })
1163+
const curlResult = await $`curl -L -o ${archiveName} '${releaseURL}'`.cwd(distPath).quiet().nothrow()
1164+
if (curlResult.exitCode !== 0) {
1165+
log.error("Failed to download JDTLS", { exitCode: curlResult.exitCode, stderr: curlResult.stderr.toString() })
1166+
return
1167+
}
1168+
1169+
log.info("Extracting JDTLS archive")
1170+
const tarResult = await $`tar -xzf ${archiveName}`.cwd(distPath).quiet().nothrow()
1171+
if (tarResult.exitCode !== 0) {
1172+
log.error("Failed to extract JDTLS", { exitCode: tarResult.exitCode, stderr: tarResult.stderr.toString() })
1173+
return
1174+
}
1175+
1176+
await fs.rm(path.join(distPath, archiveName), { force: true })
1177+
log.info("JDTLS download and extraction completed")
11641178
}
11651179
const jarFileName = await $`ls org.eclipse.equinox.launcher_*.jar`
11661180
.cwd(launcherDir)

0 commit comments

Comments
 (0)