Skip to content

Commit

Permalink
Bring to head of internal repo (#367)
Browse files Browse the repository at this point in the history
* Project import generated by Copybara.

GitOrigin-RevId: 60a257481396c9a86caa8d52c49c2f4ab90e2aab

* Update server.vim

---------

Co-authored-by: Copybara Bot <[email protected]>
  • Loading branch information
fortenforge and Copybara Bot authored May 23, 2024
1 parent 9406f13 commit 289eb72
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions autoload/codeium/server.vim
Original file line number Diff line number Diff line change
@@ -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('<sfile>:h:h:h')
let s:bin = v:null

Expand Down Expand Up @@ -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()})
Expand Down

0 comments on commit 289eb72

Please sign in to comment.