removed a lot of the goto usages, used goto_assignments instead. Did the same also for a lot of definition uses

This commit is contained in:
David Halter
2013-05-03 21:26:11 +04:30
parent edd0a08351
commit 7c8fee1257
10 changed files with 41 additions and 40 deletions
+14 -13
View File
@@ -37,7 +37,7 @@ class NotFoundError(Exception):
class Script(object):
"""
A Script is the base for a completion, goto or whatever you want to do with
A Script is the base for completions, goto or whatever you want to do with
|jedi|.
:param source: The source code of the current file, separated by newlines.
@@ -264,13 +264,13 @@ class Script(object):
@api_classes._clear_caches_after_call
def goto_definitions(self):
"""
Return the definitions of a the path under the cursor. This is not a
goto function! This follows complicated paths and returns the end, not
the first definition. The big difference between :meth:`goto` and
:meth:`definition` is that :meth:`goto` doesn't follow imports and
statements. Multiple objects may be returned, because Python itself is
a dynamic language, which means depending on an option you can have two
different versions of a function.
Return the definitions of a the path under the cursor. goto function!
This follows complicated paths and returns the end, not the first
definition. The big difference between :meth:`goto_assignments` and
:meth:`goto_definitions` is that :meth:`goto_assignments` doesn't
follow imports and statements. Multiple objects may be returned,
because Python itself is a dynamic language, which means depending on
an option you can have two different versions of a function.
:rtype: list of :class:`api_classes.Definition`
"""
@@ -328,10 +328,10 @@ class Script(object):
@api_classes._clear_caches_after_call
def goto_assignments(self):
"""
Return the first definition found by goto. Imports and statements
aren't followed. Multiple objects may be returned, because Python
itself is a dynamic language, which means depending on an option you
can have two different versions of a function.
Return the first definition found. Imports and statements aren't
followed. Multiple objects may be returned, because Python itself is a
dynamic language, which means depending on an option you can have two
different versions of a function.
:rtype: list of :class:`api_classes.Definition`
"""
@@ -340,7 +340,8 @@ class Script(object):
def _goto(self, add_import_name=False):
"""
Used for goto and usages.
Used for goto_assignments and usages.
:param add_import_name: TODO add description
"""
def follow_inexistent_imports(defs):
+2 -2
View File
@@ -415,8 +415,8 @@ class Completion(BaseDefinition):
class Definition(BaseDefinition):
"""
*Definition* objects are returned from :meth:`api.Script.goto` or
:meth:`api.Script.definition`.
*Definition* objects are returned from :meth:`api.Script.goto_assignments`
or :meth:`api.Script.goto_definitions`.
"""
def __init__(self, definition):
super(Definition, self).__init__(definition, definition.start_pos)
+1 -1
View File
@@ -359,7 +359,7 @@ class SubModule(Scope, Module):
@property
def name(self):
""" This is used for the goto function. """
""" This is used for the goto functions. """
if self._name is not None:
return self._name
if self.path is None: