Skip to content

Commit b552c8b

Browse files
committed
Catch exception while traversing definitions
fix issue : https://github.com/DonJayamanne/pythonVSCode/issues/58
1 parent 2a7c9b5 commit b552c8b

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

pythonFiles/completion.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,21 @@ def _top_definition(definition):
205205

206206
_definitions = []
207207
for definition in definitions:
208-
if definition.module_path:
209-
if definition.type == 'import':
210-
definition = _top_definition(definition)
211-
212-
_definition = {
213-
'text': definition.name,
214-
'type': self._get_definition_type(definition),
215-
'fileName': definition.module_path,
216-
'line': definition.line - 1,
217-
'column': definition.column
218-
}
219-
_definitions.append(_definition)
208+
try:
209+
if definition.module_path:
210+
if definition.type == 'import':
211+
definition = _top_definition(definition)
212+
213+
_definition = {
214+
'text': definition.name,
215+
'type': self._get_definition_type(definition),
216+
'fileName': definition.module_path,
217+
'line': definition.line - 1,
218+
'column': definition.column
219+
}
220+
_definitions.append(_definition)
221+
except Exception as e:
222+
pass
220223
return json.dumps({'id': identifier, 'results': _definitions})
221224

222225
def _serialize_usages(self, usages, identifier=None):

0 commit comments

Comments
 (0)