Skip to content

Commit

Permalink
check user defined text property at initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejlevkovitch committed Jul 18, 2023
1 parent 6fc0ebb commit f041d0d
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions python/ycm/semantic_highlighting.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ def Initialise():
highlight = group,
priority = 0 )

# add user defined properties
ycm_prop_suffix = f'YCM_HL_'
for prop in props:
if prop[0:len(ycm_prop_suffix)] == ycm_prop_suffix:
name = prop[len(ycm_prop_suffix):]
if name not in HIGHLIGHT_GROUP.keys():
HIGHLIGHT_GROUP[name] = ''


# "arbitrary" base id
NEXT_TEXT_PROP_ID = 70784
Expand Down Expand Up @@ -107,18 +115,13 @@ def _Draw( self ):
self._prop_id = NextPropID()

for token in tokens:
prop_type = f"YCM_HL_{ token[ 'type' ] }"

if token[ 'type' ] not in HIGHLIGHT_GROUP:
props = tp.GetTextPropertyTypes()
if prop_type in props:
HIGHLIGHT_GROUP[token['type']] = ''
else:
if token[ 'type' ] not in REPORTED_MISSING_TYPES:
REPORTED_MISSING_TYPES.add( token[ 'type' ] )
vimsupport.PostVimMessage(
f"Missing property type for { token[ 'type' ] }" )
continue
if token[ 'type' ] not in REPORTED_MISSING_TYPES:
REPORTED_MISSING_TYPES.add( token[ 'type' ] )
vimsupport.PostVimMessage(
f"Missing property type for { token[ 'type' ] }" )
continue
prop_type = f"YCM_HL_{ token[ 'type' ] }"

rng = token[ 'range' ]
self.GrowRangeIfNeeded( rng )
Expand Down

0 comments on commit f041d0d

Please sign in to comment.