New options for controlling the diag ui

This commit is contained in:
Strahinja Val Markovic 2014-01-08 18:43:17 -08:00
parent 4a9b7cb63e
commit cb359c0b6a
3 changed files with 25 additions and 6 deletions

View File

@ -117,6 +117,18 @@ let g:ycm_show_diagnostics_ui =
\ get( g:, 'ycm_show_diagnostics_ui', \ get( g:, 'ycm_show_diagnostics_ui',
\ get( g:, 'ycm_register_as_syntastic_checker', 1 ) ) \ get( g:, 'ycm_register_as_syntastic_checker', 1 ) )
let g:ycm_enable_signs =
\ get( g:, 'ycm_enable_signs',
\ get( g:, 'syntastic_enable_signs', 1 ) )
let g:ycm_enable_highlighting =
\ get( g:, 'ycm_enable_highlighting',
\ get( g:, 'syntastic_enable_highlighting', 1 ) )
let g:ycm_echo_current_diagnostic =
\ get( g:, 'ycm_echo_current_diagnostic',
\ get( g:, 'syntastic_echo_current_error', 1 ) )
let g:ycm_error_symbol = let g:ycm_error_symbol =
\ get( g:, 'ycm_error_symbol', \ get( g:, 'ycm_error_symbol',
\ get( g:, 'syntastic_error_symbol', '>>' ) ) \ get( g:, 'syntastic_error_symbol', '>>' ) )

View File

@ -23,7 +23,8 @@ import vim
class DiagnosticInterface( object ): class DiagnosticInterface( object ):
def __init__( self ): def __init__( self, user_options ):
self._user_options = user_options
# Line and column numbers are 1-based # Line and column numbers are 1-based
self._buffer_number_to_line_to_diags = defaultdict( self._buffer_number_to_line_to_diags = defaultdict(
lambda: defaultdict( list ) ) lambda: defaultdict( list ) )
@ -36,14 +37,20 @@ class DiagnosticInterface( object ):
line += 1 # Convert to 1-based line += 1 # Convert to 1-based
if line != self._previous_line_number: if line != self._previous_line_number:
self._previous_line_number = line self._previous_line_number = line
self._EchoDiagnosticForLine( line )
if self._user_options[ 'echo_current_diagnostic' ]:
self._EchoDiagnosticForLine( line )
def UpdateWithNewDiagnostics( self, diags ): def UpdateWithNewDiagnostics( self, diags ):
self._buffer_number_to_line_to_diags = _ConvertDiagListToDict( diags ) self._buffer_number_to_line_to_diags = _ConvertDiagListToDict( diags )
self._next_sign_id = _UpdateSigns( self._buffer_number_to_line_to_diags,
self._next_sign_id ) if self._user_options[ 'enable_signs' ]:
_UpdateSquiggles( self._buffer_number_to_line_to_diags ) self._next_sign_id = _UpdateSigns( self._buffer_number_to_line_to_diags,
self._next_sign_id )
if self._user_options[ 'enable_highlighting' ]:
_UpdateSquiggles( self._buffer_number_to_line_to_diags )
def _EchoDiagnosticForLine( self, line_num ): def _EchoDiagnosticForLine( self, line_num ):

View File

@ -65,7 +65,7 @@ class YouCompleteMe( object ):
def __init__( self, user_options ): def __init__( self, user_options ):
self._user_options = user_options self._user_options = user_options
self._user_notified_about_crash = False self._user_notified_about_crash = False
self._diag_interface = DiagnosticInterface() self._diag_interface = DiagnosticInterface( user_options )
self._omnicomp = OmniCompleter( user_options ) self._omnicomp = OmniCompleter( user_options )
self._latest_completion_request = None self._latest_completion_request = None
self._latest_file_parse_request = None self._latest_file_parse_request = None