Fix Python Function List not showing functions

Functions defined at the top of the file or below a class with nothing in between would not show in the Function List.
This changes the function regex to fix this. A small unit test that the old regex won't pass but the new will included.

Close #9844
pull/9737/head
Cyberslas 4 years ago committed by Don HO
parent 582a424d55
commit 84402e755f

@ -0,0 +1,25 @@
def invisible_function1(): # invisible because at file start
pass
class VisibleClass1:
def __init__(self):
pass
def invisible_function2(): # invisible because nothing but linebreaks between VisibleClass1 and invisible_function2
pass
class VisibleClass2:
def __init__(self):
pass
# visible because there is something between VisibleClass2 and visible_function
def visible_function():
pass

@ -0,0 +1 @@
{"leaves":["invisible_function1()","invisible_function2()","visible_function()"],"nodes":[{"leaves":["__init__(self)"],"name":"VisibleClass1"},{"leaves":["__init__(self)"],"name":"VisibleClass2"}],"root":"unitTest"}

@ -30,7 +30,7 @@
</function>
</classRange>
<function
mainExpr="\sdef\x20\K.+?(?=:)"
mainExpr="^def\x20\K.+?(?=:)"
>
<functionName>
<nameExpr expr=".*" />

Loading…
Cancel
Save