Triggering syntastic error display more often
This commit is contained in:
parent
57bd4f7a47
commit
333b71f8d5
@ -25,7 +25,6 @@ let s:searched_and_no_results_found = 0
|
||||
let s:should_use_clang = 0
|
||||
let s:completion_start_column = 0
|
||||
let s:omnifunc_mode = 0
|
||||
let g:ycm_min_num_of_chars_for_completion = 2
|
||||
|
||||
function! youcompleteme#Enable()
|
||||
" If the user set the current filetype as a filetype that YCM should ignore,
|
||||
@ -36,7 +35,8 @@ function! youcompleteme#Enable()
|
||||
|
||||
augroup youcompleteme
|
||||
autocmd!
|
||||
autocmd CursorMovedI * call s:OnMovedI()
|
||||
autocmd CursorMovedI * call s:OnCursorMovedInsertMode()
|
||||
" autocmd CursorMoved * call s:OnCursorMovedNormalMode()
|
||||
" Note that these events will NOT trigger for the file vim is started with;
|
||||
" so if you do "vim foo.cc", these events will not trigger when that buffer
|
||||
" is read. This is because youcompleteme#Enable() is called on VimEnter and
|
||||
@ -94,6 +94,7 @@ endfunction
|
||||
|
||||
function! s:OnCursorHold()
|
||||
call s:ParseFile()
|
||||
call s:UpdateDiagnosticNotifications()
|
||||
endfunction
|
||||
|
||||
|
||||
@ -122,14 +123,27 @@ function! s:SetCompleteFunc()
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:OnMovedI()
|
||||
function! s:OnCursorMovedInsertMode()
|
||||
call s:IdentifierFinishedOperations()
|
||||
call s:InvokeCompletion()
|
||||
endfunction
|
||||
|
||||
|
||||
" function! s:OnCursorMovedNormalMode()
|
||||
" call s:UpdateDiagnosticNotifications()
|
||||
" endfunction
|
||||
|
||||
|
||||
function! s:OnInsertLeave()
|
||||
let s:omnifunc_mode = 0
|
||||
call s:UpdateDiagnosticNotifications()
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:UpdateDiagnosticNotifications()
|
||||
if g:loaded_syntastic_plugin && s:ClangEnabledForCurrentFile()
|
||||
SyntasticCheck
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
@ -275,6 +289,9 @@ function! youcompleteme#ClangOmniComplete( findstart, base )
|
||||
endfunction
|
||||
|
||||
|
||||
" This is what Syntastic calls indirectly when it decides an auto-check is
|
||||
" required (currently that's on buffer save) OR when the SyntasticCheck command
|
||||
" is invoked
|
||||
function! youcompleteme#CurrentFileDiagnostics()
|
||||
if s:ClangEnabledForCurrentFile()
|
||||
return pyeval( 'clangcomp.GetDiagnosticsForCurrentFile()' )
|
||||
|
@ -340,6 +340,8 @@ void ClangCompleter::SetFileCompileFlags(
|
||||
std::vector< Diagnostic > ClangCompleter::DiagnosticsForFile(
|
||||
const std::string &filename )
|
||||
{
|
||||
// TODO: make sure that accessing the translation unit is thread safe; what if
|
||||
// a bg thread is parsing the TU when we try to access the diagnostics?
|
||||
CXTranslationUnit unit = FindWithDefault( filename_to_translation_unit_,
|
||||
filename,
|
||||
NULL );
|
||||
|
@ -99,6 +99,7 @@ BOOST_PYTHON_MODULE(indexer)
|
||||
.def( "SetFileCompileFlags", &ClangCompleter::SetFileCompileFlags )
|
||||
.def( "DiagnosticsForFile", &ClangCompleter::DiagnosticsForFile )
|
||||
.def( "UpdatingTranslationUnit", &ClangCompleter::UpdatingTranslationUnit )
|
||||
.def( "UpdateTranslationUnit", &ClangCompleter::UpdateTranslationUnit )
|
||||
.def( "UpdateTranslationUnitAsync",
|
||||
&ClangCompleter::UpdateTranslationUnitAsync )
|
||||
.def( "CandidatesForQueryAndLocationInFileAsync",
|
||||
|
@ -179,12 +179,13 @@ class ClangCompleter( Completer ):
|
||||
|
||||
|
||||
def OnFileReadyToParse( self ):
|
||||
self.future = self.completer.UpdateTranslationUnitAsync(
|
||||
vim.current.buffer.name,
|
||||
self.completer.UpdateTranslationUnitAsync( vim.current.buffer.name,
|
||||
self.GetUnsavedFilesVector() )
|
||||
|
||||
|
||||
def GetDiagnosticsForCurrentFile( self ):
|
||||
if self.completer.UpdatingTranslationUnit():
|
||||
return []
|
||||
return [ DiagnosticToDict( x ) for x in
|
||||
self.completer.DiagnosticsForFile( vim.current.buffer.name ) ]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user