def _UpdateSigns(self): signs_to_unplace = vimsupport.GetSignsInBuffer(self._bufnr) for line, diags in self._line_to_diags.items(): if not diags: continue # We always go for the first diagnostic on the line because diagnostics # are sorted by errors in priority and Vim can only display one sign by # line. name = 'YcmError' if _DiagnosticIsError(diags[0]) else 'YcmWarning' sign = vimsupport.CreateSign(line, name, self._bufnr) try: signs_to_unplace.remove(sign) except ValueError: vimsupport.PlaceSign(sign) for sign in signs_to_unplace: vimsupport.UnplaceSign(sign)
def _UpdateSigns( self ): signs_to_unplace = vimsupport.GetSignsInBuffer( self._bufnr ) signs_to_place = [] for line, diags in self._line_to_diags.items(): if not diags: continue # We always go for the first diagnostic on the line because diagnostics # are sorted by errors in priority and Vim can only display one sign by # line. name = 'YcmError' if _DiagnosticIsError( diags[ 0 ] ) else 'YcmWarning' sign = { 'lnum': line, 'name': name, 'buffer': self._bufnr, 'group': 'ycm_signs' } try: signs_to_unplace.remove( sign ) except ValueError: signs_to_place.append( sign ) vim.eval( f'sign_placelist( { signs_to_place } )' ) vim.eval( f'sign_unplacelist( { signs_to_unplace } )' )