Adding the g:ycm_open_loclist_on_ycm_diags option

This commit is contained in:
Strahinja Val Markovic 2014-01-29 10:59:15 -08:00
parent 735c57bba8
commit 1a33f34ec0
3 changed files with 22 additions and 1 deletions

View File

@ -555,6 +555,10 @@ You may want to map this command to a key; try putting `nnoremap <F5>
Calling this command will fill Vim's `locationlist` with errors or warnings if Calling this command will fill Vim's `locationlist` with errors or warnings if
any were detected in your file and then open it. any were detected in your file and then open it.
The `g:ycm_open_loclist_on_ycm_diags` option can be used to prevent the location
list from opening, but still have it filled with new diagnostic data. See the
_Options_ section for details.
### The `:YcmShowDetailedDiagnostic` command ### The `:YcmShowDetailedDiagnostic` command
This command shows the full diagnostic text when the user's cursor is on the This command shows the full diagnostic text when the user's cursor is on the
@ -890,6 +894,17 @@ Default: `0`
let g:ycm_always_populate_location_list = 0 let g:ycm_always_populate_location_list = 0
### The `g:ycm_open_loclist_on_ycm_diags` option
When this option is set, `:YcmDiags` will automatically open the location list
after forcing a compilation and filling the list with diagnostic data.
See `:help location-list` in Vim to learn more about the location list.
Default: `1`
let g:ycm_open_loclist_on_ycm_diags = 1
### The `g:ycm_allow_changing_updatetime` option ### The `g:ycm_allow_changing_updatetime` option
When this option is set to `1`, YCM will change the `updatetime` Vim option to When this option is set to `1`, YCM will change the `updatetime` Vim option to

View File

@ -787,7 +787,10 @@ function! s:ShowDiagnostics()
\ 'ycm_state.GetDiagnosticsFromStoredRequest( qflist_format = True )' ) \ 'ycm_state.GetDiagnosticsFromStoredRequest( qflist_format = True )' )
if !empty( diags ) if !empty( diags )
call setloclist( 0, diags ) call setloclist( 0, diags )
if g:ycm_open_loclist_on_ycm_diags
lopen lopen
endif
else else
echom "No warnings or errors detected" echom "No warnings or errors detected"
endif endif

View File

@ -74,6 +74,9 @@ let g:loaded_youcompleteme = 1
let g:ycm_allow_changing_updatetime = let g:ycm_allow_changing_updatetime =
\ get( g:, 'ycm_allow_changing_updatetime', 1 ) \ get( g:, 'ycm_allow_changing_updatetime', 1 )
let g:ycm_open_loclist_on_ycm_diags =
\ get( g:, 'ycm_open_loclist_on_ycm_diags', 1 )
let g:ycm_add_preview_to_completeopt = let g:ycm_add_preview_to_completeopt =
\ get( g:, 'ycm_add_preview_to_completeopt', 0 ) \ get( g:, 'ycm_add_preview_to_completeopt', 0 )