def _ConvertDiagnosticToTextProperties( bufnr, diagnostic ): properties = [] name = ( 'YcmErrorProperty' if _DiagnosticIsError( diagnostic ) else 'YcmWarningProperty' ) if vimsupport.VimIsNeovim(): name = name.replace( 'Property', 'Section' ) location_extent = diagnostic[ 'location_extent' ] if location_extent[ 'start' ][ 'line_num' ] <= 0: location = diagnostic[ 'location' ] line, column = vimsupport.LineAndColumnNumbersClamped( bufnr, location[ 'line_num' ], location[ 'column_num' ] ) properties.append( ( line, column, name, {} ) ) else: start_line, start_column = vimsupport.LineAndColumnNumbersClamped( bufnr, location_extent[ 'start' ][ 'line_num' ], location_extent[ 'start' ][ 'column_num' ] ) end_line, end_column = vimsupport.LineAndColumnNumbersClamped( bufnr, location_extent[ 'end' ][ 'line_num' ], location_extent[ 'end' ][ 'column_num' ] ) properties.append( ( start_line, start_column, name, { 'end_lnum': end_line, 'end_col': end_column } ) ) for diagnostic_range in diagnostic[ 'ranges' ]: start_line, start_column = vimsupport.LineAndColumnNumbersClamped( bufnr, diagnostic_range[ 'start' ][ 'line_num' ], diagnostic_range[ 'start' ][ 'column_num' ] ) end_line, end_column = vimsupport.LineAndColumnNumbersClamped( bufnr, diagnostic_range[ 'end' ][ 'line_num' ], diagnostic_range[ 'end' ][ 'column_num' ] ) if not _IsValidRange( start_line, start_column, end_line, end_column ): continue properties.append( ( start_line, start_column, name, { 'end_lnum': end_line, 'end_col': end_column } ) ) return properties
def Initialise(): if vimsupport.VimIsNeovim(): return props = GetTextPropertyTypes() if 'YCM_HL_UNKNOWN' not in props: AddTextPropertyType( 'YCM_HL_UNKNOWN', highlight = 'WarningMsg' ) for token_type, group in HIGHLIGHT_GROUP.items(): prop = f'YCM_HL_{ token_type }' if prop not in props and vimsupport.GetIntValue( f"hlexists( '{ vimsupport.EscapeForVim( group ) }' )" ): AddTextPropertyType( prop, highlight = group )
def DebugInfo( self ): debug_info = '' if self._client_logfile: debug_info += f'Client logfile: { self._client_logfile }\n' extra_data = {} self._AddExtraConfDataIfNeeded( extra_data ) debug_info += FormatDebugInfoResponse( SendDebugInfoRequest( extra_data ) ) debug_info += f'Server running at: { BaseRequest.server_location }\n' if self._server_popen: debug_info += f'Server process ID: { self._server_popen.pid }\n' if self._server_stdout and self._server_stderr: debug_info += ( 'Server logfiles:\n' f' { self._server_stdout }\n' f' { self._server_stderr }' ) debug_info += ( '\nSemantic highlighting supported: ' + str( not vimsupport.VimIsNeovim() ) ) debug_info += ( '\nVirtual text supported: ' + str( vimsupport.VimSupportsVirtualText() ) ) debug_info += ( '\nPopup windows supported: ' + str( vimsupport.VimSupportsPopupWindows() ) ) return debug_info