From 84402e755fa7ba4a98fa47e971f5e9622786eb60 Mon Sep 17 00:00:00 2001 From: Cyberslas Date: Sun, 9 May 2021 03:29:07 -0700 Subject: [PATCH] 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 --- .../FunctionList/python/baddeftest/unitTest | 25 +++++++++++++++++++ .../baddeftest/unitTest.expected.result | 1 + PowerEditor/installer/functionList/python.xml | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 PowerEditor/Test/FunctionList/python/baddeftest/unitTest create mode 100644 PowerEditor/Test/FunctionList/python/baddeftest/unitTest.expected.result diff --git a/PowerEditor/Test/FunctionList/python/baddeftest/unitTest b/PowerEditor/Test/FunctionList/python/baddeftest/unitTest new file mode 100644 index 000000000..141c48869 --- /dev/null +++ b/PowerEditor/Test/FunctionList/python/baddeftest/unitTest @@ -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 \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/python/baddeftest/unitTest.expected.result b/PowerEditor/Test/FunctionList/python/baddeftest/unitTest.expected.result new file mode 100644 index 000000000..acf1aba31 --- /dev/null +++ b/PowerEditor/Test/FunctionList/python/baddeftest/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["invisible_function1()","invisible_function2()","visible_function()"],"nodes":[{"leaves":["__init__(self)"],"name":"VisibleClass1"},{"leaves":["__init__(self)"],"name":"VisibleClass2"}],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/installer/functionList/python.xml b/PowerEditor/installer/functionList/python.xml index 3941bb949..ec138173c 100644 --- a/PowerEditor/installer/functionList/python.xml +++ b/PowerEditor/installer/functionList/python.xml @@ -30,7 +30,7 @@