Skip to content

Commit

Permalink
Project import generated by Copybara. (#439)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 340170c5584009bf2b7ce263a82b13758986e5ad

Co-authored-by: Copybara Bot <[email protected]>
  • Loading branch information
fortenforge and Copybara Bot authored Aug 27, 2024
1 parent 8bed5fb commit 1513aef
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
10 changes: 10 additions & 0 deletions autoload/codeium.vim
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,15 @@ function! s:GetProjectRoot() abort
return getcwd()
endfunction

function! codeium#RefreshContext() abort
" current buffer is 1
try
call codeium#server#Request('RefreshContextForIdeAction', {'active_document': codeium#doc#GetDocument(1, line('.'), line('.'))})
catch
call codeium#log#Exception()
endtry
endfunction

" This assumes a single workspace is involved per Vim session, for now.
let s:codeium_workspace_indexed = v:false
function! codeium#AddTrackedWorkspace() abort
Expand All @@ -489,6 +498,7 @@ function! codeium#Chat() abort
return
endif
try
call codeium#RefreshContext()
call codeium#server#Request('GetProcesses', codeium#server#RequestMetadata(), function('s:LaunchChat', []))
call codeium#AddTrackedWorkspace()
catch
Expand Down
13 changes: 11 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.12.0'
let s:language_server_sha = 'beda8738f37970fd4066114bfb0e930e01316a62'
let s:language_server_version = '1.14.11'
let s:language_server_sha = '071907d082576067b0c7a5f2f7659958865d751e'
let s:root = expand('<sfile>:h:h:h')
let s:bin = v:null

Expand Down Expand Up @@ -174,6 +174,15 @@ function! codeium#server#Start(...) abort
let bin_suffix = 'windows_x64.exe'
endif

let config = get(g:, 'codeium_server_config', {})
if has_key(config, 'portal_url') && !empty(config.portal_url)
let response = system('curl -s ' . config.portal_url . '/api/version')
if v:shell_error != 0
let s:language_server_version = '1.14.11'
let s:language_server_sha = '071907d082576067b0c7a5f2f7659958865d751e'
endif
endif

let sha = get(codeium#command#LoadConfig(codeium#command#XdgConfigDir()), 'sha', s:language_server_sha)
let bin_dir = codeium#command#HomeDir() . '/bin/' . sha
let s:bin = bin_dir . '/language_server_' . bin_suffix
Expand Down

0 comments on commit 1513aef

Please sign in to comment.