From cb359c0b6a192dcc408841f20f0afeaa6d855d2f Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Wed, 8 Jan 2014 18:43:17 -0800 Subject: [PATCH] New options for controlling the diag ui --- plugin/youcompleteme.vim | 12 ++++++++++++ python/ycm/diagnostic_interface.py | 17 ++++++++++++----- python/ycm/youcompleteme.py | 2 +- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/plugin/youcompleteme.vim b/plugin/youcompleteme.vim index 4b0cf32c..906b17b1 100644 --- a/plugin/youcompleteme.vim +++ b/plugin/youcompleteme.vim @@ -117,6 +117,18 @@ let g:ycm_show_diagnostics_ui = \ get( g:, 'ycm_show_diagnostics_ui', \ 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 = \ get( g:, 'ycm_error_symbol', \ get( g:, 'syntastic_error_symbol', '>>' ) ) diff --git a/python/ycm/diagnostic_interface.py b/python/ycm/diagnostic_interface.py index 0f2666ca..c58a2eae 100644 --- a/python/ycm/diagnostic_interface.py +++ b/python/ycm/diagnostic_interface.py @@ -23,7 +23,8 @@ import vim class DiagnosticInterface( object ): - def __init__( self ): + def __init__( self, user_options ): + self._user_options = user_options # Line and column numbers are 1-based self._buffer_number_to_line_to_diags = defaultdict( lambda: defaultdict( list ) ) @@ -36,14 +37,20 @@ class DiagnosticInterface( object ): line += 1 # Convert to 1-based if line != self._previous_line_number: self._previous_line_number = line - self._EchoDiagnosticForLine( line ) + + if self._user_options[ 'echo_current_diagnostic' ]: + self._EchoDiagnosticForLine( line ) def UpdateWithNewDiagnostics( self, 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 ) - _UpdateSquiggles( self._buffer_number_to_line_to_diags ) + + if self._user_options[ 'enable_signs' ]: + 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 ): diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index 8d8a8cbe..89ff71c2 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -65,7 +65,7 @@ class YouCompleteMe( object ): def __init__( self, user_options ): self._user_options = user_options self._user_notified_about_crash = False - self._diag_interface = DiagnosticInterface() + self._diag_interface = DiagnosticInterface( user_options ) self._omnicomp = OmniCompleter( user_options ) self._latest_completion_request = None self._latest_file_parse_request = None