Skip to content

Commit e4c4bf4

Browse files
[Kotlin LSP] Do not download extra Java. (#1079)
The language server is already bundled with a JRE
1 parent 2e2c7bd commit e4c4bf4

File tree

1 file changed

+2
-55
lines changed

1 file changed

+2
-55
lines changed

src/solidlsp/language_servers/kotlin_language_server.py

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -53,40 +53,6 @@
5353
"osx-arm64": "mac-aarch64",
5454
}
5555

56-
# Java runtime dependency information per platform
57-
JAVA_DEPENDENCIES = {
58-
"win-x64": {
59-
"url": "https://github.com/redhat-developer/vscode-java/releases/download/v1.42.0/java-win32-x64-1.42.0-561.vsix",
60-
"archiveType": "zip",
61-
"java_home_path": "extension/jre/21.0.7-win32-x86_64",
62-
"java_path": "extension/jre/21.0.7-win32-x86_64/bin/java.exe",
63-
},
64-
"linux-x64": {
65-
"url": "https://github.com/redhat-developer/vscode-java/releases/download/v1.42.0/java-linux-x64-1.42.0-561.vsix",
66-
"archiveType": "zip",
67-
"java_home_path": "extension/jre/21.0.7-linux-x86_64",
68-
"java_path": "extension/jre/21.0.7-linux-x86_64/bin/java",
69-
},
70-
"linux-arm64": {
71-
"url": "https://github.com/redhat-developer/vscode-java/releases/download/v1.42.0/java-linux-arm64-1.42.0-561.vsix",
72-
"archiveType": "zip",
73-
"java_home_path": "extension/jre/21.0.7-linux-aarch64",
74-
"java_path": "extension/jre/21.0.7-linux-aarch64/bin/java",
75-
},
76-
"osx-x64": {
77-
"url": "https://github.com/redhat-developer/vscode-java/releases/download/v1.42.0/java-darwin-x64-1.42.0-561.vsix",
78-
"archiveType": "zip",
79-
"java_home_path": "extension/jre/21.0.7-macosx-x86_64",
80-
"java_path": "extension/jre/21.0.7-macosx-x86_64/bin/java",
81-
},
82-
"osx-arm64": {
83-
"url": "https://github.com/redhat-developer/vscode-java/releases/download/v1.42.0/java-darwin-arm64-1.42.0-561.vsix",
84-
"archiveType": "zip",
85-
"java_home_path": "extension/jre/21.0.7-macosx-aarch64",
86-
"java_path": "extension/jre/21.0.7-macosx-aarch64/bin/java",
87-
},
88-
}
89-
9056

9157
class KotlinLanguageServer(SolidLanguageServer):
9258
"""
@@ -135,32 +101,13 @@ def _get_or_install_core_dependency(self) -> str:
135101
kotlin_suffix = PLATFORM_KOTLIN_SUFFIX.get(platform_id.value)
136102
assert kotlin_suffix, f"Unsupported platform for Kotlin LSP: {platform_id.value}"
137103

138-
java_dependency = JAVA_DEPENDENCIES[platform_id.value]
139-
140104
# Setup paths for dependencies
141105
static_dir = os.path.join(self._ls_resources_dir, "kotlin_language_server")
142106
os.makedirs(static_dir, exist_ok=True)
143107

144-
# Setup Java
145-
java_dir = os.path.join(static_dir, "java")
146-
os.makedirs(java_dir, exist_ok=True)
147-
148-
self._java_home_path = os.path.join(java_dir, java_dependency["java_home_path"])
149-
java_path = os.path.join(java_dir, java_dependency["java_path"])
150-
151-
if not os.path.exists(java_path):
152-
log.info(f"Downloading Java for {platform_id.value}...")
153-
FileUtils.download_and_extract_archive(java_dependency["url"], java_dir, java_dependency["archiveType"])
154-
if not platform_id.value.startswith("win-"):
155-
os.chmod(java_path, 0o755)
156-
157-
assert os.path.exists(java_path), f"Java executable not found at {java_path}"
158-
159108
# Setup Kotlin Language Server
160-
if platform_id.value.startswith("win-"):
161-
kotlin_script = os.path.join(static_dir, "kotlin-lsp.cmd")
162-
else:
163-
kotlin_script = os.path.join(static_dir, "kotlin-lsp.sh")
109+
kotlin_script_name = "kotlin-lsp.cmd" if platform_id.value.startswith("win-") else "kotlin-lsp.sh"
110+
kotlin_script = os.path.join(static_dir, kotlin_script_name)
164111

165112
if not os.path.exists(kotlin_script):
166113
kotlin_lsp_version = self._custom_settings.get("kotlin_lsp_version", DEFAULT_KOTLIN_LSP_VERSION)

0 commit comments

Comments
 (0)