Bläddra i källkod

Add g:ycm_filter_diagnostics to list of options

micbou 6 år sedan
förälder
incheckning
f6ec5557c0
3 ändrade filer med 6 tillägg och 2 borttagningar
  1. 3 0
      plugin/youcompleteme.vim
  2. 2 2
      python/ycm/diagnostic_filter.py
  3. 1 0
      python/ycm/tests/__init__.py

+ 3 - 0
plugin/youcompleteme.vim

@@ -153,6 +153,9 @@ let g:ycm_echo_current_diagnostic =
       \ get( g:, 'ycm_echo_current_diagnostic',
       \ get( g:, 'syntastic_echo_current_error', 1 ) )
 
+let g:ycm_filter_diagnostics =
+      \ get( g:, 'ycm_filter_diagnostics', {} )
+
 let g:ycm_always_populate_location_list =
       \ get( g:, 'ycm_always_populate_location_list',
       \ get( g:, 'syntastic_always_populate_loc_list', 0 ) )

+ 2 - 2
python/ycm/diagnostic_filter.py

@@ -53,9 +53,9 @@ class DiagnosticFilter( object ):
 
   @staticmethod
   def CreateFromOptions( user_options ):
-    all_filters = dict( user_options.get( 'filter_diagnostics', {} ) )
+    all_filters = user_options[ 'filter_diagnostics' ]
     compiled_by_type = {}
-    for type_spec, filter_value in iteritems( dict( all_filters ) ):
+    for type_spec, filter_value in iteritems( all_filters ):
       filetypes = [ type_spec ]
       if type_spec.find( ',' ) != -1:
         filetypes = type_spec.split( ',' )

+ 1 - 0
python/ycm/tests/__init__.py

@@ -48,6 +48,7 @@ DEFAULT_CLIENT_OPTIONS = {
   'g:ycm_enable_diagnostic_signs': 1,
   'g:ycm_enable_diagnostic_highlighting': 0,
   'g:ycm_echo_current_diagnostic': 1,
+  'g:ycm_filter_diagnostics': {},
   'g:ycm_always_populate_location_list': 0,
   'g:ycm_collect_identifiers_from_tags_files': 0,
   'g:ycm_seed_identifiers_with_syntax': 0,