def DebugInfo(self, request_data): filename = request_data['filepath'] if not filename: return '' flags = self._FlagsForRequest(request_data) or [] source = extra_conf_store.ModuleFileForSourceFile(filename) return 'Flags for {0} loaded from {1}:\n{2}'.format( filename, source, list(flags))
def OnFileReadyToParse(self, request_data): # Only load the extra conf. We don't need it for anything but Format. extra_conf_store.ModuleFileForSourceFile(request_data['filepath']) self._Reload(request_data) diagnostics = self.GetDiagnosticsForCurrentFile(request_data) filepath = request_data['filepath'] with self._latest_diagnostics_for_file_lock: self._latest_diagnostics_for_file[filepath] = diagnostics return responses.BuildDiagnosticResponse( diagnostics, filepath, self.max_diagnostics_to_display)
def DebugInfo( self, request_data ): filename = request_data[ 'filepath' ] try: extra_conf = extra_conf_store.ModuleFileForSourceFile( filename ) except UnknownExtraConf as error: return ( 'C-family completer debug information:\n' ' Configuration file found but not loaded\n' ' Configuration path: {0}'.format( error.extra_conf_file ) ) try: # Note that it only raises NoExtraConfDetected: # - when extra_conf is None and, # - there is no compilation database flags = self._FlagsForRequest( request_data ) except NoExtraConfDetected: # No flags return ( 'C-family completer debug information:\n' ' No configuration file found\n' ' No compilation database found' ) # If _FlagsForRequest returns None or raises, we use an empty list in # practice. flags = flags or [] if extra_conf: # We got the flags from the extra conf file return ( 'C-family completer debug information:\n' ' Configuration file found and loaded\n' ' Configuration path: {0}\n' ' Flags: {1}'.format( extra_conf, list( flags ) ) ) try: database = self._flags.FindCompilationDatabase( os.path.dirname( filename ) ) except NoCompilationDatabase: # No flags return ( 'C-family completer debug information:\n' ' No configuration file found\n' ' No compilation database found' ) # We got the flags from the compilation database return ( 'C-family completer debug information:\n' ' No configuration file found\n' ' Using compilation database from: {0}\n' ' Flags: {1}'.format( database.database_directory, list( flags ) ) )
def DebugInfo(self, request_data): filename = request_data['filepath'] try: extra_conf = extra_conf_store.ModuleFileForSourceFile(filename) flags = self._FlagsForRequest(request_data) or [] except NoExtraConfDetected: return ('C-family completer debug information:\n' ' No configuration file found') except UnknownExtraConf as error: return ('C-family completer debug information:\n' ' Configuration file found but not loaded\n' ' Configuration path: {0}'.format(error.extra_conf_file)) if not extra_conf: return ('C-family completer debug information:\n' ' No configuration file found') return ('C-family completer debug information:\n' ' Configuration file found and loaded\n' ' Configuration path: {0}\n' ' Flags: {1}'.format(extra_conf, list(flags)))
def DebugInfo(): _logger.info('Received debug info request') request_data = RequestWrap(request.json) has_clang_support = ycm_core.HasClangSupport() clang_version = ycm_core.ClangVersion() if has_clang_support else None filepath = request_data['filepath'] try: extra_conf_path = extra_conf_store.ModuleFileForSourceFile(filepath) is_loaded = bool(extra_conf_path) except UnknownExtraConf as error: extra_conf_path = error.extra_conf_file is_loaded = False response = { 'python': { 'executable': sys.executable, 'version': platform.python_version() }, 'clang': { 'has_support': has_clang_support, 'version': clang_version }, 'extra_conf': { 'path': extra_conf_path, 'is_loaded': is_loaded }, 'completer': None } try: response['completer'] = _GetCompleterForRequestData( request_data).DebugInfo(request_data) except Exception as error: _logger.exception(error) return _JsonResponse(response)