Skip to content

Commit

Permalink
Make navigation to definitions follow imports
Browse files Browse the repository at this point in the history
This fixes microsoft#1638 and simplifies the code (to what I believe that
@davidhalter had in mind in
microsoft#1033 (comment)).

This change means that all of the test cases recently added to
'navigation.tests.ts' now pass, meaning that navigtion to the
definition of functions works through imports and goes to the
original function, even when that function is decorated.
  • Loading branch information
PeterJCLaw committed May 19, 2018
1 parent d1e5eb9 commit baa6310
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions pythonFiles/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,21 +570,7 @@ def _process_request(self, request):
sys_path=sys.path, environment=self.environment)

if lookup == 'definitions':
defs = []
try:
defs = self._get_definitionsx(script.goto_definitions(follow_imports=False), request['id'])
except:
pass
try:
if len(defs) == 0:
defs = self._get_definitionsx(script.goto_definitions(), request['id'])
except:
pass
try:
if len(defs) == 0:
defs = self._get_definitionsx(script.goto_assignments(), request['id'])
except:
pass
defs = self._get_definitionsx(script.goto_assignments(follow_imports=True), request['id'])
return json.dumps({'id': request['id'], 'results': defs})
if lookup == 'tooltip':
if jediPreview:
Expand Down

0 comments on commit baa6310

Please sign in to comment.