Fix Python Function List not showing functions#9844
Fix Python Function List not showing functions#9844littlej541 wants to merge 1 commit intonotepad-plus-plus:masterfrom littlej541:python-function-list-fix
Conversation
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.
|
@littlej541 |
|
@littlej541 Providing the text of the file as well as the screenshots would have been helpful. |
|
@sasumner |
With the old regex, it searches for whitespace before the def. However, the class regex eats up all the whitespace right up to the def. This can be seen in when running the VS debugger and placing a breakpoint here or so and observing the targetStart and targetEnd values. The invisible functions will not show unless something is in between the class and function to allow some white space (a line break in this case) to be preserved before the def. I simply changed the whitespace requirement to a line start in the pull request so that the class can gobble up the whitespace all it wants and the function will still show. If it is not showing for you and you are using the new regex, I cannot say what's going on. I don't want to sound presumptuous, but you have placed the altered python.xml from the pull request in the appropriate location either in the %appdata%\Roaming\Notepad++\functionList folder or in the functionList folder in the exe directory? And you don't have another overwriting it from the %appdata% location if you have it in the exe directory? |
|
@donho Works for me. Maybe you replaced the regex on the wrong line? It's best to replace the entire |
|
@littlej541 @ArkadiuszMichalski |
| </classRange> | ||
| <function | ||
| mainExpr="\sdef\x20\K.+?(?=:)" | ||
| mainExpr="^def\x20\K.+?(?=:)" |
There was a problem hiding this comment.
@littlej541 Why not the same change on line 25?
There was a problem hiding this comment.
Line 25 is for function definitions inside classes. These need whitespace before them and so they will never be at the start of a line.

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.
Old regex:

New regex:
