mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 14:54:47 +08:00
sorted output for get_definition / goto
This commit is contained in:
@@ -238,7 +238,7 @@ def get_definition(source, line, column, source_path):
|
|||||||
|
|
||||||
d = set([Definition(s) for s in scopes])
|
d = set([Definition(s) for s in scopes])
|
||||||
_clear_caches()
|
_clear_caches()
|
||||||
return d
|
return sorted(d, key=lambda x: (x.module_path, x.start_pos))
|
||||||
|
|
||||||
|
|
||||||
def goto(source, line, column, source_path):
|
def goto(source, line, column, source_path):
|
||||||
@@ -264,7 +264,7 @@ def goto(source, line, column, source_path):
|
|||||||
|
|
||||||
d = [Definition(d) for d in set(definitions)]
|
d = [Definition(d) for d in set(definitions)]
|
||||||
_clear_caches()
|
_clear_caches()
|
||||||
return d
|
return sorted(d, key=lambda x: (x.module_path, x.start_pos))
|
||||||
|
|
||||||
|
|
||||||
def related_names(source, line, column, source_path):
|
def related_names(source, line, column, source_path):
|
||||||
|
|||||||
@@ -69,11 +69,11 @@ class TestRegression(unittest.TestCase):
|
|||||||
assert len(r[0].doc) > 100
|
assert len(r[0].doc) > 100
|
||||||
|
|
||||||
def test_get_definition_at_zero(self):
|
def test_get_definition_at_zero(self):
|
||||||
assert self.get_def("a", (1, 1)) == set()
|
assert self.get_def("a", (1, 1)) == []
|
||||||
s = self.get_def("str", (1, 1))
|
s = self.get_def("str", (1, 1))
|
||||||
assert len(s) == 1
|
assert len(s) == 1
|
||||||
assert list(s)[0].description == 'class str'
|
assert list(s)[0].description == 'class str'
|
||||||
assert self.get_def("", (1, 0)) == set()
|
assert self.get_def("", (1, 0)) == []
|
||||||
|
|
||||||
def test_complete_at_zero(self):
|
def test_complete_at_zero(self):
|
||||||
s = self.complete("str", (1, 3))
|
s = self.complete("str", (1, 3))
|
||||||
|
|||||||
Reference in New Issue
Block a user