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:should_use_clang = 0
|
||||||
let s:completion_start_column = 0
|
let s:completion_start_column = 0
|
||||||
let s:omnifunc_mode = 0
|
let s:omnifunc_mode = 0
|
||||||
let g:ycm_min_num_of_chars_for_completion = 2
|
|
||||||
|
|
||||||
function! youcompleteme#Enable()
|
function! youcompleteme#Enable()
|
||||||
" If the user set the current filetype as a filetype that YCM should ignore,
|
" If the user set the current filetype as a filetype that YCM should ignore,
|
||||||
@ -36,7 +35,8 @@ function! youcompleteme#Enable()
|
|||||||
|
|
||||||
augroup youcompleteme
|
augroup youcompleteme
|
||||||
autocmd!
|
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;
|
" 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
|
" 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
|
" is read. This is because youcompleteme#Enable() is called on VimEnter and
|
||||||
@ -94,6 +94,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:OnCursorHold()
|
function! s:OnCursorHold()
|
||||||
call s:ParseFile()
|
call s:ParseFile()
|
||||||
|
call s:UpdateDiagnosticNotifications()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
@ -122,14 +123,27 @@ function! s:SetCompleteFunc()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:OnMovedI()
|
function! s:OnCursorMovedInsertMode()
|
||||||
call s:IdentifierFinishedOperations()
|
call s:IdentifierFinishedOperations()
|
||||||
call s:InvokeCompletion()
|
call s:InvokeCompletion()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" function! s:OnCursorMovedNormalMode()
|
||||||
|
" call s:UpdateDiagnosticNotifications()
|
||||||
|
" endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:OnInsertLeave()
|
function! s:OnInsertLeave()
|
||||||
let s:omnifunc_mode = 0
|
let s:omnifunc_mode = 0
|
||||||
|
call s:UpdateDiagnosticNotifications()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! s:UpdateDiagnosticNotifications()
|
||||||
|
if g:loaded_syntastic_plugin && s:ClangEnabledForCurrentFile()
|
||||||
|
SyntasticCheck
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
@ -275,6 +289,9 @@ function! youcompleteme#ClangOmniComplete( findstart, base )
|
|||||||
endfunction
|
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()
|
function! youcompleteme#CurrentFileDiagnostics()
|
||||||
if s:ClangEnabledForCurrentFile()
|
if s:ClangEnabledForCurrentFile()
|
||||||
return pyeval( 'clangcomp.GetDiagnosticsForCurrentFile()' )
|
return pyeval( 'clangcomp.GetDiagnosticsForCurrentFile()' )
|
||||||
|
@ -340,6 +340,8 @@ void ClangCompleter::SetFileCompileFlags(
|
|||||||
std::vector< Diagnostic > ClangCompleter::DiagnosticsForFile(
|
std::vector< Diagnostic > ClangCompleter::DiagnosticsForFile(
|
||||||
const std::string &filename )
|
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_,
|
CXTranslationUnit unit = FindWithDefault( filename_to_translation_unit_,
|
||||||
filename,
|
filename,
|
||||||
NULL );
|
NULL );
|
||||||
|
@ -99,6 +99,7 @@ BOOST_PYTHON_MODULE(indexer)
|
|||||||
.def( "SetFileCompileFlags", &ClangCompleter::SetFileCompileFlags )
|
.def( "SetFileCompileFlags", &ClangCompleter::SetFileCompileFlags )
|
||||||
.def( "DiagnosticsForFile", &ClangCompleter::DiagnosticsForFile )
|
.def( "DiagnosticsForFile", &ClangCompleter::DiagnosticsForFile )
|
||||||
.def( "UpdatingTranslationUnit", &ClangCompleter::UpdatingTranslationUnit )
|
.def( "UpdatingTranslationUnit", &ClangCompleter::UpdatingTranslationUnit )
|
||||||
|
.def( "UpdateTranslationUnit", &ClangCompleter::UpdateTranslationUnit )
|
||||||
.def( "UpdateTranslationUnitAsync",
|
.def( "UpdateTranslationUnitAsync",
|
||||||
&ClangCompleter::UpdateTranslationUnitAsync )
|
&ClangCompleter::UpdateTranslationUnitAsync )
|
||||||
.def( "CandidatesForQueryAndLocationInFileAsync",
|
.def( "CandidatesForQueryAndLocationInFileAsync",
|
||||||
|
@ -179,12 +179,13 @@ class ClangCompleter( Completer ):
|
|||||||
|
|
||||||
|
|
||||||
def OnFileReadyToParse( self ):
|
def OnFileReadyToParse( self ):
|
||||||
self.future = self.completer.UpdateTranslationUnitAsync(
|
self.completer.UpdateTranslationUnitAsync( vim.current.buffer.name,
|
||||||
vim.current.buffer.name,
|
|
||||||
self.GetUnsavedFilesVector() )
|
self.GetUnsavedFilesVector() )
|
||||||
|
|
||||||
|
|
||||||
def GetDiagnosticsForCurrentFile( self ):
|
def GetDiagnosticsForCurrentFile( self ):
|
||||||
|
if self.completer.UpdatingTranslationUnit():
|
||||||
|
return []
|
||||||
return [ DiagnosticToDict( x ) for x in
|
return [ DiagnosticToDict( x ) for x in
|
||||||
self.completer.DiagnosticsForFile( vim.current.buffer.name ) ]
|
self.completer.DiagnosticsForFile( vim.current.buffer.name ) ]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user