forked from VimPlug/jedi
sith readability
This commit is contained in:
7
sith.py
7
sith.py
@@ -143,9 +143,10 @@ class TestCase(object):
|
|||||||
def show_location(self, lineno, column, show=3):
|
def show_location(self, lineno, column, show=3):
|
||||||
# Three lines ought to be enough
|
# Three lines ought to be enough
|
||||||
lower = lineno - show if lineno - show > 0 else 0
|
lower = lineno - show if lineno - show > 0 else 0
|
||||||
|
prefix = ' |'
|
||||||
for i, line in enumerate(self.script.source.split('\n')[lower:lineno]):
|
for i, line in enumerate(self.script.source.split('\n')[lower:lineno]):
|
||||||
print(lower + i + 1, line)
|
print(prefix, lower + i + 1, line)
|
||||||
print(' ' * (column + len(str(lineno))), '^')
|
print(prefix, ' ', ' ' * (column + len(str(lineno))), '^')
|
||||||
|
|
||||||
def show_operation(self):
|
def show_operation(self):
|
||||||
print("%s:\n" % self.operation.capitalize())
|
print("%s:\n" % self.operation.capitalize())
|
||||||
@@ -174,6 +175,8 @@ class TestCase(object):
|
|||||||
def show_goto_definitions(self):
|
def show_goto_definitions(self):
|
||||||
for completion in self.objects:
|
for completion in self.objects:
|
||||||
print(completion.desc_with_module)
|
print(completion.desc_with_module)
|
||||||
|
if completion.module_path is None:
|
||||||
|
continue
|
||||||
if os.path.abspath(completion.module_path) == os.path.abspath(self.path):
|
if os.path.abspath(completion.module_path) == os.path.abspath(self.path):
|
||||||
self.show_location(completion.line, completion.column)
|
self.show_location(completion.line, completion.column)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user