Skip to content

Commit dd365b2

Browse files
committed
Bump vim requirement to version 9.1.0016
Since Ubuntu 24.04 is out, we can clean up a bit. Some of the `VimSupportsFoo()` functions will always return `True` in vim, but we also need to take into account othervim.
1 parent b6e8c64 commit dd365b2

File tree

9 files changed

+63
-101
lines changed

9 files changed

+63
-101
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,12 @@ Installation
211211

212212
| Runtime | Min Version | Recommended Version (full support) | Python |
213213
|---------|-------------|------------------------------------|--------|
214-
| Vim | 8.2.3995 | 9.0.214 | 3.8 |
215-
| Neovim | 0.5 | Vim 9.0.214 | 3.8 |
214+
| Vim | 9.1.0016 | 9.1.0016 | 3.8 |
215+
| Neovim | 0.5 | Vim 9.1.0016 | 3.8 |
216216

217217
#### Supported Vim Versions
218218

219219
Our policy is to support the Vim version that's in the latest LTS of Ubuntu.
220-
That's currently Ubuntu 22.04 which contains `vim-nox` at `v8.2.3995`.
221220

222221
Vim must have a [working Python 3 runtime](#supported-python-runtime).
223222

@@ -418,7 +417,7 @@ that are conservatively turned off by default that you may want to turn on.
418417
419418
### Linux 64-bit
420419
421-
The following assume you're using Ubuntu 22.04.
420+
The following assume you're using Ubuntu 24.04.
422421
423422
#### Quick start, installing all completers
424423
@@ -1091,7 +1090,7 @@ On supported architectures, the `install.py` script will download a suitable
10911090
clangd (`--clangd-completer`) or libclang (`--clang-completer`) for you.
10921091
Supported architectures are:
10931092

1094-
* Linux glibc >= 2.31 (Intel, armv7-a, aarch64) - built on ubuntu 22.04
1093+
* Linux glibc >= 2.39 (Intel, armv7-a, aarch64) - built on ubuntu 24.04
10951094
* MacOS >=10.15 (Intel, arm64)
10961095
- For Intel, compatibility per clang.llvm.org downloads
10971096
- For arm64, macOS 10.15+
@@ -1617,10 +1616,10 @@ let g:ycm_language_server =
16171616
\ 'filetypes': [ 'yaml' ]
16181617
\ },
16191618
\ {
1620-
\ 'name': 'rust',
1621-
\ 'cmdline': [ 'ra_lsp_server' ],
1622-
\ 'filetypes': [ 'rust' ],
1623-
\ 'project_root_files': [ 'Cargo.toml' ]
1619+
\ 'name': 'csharp',
1620+
\ 'cmdline': [ 'OmniSharp', '-lsp' ],
1621+
\ 'filetypes': [ 'csharp' ],
1622+
\ 'project_root_files': [ '*.csproj', '*.sln' ]
16241623
\ },
16251624
\ {
16261625
\ 'name': 'godot',
@@ -1639,7 +1638,8 @@ Each dictionary contains the following keys:
16391638
* `filetypes` (list of string, mandatory): List of Vim filetypes this server
16401639
should be used for.
16411640
* `project_root_files` (list of string, optional): List of filenames to search
1642-
for when trying to determine the project's root.
1641+
for when trying to determine the project's root. Uses python's pathlib for
1642+
glob matching.
16431643
* `cmdline` (list of strings, optional): If supplied, the server is started with
16441644
this command line (each list element is a command line word). Typically, the
16451645
server should be started with STDIO communication. If not supplied, `port`

plugin/youcompleteme.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ let s:is_neovim = has( 'nvim' )
3131
if exists( "g:loaded_youcompleteme" )
3232
call s:restore_cpo()
3333
finish
34-
elseif ( v:version < 802 || (v:version == 802 && !has( 'patch3995' )) ) &&
34+
elseif ( v:version < 901 || (v:version == 901 && !has( 'patch0016' )) ) &&
3535
\ !s:is_neovim
3636
echohl WarningMsg |
37-
\ echomsg "YouCompleteMe unavailable: requires Vim 8.2.3995+." |
37+
\ echomsg "YouCompleteMe unavailable: requires Vim 9.1.0016+." |
3838
\ echohl None
3939
call s:restore_cpo()
4040
finish

python/ycm/diagnostic_interface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def _ClearCurrentDiagnostic( self, will_be_replaced=False ):
133133
if not self._diag_message_needs_clearing:
134134
return
135135

136-
if ( vimsupport.VimSupportsVirtualText() and
136+
if ( not vimsupport.VimIsNeovim() and
137137
self._user_options[ 'echo_current_diagnostic' ] == 'virtual-text' ):
138138
tp.ClearTextProperties( self._bufnr,
139139
prop_types = [ 'YcmVirtDiagPadding',
@@ -149,7 +149,7 @@ def _ClearCurrentDiagnostic( self, will_be_replaced=False ):
149149
def _EchoDiagnosticText( self, line_num, first_diag, text ):
150150
self._ClearCurrentDiagnostic( bool( text ) )
151151

152-
if ( vimsupport.VimSupportsVirtualText() and
152+
if ( not vimsupport.VimIsNeovim() and
153153
self._user_options[ 'echo_current_diagnostic' ] == 'virtual-text' ):
154154
if not text:
155155
return

python/ycm/inlay_hints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333

3434
def Initialise():
35-
if not vimsupport.VimSupportsVirtualText():
35+
if vimsupport.VimIsNeovim():
3636
return False
3737

3838
props = tp.GetTextPropertyTypes()

python/ycm/tests/test_utils.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@
4141
'^(?:silent! )bwipeout!? (?P<buffer_number>[0-9]+)$' )
4242
GETBUFVAR_REGEX = re.compile(
4343
'^getbufvar\\((?P<buffer_number>[0-9]+), "(?P<option>.+)"\\)( \\?\\? 0)?$' )
44+
PROP_LIST_REGEX = re.compile(
45+
'^prop_list\\( ' # A literal at the start
46+
'(?P<lnum>\\d+), ' # Start line
47+
'{ "bufnr": (?P<bufnr>\\d+), ' # Corresponding buffer number
48+
'"end_lnum": (?P<end_lnum>[0-9-]+), ' # End line, can be negative.
49+
'"types": (?P<prop_types>\\[.+\\]) } ' # Property types
50+
'\\)$' )
4451
PROP_ADD_REGEX = re.compile(
4552
'^prop_add\\( ' # A literal at the start
4653
'(?P<start_line>\\d+), ' # First argument - number
@@ -249,14 +256,16 @@ def _MockVimFunctionsEval( value ):
249256

250257

251258
def _MockVimPropEval( value ):
252-
match = re.match( 'prop_list\\( (?P<lnum>\\d+), '
253-
'{ "bufnr": (?P<bufnr>\\d+) } \\)', value )
254-
if match:
255-
return [ p for p in VIM_PROPS_FOR_BUFFER[ int( match.group( 'bufnr' ) ) ]
256-
if p.start_line == int( match.group( 'lnum' ) ) ]
257-
258-
match = PROP_ADD_REGEX.search( value )
259-
if match:
259+
if match := PROP_LIST_REGEX.search( value ):
260+
if int( match.group( 'end_lnum' ) ) == -1:
261+
return [ p for p in VIM_PROPS_FOR_BUFFER[ int( match.group( 'bufnr' ) ) ]
262+
if p.start_line >= int( match.group( 'lnum' ) ) ]
263+
else:
264+
return [ p for p in VIM_PROPS_FOR_BUFFER[ int( match.group( 'bufnr' ) ) ]
265+
if int( match.group( 'end_lnum' ) ) >= p.start_line and
266+
p.start_line >= int( match.group( 'lnum' ) ) ]
267+
268+
if match := PROP_ADD_REGEX.search( value ):
260269
prop_start_line = int( match.group( 'start_line' ) )
261270
prop_start_column = int( match.group( 'start_column' ) )
262271
import ast
@@ -265,14 +274,13 @@ def _MockVimPropEval( value ):
265274
opts[ 'type' ],
266275
prop_start_line,
267276
prop_start_column,
268-
int( opts[ 'end_lnum' ] ) if opts[ 'end_lnum' ] else prop_start_line,
269-
int( opts[ 'end_col' ] ) if opts[ 'end_col' ] else prop_start_column
277+
int( opts[ 'end_lnum' ] ),
278+
int( opts[ 'end_col' ] )
270279
)
271280
VIM_PROPS_FOR_BUFFER[ int( opts[ 'bufnr' ] ) ].append( vim_prop )
272281
return vim_prop.id
273282

274-
match = PROP_REMOVE_REGEX.search( value )
275-
if match:
283+
if match := PROP_REMOVE_REGEX.search( value ):
276284
prop, lin_num = eval( match.group( 'prop' ) )
277285
vim_props = VIM_PROPS_FOR_BUFFER[ prop[ 'bufnr' ] ]
278286
for index, vim_prop in enumerate( vim_props ):
@@ -577,8 +585,8 @@ def __init__( self,
577585
prop_type,
578586
start_line,
579587
start_column,
580-
end_line = None,
581-
end_column = None ):
588+
end_line,
589+
end_column ):
582590
current_buffer = VIM_MOCK.current.buffer.number
583591
self.id = len( VIM_PROPS_FOR_BUFFER[ current_buffer ] ) + 1
584592
self.prop_type = prop_type
@@ -613,6 +621,8 @@ def __getitem__( self, key ):
613621
return self.start_column
614622
elif key == 'length':
615623
return self.end_column - self.start_column
624+
elif key == 'lnum':
625+
return self.start_line
616626

617627

618628
def get( self, key, default = None ):

python/ycm/tests/youcompleteme_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ def test_YouCompleteMe_UpdateMatches_ClearDiagnosticMatchesInNewBuffer(
762762
test_utils.VIM_PROPS_FOR_BUFFER[ current_buffer.number ] = [
763763
VimProp( 'YcmWarningProperty', 3, 5, 3, 7 ),
764764
VimProp( 'YcmWarningProperty', 3, 3, 3, 9 ),
765-
VimProp( 'YcmErrorProperty', 3, 8 )
765+
VimProp( 'YcmErrorProperty', 3, 8, 3, 9 )
766766
]
767767

768768
with MockVimBuffers( [ current_buffer ], [ current_buffer ] ):

python/ycm/text_properties.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,5 @@ def prop_remove():
104104
if not isinstance( prop_types, list ):
105105
prop_types = [ prop_types ]
106106

107-
# 9.0.233 added types list to prop_remove, so use that
108-
if vimsupport.VimVersionAtLeast( '9.0.233' ):
109-
props[ 'types' ] = prop_types
110-
return prop_remove()
111-
112-
# Older versions we have to run prop_remove for each type
113-
removed = 0
114-
for prop_type in prop_types:
115-
props[ 'type' ] = prop_type
116-
removed += prop_remove()
117-
return removed
107+
props[ 'types' ] = prop_types
108+
return prop_remove()

python/ycm/vimsupport.py

Lines changed: 20 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@
6060

6161
YCM_NEOVIM_NS_ID = vim.eval( 'g:ycm_neovim_ns_id' )
6262

63-
# Virtual text is not a feature in itself and early patches don't work well, so
64-
# we need to keep changing this at the moment
65-
VIM_VIRTUAL_TEXT_VERSION_REQ = '9.0.214'
66-
6763

6864
def CurrentLineAndColumn():
6965
"""Returns the 0-based current line and 0-based current column."""
@@ -308,55 +304,30 @@ def GetTextPropertyForDiag( buffer_number, line_number, diag ):
308304
property_name = 'YcmErrorProperty'
309305
else:
310306
property_name = 'YcmWarningProperty'
311-
if HasFastPropList():
312-
vim_props = vim.eval( f'prop_list( { line_number }, '
313-
f'{{ "bufnr": { buffer_number }, '
314-
f'"types": [ "{ property_name }" ] }} )' )
315-
return next( filter(
316-
lambda p: column == int( p[ 'col' ] ) and
317-
length == int( p[ 'length' ] ),
318-
vim_props ) )
319-
else:
320-
vim_props = vim.eval( f'prop_list( { line_number }, '
321-
f'{{ "bufnr": { buffer_number } }} )' )
322-
return next( filter(
323-
lambda p: start[ 'column_num' ] == int( p[ 'col' ] ) and
324-
length == int( p[ 'length' ] ) and
325-
property_name == p[ 'type' ],
326-
vim_props ) )
307+
vim_props = vim.eval( f'prop_list( { line_number }, '
308+
f'{{ "bufnr": { buffer_number }, '
309+
f'"types": [ "{ property_name }" ] }} )' )
310+
return next( filter(
311+
lambda p: column == int( p[ 'col' ] ) and
312+
length == int( p[ 'length' ] ),
313+
vim_props ) )
327314

328315

329316
def GetTextProperties( buffer_number ):
330317
if not VimIsNeovim():
331-
if HasFastPropList():
332-
return [
333-
DiagnosticProperty(
334-
int( p[ 'id' ] ),
335-
p[ 'type' ],
336-
int( p[ 'lnum' ] ),
337-
int( p[ 'col' ] ),
338-
int( p[ 'length' ] ) )
339-
for p in vim.eval(
340-
f'prop_list( 1, '
341-
f'{{ "bufnr": { buffer_number }, '
342-
'"end_lnum": -1, '
343-
'"types": [ "YcmErrorProperty", '
344-
'"YcmWarningProperty" ] } )' ) ]
345-
else:
346-
properties = []
347-
for line_number in range( len( vim.buffers[ buffer_number ] ) ):
348-
vim_props = vim.eval( f'prop_list( { line_number + 1 }, '
349-
f'{{ "bufnr": { buffer_number } }} )' )
350-
properties.extend(
351-
DiagnosticProperty(
352-
int( p[ 'id' ] ),
353-
p[ 'type' ],
354-
line_number + 1,
355-
int( p[ 'col' ] ),
356-
int( p[ 'length' ] ) )
357-
for p in vim_props if p.get( 'type', '' ).startswith( 'Ycm' )
358-
)
359-
return properties
318+
return [
319+
DiagnosticProperty(
320+
int( p[ 'id' ] ),
321+
p[ 'type' ],
322+
int( p[ 'lnum' ] ),
323+
int( p[ 'col' ] ),
324+
int( p[ 'length' ] ) )
325+
for p in vim.eval(
326+
f'prop_list( 1, '
327+
f'{{ "bufnr": { buffer_number }, '
328+
'"end_lnum": -1, '
329+
'"types": [ "YcmErrorProperty", '
330+
'"YcmWarningProperty" ] } )' ) ]
360331
else:
361332
ext_marks = vim.eval(
362333
f'nvim_buf_get_extmarks( { buffer_number }, '
@@ -1464,11 +1435,6 @@ def VimIsNeovim():
14641435
return GetBoolValue( 'has( "nvim" )' )
14651436

14661437

1467-
@memoize()
1468-
def HasFastPropList():
1469-
return GetBoolValue( 'has( "patch-8.2.3652" )' )
1470-
1471-
14721438
@memoize()
14731439
def VimSupportsPopupWindows():
14741440
return VimHasFunctions( 'popup_create',
@@ -1480,11 +1446,6 @@ def VimSupportsPopupWindows():
14801446
'popup_close' )
14811447

14821448

1483-
@memoize()
1484-
def VimSupportsVirtualText():
1485-
return not VimIsNeovim() and VimVersionAtLeast( VIM_VIRTUAL_TEXT_VERSION_REQ )
1486-
1487-
14881449
@memoize()
14891450
def VimHasFunction( func ):
14901451
return bool( GetIntValue( f"exists( '*{ EscapeForVim( func ) }' )" ) )

python/ycm/youcompleteme.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ def DebugInfo( self ):
807807
debug_info += ( '\nSemantic highlighting supported: ' +
808808
str( not vimsupport.VimIsNeovim() ) )
809809
debug_info += ( '\nVirtual text supported: ' +
810-
str( vimsupport.VimSupportsVirtualText() ) )
810+
str( not vimsupport.VimIsNeovim() ) )
811811
debug_info += ( '\nPopup windows supported: ' +
812812
str( vimsupport.VimSupportsPopupWindows() ) )
813813
return debug_info

0 commit comments

Comments
 (0)