From 861546fac03c6fd16646cc09fc11013145d6041f Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sun, 13 Dec 2015 19:28:24 +0000 Subject: [PATCH] Display errors raised by OnFileReadyToParse in non-diagnostics filetypes --- autoload/youcompleteme.vim | 1 + python/ycm/youcompleteme.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 9158331f..8836b275 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -601,6 +601,7 @@ function! s:UpdateDiagnosticNotifications() \ s:DiagnosticUiSupportedForCurrentFiletype() if !should_display_diagnostics + py ycm_state.ValidateParseRequest() return endif diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index b5b84011..b5a7f6a9 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -484,6 +484,29 @@ class YouCompleteMe( object ): self.GetDiagnosticsFromStoredRequest() ) + def ValidateParseRequest( self ): + if ( self.DiagnosticsForCurrentFileReady() and + self.NativeFiletypeCompletionUsable() ): + + # For filetypes which don't support diagnostics, we just want to check the + # _latest_file_parse_request for any exception or UnknownExtraConf + # response. We don't actually use the results (which are diagnositcs) + # otherwise. FIXME: should the client even _know_ which filetypes support + # diagnostics? Even if it should, it should be told by the sever. + self._latest_file_parse_request.Response() + + # We set the diagnostics request to None because we want to prevent + # repeated issuing of the same warnings/errors/prompts. Setting this to + # None makes DiagnosticsForCurrentFileReady return False until the next + # request is created. + # + # Note: it is the server's responsibility to determine the frequency of + # error/warning/prompts when receiving a FileReadyToParse event, but + # it our responsibility to ensure that we only apply the + # warning/error/prompt received once (for each event). + self._latest_file_parse_request = None + + def ShowDetailedDiagnostic( self ): if not self.IsServerAlive(): return