Exafunction / codeium.vim

Free, ultrafast Copilot alternative for Vim and Neovim
https://codeium.com
MIT License
4.13k stars 147 forks source link

Remove the redrawstatus makes plugin not flicker in neovim #87

Closed hanspinckaers closed 1 year ago

hanspinckaers commented 1 year ago

Hi there,

Trying out the plugin and got a bit annoyed by the flicker when I accept a completion. Commenting out the redrawstatus lines in the code works. Not ideal, but I don't have codeium in my statusline anyway. Maybe if you move this line somewhere else it remove the flickering and can still redraw the statusline?

Thanks! Hans

pqn commented 1 year ago

@klew do you know what could be causing the flickering?

klew commented 1 year ago

@pqn it is redrawing, so it may flicker depending on neovim implementation and on other plugins/data that is configured on statusline. However I tested again with this line removed: https://github.com/Exafunction/codeium.vim/blob/813461c638d086ef41ef6be760b0e27f83ab7380/autoload/codeium.vim#L350

And it seems to work correctly. So feel free to remove that line.

sigmaSd commented 1 year ago

The issus still remain as far as I can tell, here is a profile

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
   21              0.179678  codeium#server#Request()
   41              0.055430  <SNR>35_try()
   34              0.048389  codeium#RedrawStatusLine()
    6              0.041515  3()
   41   0.013109   0.011787  <SNR>18_Highlight_Matching_Pair()
   17   0.022916   0.008260  <SNR>48_RenderCurrentCompletion()
   21   0.008325   0.008165  codeium#doc#GetDocument()
   72   0.013562   0.007480  codeium#GetStatusString()
   79              0.006530  codeium#Enabled()
    3              0.006146  nvim_treesitter#indent()
   17   0.114937   0.005492  codeium#Clear()
    7   0.074005   0.005298  codeium#Complete()
   22              0.002636  codeium#log#Log()
    7   0.013661   0.002191  <SNR>48_HandleCompletionsResult()
   17              0.001567  <SNR>48_ClearCompletion()
   41              0.001323  <SNR>18_Remove_Matches()
   13   0.068452   0.001227  codeium#DebouncedComplete()
    3   0.028024   0.001155  codeium#Accept()
   22   0.004103   0.000768  <lambda>1()
   22   0.003336   0.000700  codeium#log#Info()

commenting this line seems to improve things a lot https://github.com/Exafunction/codeium.vim/blob/1dc5aff16f906e221b7b73668ed8d8bfc40ecd6b/autoload/codeium.vim#L405

fortenforge commented 1 year ago

Are you using codeium's status line? This line should only be executed if s:using_codeium_status is true

sigmaSd commented 1 year ago

yeah and it still work when disabling that line in nvim

sigmaSd commented 1 year ago

Its called many times but the total time seems very low 34 0.048389 codeium#RedrawStatusLine()

I tested it more there is in improvement but actually not that big, its probably due to me having too much plugins