Skip to content

Commit

Permalink
Fix errors when adding inlay hints
Browse files Browse the repository at this point in the history
Recent vims validate that you can't supply end_lnum/end_col with a text
property, so don't supply them.
  • Loading branch information
puremourning committed Nov 1, 2022
1 parent 99ccab2 commit 728b477
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 0 additions & 3 deletions python/ycm/inlay_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ def _Draw( self ):
'YCM_INLAY_PADDING',
{
'start': inlay_hint[ 'position' ],
'end': inlay_hint[ 'position' ],
},
{
'text': ' '
Expand All @@ -176,7 +175,6 @@ def _Draw( self ):
prop_type,
{
'start': inlay_hint[ 'position' ],
'end': inlay_hint[ 'position' ],
},
{
'text': inlay_hint[ 'label' ]
Expand All @@ -188,7 +186,6 @@ def _Draw( self ):
'YCM_INLAY_PADDING',
{
'start': inlay_hint[ 'position' ],
'end': inlay_hint[ 'position' ],
},
{
'text': ' '
Expand Down
7 changes: 5 additions & 2 deletions python/ycm/text_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,18 @@ def AddTextProperty( bufnr,
range,
extra_args: dict = None ):
props = {
'end_lnum': range[ 'end' ][ 'line_num' ],
'end_col': range[ 'end' ][ 'column_num' ],
'bufnr': bufnr,
'type': prop_type
}
if prop_id is not None:
props[ 'id' ] = prop_id
if extra_args:
props.update( extra_args )
if 'end' in range:
props.update( {
'end_lnum': range[ 'end' ][ 'line_num' ],
'end_col': range[ 'end' ][ 'column_num' ],
} )
return vim.eval( f"prop_add( { range[ 'start' ][ 'line_num' ] },"
f" { range[ 'start' ][ 'column_num' ] },"
f" { json.dumps( props ) } )" )
Expand Down

0 comments on commit 728b477

Please sign in to comment.