mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-26 15:24:35 +02:00
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
This commit is contained in:
parent
582a424d55
commit
84402e755f
25
PowerEditor/Test/FunctionList/python/baddeftest/unitTest
Normal file
25
PowerEditor/Test/FunctionList/python/baddeftest/unitTest
Normal file
@ -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>
|
</function>
|
||||||
</classRange>
|
</classRange>
|
||||||
<function
|
<function
|
||||||
mainExpr="\sdef\x20\K.+?(?=:)"
|
mainExpr="^def\x20\K.+?(?=:)"
|
||||||
>
|
>
|
||||||
<functionName>
|
<functionName>
|
||||||
<nameExpr expr=".*" />
|
<nameExpr expr=".*" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user