1
0
forked from VimPlug/jedi

Fix an error of get_definition_end_pos, see #1584

This commit is contained in:
Dave Halter
2020-05-18 01:44:27 +02:00
parent fa6194c0a9
commit 8fdf16b316
2 changed files with 6 additions and 3 deletions

View File

@@ -236,7 +236,7 @@ class BaseName(object):
The (row, column) of the start of the definition range. Rows start with
1, columns start with 0.
:rtype: Tuple[int, int]
:rtype: Optional[Tuple[int, int]]
"""
definition = self._name.tree_name.get_definition()
if definition is None:
@@ -248,11 +248,13 @@ class BaseName(object):
The (row, column) of the end of the definition range. Rows start with
1, columns start with 0.
:rtype: Tuple[int, int]
:rtype: Optional[Tuple[int, int]]
"""
definition = self._name.tree_name.get_definition()
if definition is None:
return self._name.end_pos
if self._name.tree_name is None:
return None
return self._name.tree_name.end_pos
if self.type in ("function", "class"):
last_leaf = definition.get_last_leaf()
if last_leaf.type == "newline":