@@ -151,10 +151,12 @@ local function extract_file(copilot_server_info, local_server_zip_filepath)
151151 end
152152
153153 vim .fn .delete (local_server_zip_filepath )
154- vim .fn .rename (
155- vim .fs .joinpath (copilot_server_info .absolute_path , copilot_server_info .extracted_filename ),
156- copilot_server_info .absolute_filepath
157- )
154+ if copilot_server_info .path ~= " js" then
155+ vim .fn .rename (
156+ vim .fs .joinpath (copilot_server_info .absolute_path , copilot_server_info .extracted_filename ),
157+ copilot_server_info .absolute_filepath
158+ )
159+ end
158160
159161 return true
160162end
@@ -221,12 +223,14 @@ function M.ensure_client_is_downloaded()
221223 return false
222224 end
223225
224- if not set_permissions (copilot_server_info .absolute_filepath ) then
225- logger .error (" could not set permissions for copilot-language-server" )
226- return false
226+ if copilot_server_info .path ~= " js" then
227+ if not set_permissions (copilot_server_info .absolute_filepath ) then
228+ logger .error (" could not set permissions for copilot-language-server" )
229+ return false
230+ end
231+ delete_all_except (copilot_server_info .absolute_path , copilot_server_info .filename )
227232 end
228233
229- delete_all_except (copilot_server_info .absolute_path , copilot_server_info .filename )
230234 logger .notify (" copilot-language-server downloaded" )
231235 return true
232236end
@@ -248,6 +252,22 @@ local function is_arm()
248252 return os_name == " aarch64" or string.sub (os_name , 1 , 3 ) == " arm"
249253end
250254
255+ --- @return boolean
256+ local function is_musl ()
257+ local fh , err = assert (io.popen (" ldd --version 2>&1" , " r" ))
258+ if err then
259+ return false -- we assume glibc
260+ end
261+
262+ local ldd_output
263+ if fh then
264+ ldd_output = fh :read ()
265+ fh :close ()
266+ end
267+
268+ return string.sub (ldd_output , 1 , 4 ) == " musl"
269+ end
270+
251271--- @return copilot_server_info
252272function M .get_copilot_server_info ()
253273 if M .copilot_server_info then
@@ -263,8 +283,11 @@ function M.get_copilot_server_info()
263283 if os == " Linux" then
264284 if is_arm () then
265285 path = " linux-arm64"
266- else
286+ elseif not is_musl () then
267287 path = " linux-x64"
288+ else
289+ -- Fallback to plain nodejs project
290+ path = " js"
268291 end
269292 elseif os == " Darwin" then
270293 if is_arm () then
@@ -282,6 +305,11 @@ function M.get_copilot_server_info()
282305 logger .error (" could not determine OS, please report this issue with the output of `uname -a`" )
283306 end
284307
308+ if path == " js" then
309+ filename = " language-server.js"
310+ extracted_filename = " "
311+ end
312+
285313 M .copilot_server_info = {
286314 path = path ,
287315 filename = filename ,
0 commit comments