From 289eb724e5d6fab2263e94a1ad6e54afebefafb2 Mon Sep 17 00:00:00 2001 From: Rahul Sridhar Date: Thu, 23 May 2024 13:18:38 -0700 Subject: [PATCH] Bring to head of internal repo (#367) * Project import generated by Copybara. GitOrigin-RevId: 60a257481396c9a86caa8d52c49c2f4ab90e2aab * Update server.vim --------- Co-authored-by: Copybara Bot --- autoload/codeium/server.vim | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/autoload/codeium/server.vim b/autoload/codeium/server.vim index 1855da39..442455fe 100644 --- a/autoload/codeium/server.vim +++ b/autoload/codeium/server.vim @@ -1,5 +1,5 @@ -let s:language_server_version = '1.8.30' -let s:language_server_sha = '98dd1530ef0dce8888caa538e96fe193a7956819' +let s:language_server_version = '1.8.37' +let s:language_server_sha = 'c9ee08628270937c0e7c7740dd6931363217942f' let s:root = expand(':h:h:h') let s:bin = v:null @@ -107,12 +107,33 @@ function! s:FindPort(dir, timer) abort if time - getftime(path) <= 5 && getftype(path) ==# 'file' call codeium#log#Info('Found port: ' . name) let s:server_port = name + call s:RequestServerStatus() call timer_stop(a:timer) break endif endfor endfunction +function! s:RequestServerStatus() abort + call codeium#server#Request('GetStatus', {'metadata': codeium#server#RequestMetadata()}, function('s:HandleGetStatusResponse')) +endfunction + +function! s:HandleGetStatusResponse(out, err, status) abort + " Check if the request was successful + if a:status == 0 + " Parse the JSON response + let response = json_decode(join(a:out, "\n")) + let status = response.status + " Check if there is a message in the response and echo it + if has_key(status, 'message') && !empty(status.message) + echom status.message + endif + else + " Handle error if the status is not 0 or if there is stderr output + call codeium#log#Error(join(a:err, "\n")) + endif +endfunction + function! s:SendHeartbeat(timer) abort try call codeium#server#Request('Heartbeat', {'metadata': codeium#server#RequestMetadata()})