Skip to content

Commit 4f77d67

Browse files
committed
Version bump to v2.0.0-beta.25
+ Less verbose errors on libclang load failure
1 parent cc01856 commit 4f77d67

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

codeintel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.0-beta.24'
1+
__version__ = '2.0.0-beta.25'

codeintel/codeintel2/libclang.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,7 @@ def __init__(self, library_path=None, compilation_database_path=None, log=None):
177177
suggestion = "Are you sure '%s' contains libclang?" % library_path
178178
else:
179179
suggestion = "Consider setting library_path."
180-
self.log.exception(e)
181-
182-
print("Loading libclang failed, completion won't be available:", suggestion)
180+
self.log.error(suggestion)
183181
return
184182

185183
# Builtin Header Path
@@ -188,9 +186,7 @@ def __init__(self, library_path=None, compilation_database_path=None, log=None):
188186
self.builtin_header_path = self._getBuiltinHeaderPath(library_path)
189187

190188
if not self.builtin_header_path:
191-
print("WARNING: libclang can not find the builtin includes.")
192-
print(" This will cause slow code completion.")
193-
print(" Please report the problem.")
189+
self.log.warn("libclang can not find the builtin includes. This will cause slow code completion. Please report the problem.")
194190

195191
self.translationUnits = {}
196192
if compilation_database_path:
@@ -370,7 +366,6 @@ def _getCompileParams(self, fileName, flags=None):
370366
}
371367

372368
def _getCurrentTranslationUnit(self, args, fileName, fileBuffer=None, update=False):
373-
print('translationUnits args:', args)
374369
unsaved_files = [(fileName, encode(fileBuffer))] if fileBuffer else None
375370

376371
tu = self.translationUnits.get(fileName)
@@ -414,13 +409,13 @@ def getCurrentCompletions(self, fileName, line, column, fileBuffer=None, flags=N
414409
with self.libclangLock:
415410
tu = self._getCurrentTranslationUnit(params['args'], fileName, fileBuffer)
416411
if tu is None:
417-
print("Couldn't get the TranslationUnit")
412+
self.log.info("Couldn't get the TranslationUnit. The following arguments are used for clang: %s", " ".join(decode(params['args'])))
418413
return None
419414

420415
unsaved_files = [(fileName, encode(fileBuffer))] if fileBuffer else None
421416
cr = tu.codeComplete(fileName, line, column, unsaved_files=unsaved_files, include_macros=include_macros, include_code_patterns=include_code_patterns, include_brief_comments=include_brief_comments)
422417
if cr is None:
423-
print("Cannot parse this source file. The following arguments are used for clang: " + " ".join(decode(params['args'])))
418+
self.log.info("Cannot parse this source file. The following arguments are used for clang: %s", " ".join(decode(params['args'])))
424419
return None
425420

426421
results = cr.results
@@ -445,7 +440,7 @@ def gotoDeclaration(self, fileName, line, column, fileBuffer=None, flags=None):
445440
with self.libclangLock:
446441
tu = self._getCurrentTranslationUnit(params['args'], fileName, fileBuffer, update=True)
447442
if tu is None:
448-
print("Couldn't get the TranslationUnit")
443+
self.log.info("Couldn't get the TranslationUnit. The following arguments are used for clang: %s", " ".join(decode(params['args'])))
449444
return None
450445

451446
f = cindex.File.from_name(tu, fileName)

0 commit comments

Comments
 (0)