PY-20003 Fixed: Breadcrumbs for Python files

Introduce PyBreadcrumbsInfoProvider which supports:
classes and functions (incl. async) definitions,
lambdas, try-except-else-finally, if-elif-else,
for-else (incl. async), while-else, with and
key-value statements
This commit is contained in:
Semyon Proshev
2016-12-20 18:21:50 +03:00
committed by Semyon Proshev
parent f54070028a
commit cde66f2f64
61 changed files with 557 additions and 2 deletions
+3
View File
@@ -0,0 +1,3 @@
async def foo():
async for i in range(10):
print(<caret>i)
@@ -0,0 +1,8 @@
Crumb:
async foo()
Tooltip:
async foo()
Crumb:
async for i in …
Tooltip:
async for i in range(10)
@@ -0,0 +1,3 @@
async def foo():
async with open("file.txt"), open("file2.txt"):
print("a<caret>bc")
@@ -0,0 +1,3 @@
async def foo():
async with open("file.txt") as f, open("file2.txt") as f2:
print("a<caret>bc")
@@ -0,0 +1,8 @@
Crumb:
async foo()
Tooltip:
async foo()
Crumb:
async with open…
Tooltip:
async with open("file.txt") as f, open("file2.txt") as f2
@@ -0,0 +1,8 @@
Crumb:
async foo()
Tooltip:
async foo()
Crumb:
async with open…
Tooltip:
async with open("file.txt"), open("file2.txt")
+3
View File
@@ -0,0 +1,3 @@
async def foo():
async with open("file.txt"):
print("a<caret>bc")
@@ -0,0 +1,3 @@
async def foo():
async with open("file.txt") as f:
print("a<caret>bc")
@@ -0,0 +1,8 @@
Crumb:
async foo()
Tooltip:
async foo()
Crumb:
async with open…
Tooltip:
async with open("file.txt") as f
@@ -0,0 +1,8 @@
Crumb:
async foo()
Tooltip:
async foo()
Crumb:
async with open…
Tooltip:
async with open("file.txt")
+2
View File
@@ -0,0 +1,2 @@
class A:
pa<caret>ss
@@ -0,0 +1,4 @@
Crumb:
A
Tooltip:
A
+1
View File
@@ -0,0 +1 @@
a = {"abc": "d<caret>ef"}
@@ -0,0 +1,4 @@
Crumb:
"abc"
Tooltip:
"abc"
+4
View File
@@ -0,0 +1,4 @@
if True:
print "abc"
elif False:
print "d<caret>ef"
@@ -0,0 +1,4 @@
Crumb:
elif False
Tooltip:
elif False
+4
View File
@@ -0,0 +1,4 @@
try:
print "abc"
except KeyError:
print "d<caret>ef"
+4
View File
@@ -0,0 +1,4 @@
try:
print "abc"
except:
print "d<caret>ef"
@@ -0,0 +1,4 @@
Crumb:
except
Tooltip:
except
+4
View File
@@ -0,0 +1,4 @@
try:
print "abc"
except KeyError as e:
print "d<caret>ef"
@@ -0,0 +1,4 @@
Crumb:
except KeyError…
Tooltip:
except KeyError as e
@@ -0,0 +1,4 @@
Crumb:
except KeyError
Tooltip:
except KeyError
+4
View File
@@ -0,0 +1,4 @@
try:
print "abc"
finally:
print "d<caret>ef"
@@ -0,0 +1,4 @@
Crumb:
finally
Tooltip:
finally
+2
View File
@@ -0,0 +1,2 @@
for i in range(10):
print <caret>i
+4
View File
@@ -0,0 +1,4 @@
for i in range(10):
print i
else:
print "a<caret>bc"
@@ -0,0 +1,4 @@
Crumb:
else
Tooltip:
else
@@ -0,0 +1,4 @@
Crumb:
for i in range(…
Tooltip:
for i in range(10)
+2
View File
@@ -0,0 +1,2 @@
def foo(self):
pa<caret>ss
@@ -0,0 +1,4 @@
Crumb:
foo()
Tooltip:
foo()
+2
View File
@@ -0,0 +1,2 @@
if True:
print "a<caret>bc"
+4
View File
@@ -0,0 +1,4 @@
if True:
print "abc"
else:
print "d<caret>ef"
@@ -0,0 +1,4 @@
Crumb:
else
Tooltip:
else
@@ -0,0 +1,4 @@
Crumb:
if True
Tooltip:
if True
+1
View File
@@ -0,0 +1 @@
map(lambda x, y: <caret>x * y, [])
@@ -0,0 +1,4 @@
Crumb:
lambda (x, y)
Tooltip:
lambda (x, y)
@@ -0,0 +1 @@
map(lambda a, aa, aaa, aaaa, aaaaa, aaaaaa, aaaaaaa, aaaaaaaa, aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaa, aaaaaaaaaaaa: <caret>a * a, [])
@@ -0,0 +1,4 @@
Crumb:
lambda (a, aa, …
Tooltip:
lambda (a, aa, aaa, aaaa, aaaaa, aaaaaa, aaaaaaa, aaaaaaaa, aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaa,…
+3
View File
@@ -0,0 +1,3 @@
class A:
def foo(self):
pa<caret>ss
@@ -0,0 +1,8 @@
Crumb:
A
Tooltip:
A
Crumb:
foo()
Tooltip:
foo()
@@ -0,0 +1,2 @@
with open("file.txt"), open("file2.txt"):
print("a<caret>bc")
@@ -0,0 +1,2 @@
with open("file.txt") as f, open("file2.txt") as f2:
print("a<caret>bc")
@@ -0,0 +1,4 @@
Crumb:
with open("file…
Tooltip:
with open("file.txt") as f, open("file2.txt") as f2
@@ -0,0 +1,4 @@
Crumb:
with open("file…
Tooltip:
with open("file.txt"), open("file2.txt")
+4
View File
@@ -0,0 +1,4 @@
try:
print "a<caret>bc"
finally:
print "def"
+6
View File
@@ -0,0 +1,6 @@
try:
print "abc"
except:
print "def"
else:
print "g<caret>hi"
@@ -0,0 +1,4 @@
Crumb:
else
Tooltip:
else
@@ -0,0 +1,4 @@
Crumb:
try
Tooltip:
try
+3
View File
@@ -0,0 +1,3 @@
i = 10
while i < 30:
print <caret>i
+5
View File
@@ -0,0 +1,5 @@
i = 10
while i < 30:
print i
else:
print "a<caret>bc"
@@ -0,0 +1,4 @@
Crumb:
else
Tooltip:
else
@@ -0,0 +1,4 @@
Crumb:
while i < 30
Tooltip:
while i < 30
+2
View File
@@ -0,0 +1,2 @@
with open("file.txt"):
print("a<caret>bc")
+2
View File
@@ -0,0 +1,2 @@
with open("file.txt") as f:
print("a<caret>bc")
@@ -0,0 +1,4 @@
Crumb:
with open("file…
Tooltip:
with open("file.txt") as f
@@ -0,0 +1,4 @@
Crumb:
with open("file…
Tooltip:
with open("file.txt")