Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions pythonFiles/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,21 @@ def _top_definition(definition):

_definitions = []
for definition in definitions:
if definition.module_path:
if definition.type == 'import':
definition = _top_definition(definition)

_definition = {
'text': definition.name,
'type': self._get_definition_type(definition),
'fileName': definition.module_path,
'line': definition.line - 1,
'column': definition.column
}
_definitions.append(_definition)
try:
if definition.module_path:
if definition.type == 'import':
definition = _top_definition(definition)

_definition = {
'text': definition.name,
'type': self._get_definition_type(definition),
'fileName': definition.module_path,
'line': definition.line - 1,
'column': definition.column
}
_definitions.append(_definition)
except Exception as e:
pass
return json.dumps({'id': identifier, 'results': _definitions})

def _serialize_usages(self, usages, identifier=None):
Expand Down Expand Up @@ -278,7 +281,8 @@ def _process_request(self, request):
return self._write_response(self._serialize_definitions(
jedi.api.names(
source=request['source'],
path=request.get('path', '')),
path=request.get('path', ''),
all_scopes=True),
request['id']))

script = jedi.api.Script(
Expand Down