From 1513aef682a9b3363c0bf60292e6ddc781c716ce Mon Sep 17 00:00:00 2001 From: Rahul Sridhar Date: Mon, 26 Aug 2024 19:29:48 -0700 Subject: [PATCH] Project import generated by Copybara. (#439) GitOrigin-RevId: 340170c5584009bf2b7ce263a82b13758986e5ad Co-authored-by: Copybara Bot --- autoload/codeium.vim | 10 ++++++++++ autoload/codeium/server.vim | 13 +++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/autoload/codeium.vim b/autoload/codeium.vim index 7b9c0972..0ea437e1 100644 --- a/autoload/codeium.vim +++ b/autoload/codeium.vim @@ -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 @@ -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 diff --git a/autoload/codeium/server.vim b/autoload/codeium/server.vim index 5286c0ea..549da3d1 100644 --- a/autoload/codeium/server.vim +++ b/autoload/codeium/server.vim @@ -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(':h:h:h') let s:bin = v:null @@ -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