Bläddra i källkod

VirtualText - add a test for virtual text suppport

Ben Jackson 2 år sedan
förälder
incheckning
3ff522841e
1 ändrade filer med 9 tillägg och 0 borttagningar
  1. 9 0
      python/ycm/vimsupport.py

+ 9 - 0
python/ycm/vimsupport.py

@@ -60,6 +60,10 @@ NO_COMPLETIONS = {
 
 YCM_NEOVIM_NS_ID = vim.eval( 'g:ycm_neovim_ns_id' )
 
+# Virtual text is not a feature in itself and early patches don't work well, so
+# we need to keep changing this at the moment
+VIM_VIRTUAL_TEXT_VERSION_REQ = '9.0.193'
+
 
 def CurrentLineAndColumn():
   """Returns the 0-based current line and 0-based current column."""
@@ -1414,6 +1418,11 @@ def VimSupportsPopupWindows():
                           'popup_close' )
 
 
+@memoize()
+def VimSupportsVirtualText():
+  return not VimIsNeovim() and VimVersionAtLeast( VIM_VIRTUAL_TEXT_VERSION_REQ )
+
+
 @memoize()
 def VimHasFunction( func ):
   return bool( GetIntValue( f"exists( '*{ EscapeForVim( func ) }' )" ) )