Function List weirdness and sorting
dfs- last edited by dfs-
I am trying to generate a function list for a properitary format which has flavours of INI and looks like this:
[MAIN] ; This is a comment SETTING = VALUE ... [FORMAT] Layout,Display, ... Layout,Display2, ... Layout,Whatever, ... [END]
My parser should extract all those Layout definitions, what it currently does. It’s current state looks like this:
<?xml version="1.0" encoding="UTF-8" ?> <NotepadPlus> <functionList> <parser id="format" displayName="format" commentExpr="(?m-s:;.*$)"> <classRange mainExpr="(?i)^\h*[format].+?(?=\Z|^\h*[)"> <className> <nameExpr expr="\w+"/> </className> <function mainExpr="(?i)^\h*layout\h*,\h*\K[^\n,]+"> <functionName> <funcNameExpr expr=".*" /> </functionName> </function> </classRange> <function mainExpr="(?i)^\h*([)(?!end)(.*?)(])"> <functionName> <nameExpr expr="\w+"/> </functionName> </function> </parser> </functionList> </NotepadPlus>
My issues/questions are the following:
- despite coming last in the file, the FORMAT section is always placed at the top of the function list (happens in all languages, not just mine)
- performing the function list sort operation duplicates all layout definitions inside the FORMAT “class” (it doesn’t happen if I remove the [END] line
- is it a wanted limitation, that the FORMAT class cannot be double clicked?
- is there a way to force the function list to be sorted at all times?
Any help is appreciated.
I only now noticed, that the board has removed some escape characters.
The unaltered version can be found here:
Got it sorted out using
\Zin the classRange mainExpr. Something that is “wrong” in the python function parser list as well.
Then only the other issues remain:
- despite coming last in the file, the FORMAT section is always placed at the top of the function list
- is there a way to force the function list to be sorted at all times -> No!
- is it a wanted limitation, that the FORMAT class cannot be double clicked? -> Maybe. Doubleclick extends the Tree.
PeterJones last edited by PeterJones
To further clarify the Function List:
Each Class is meant as a container, not as an end-item in the list. Since you have defined the FORMAT as the class, and the
layoutinside the FORMAT as the function, it will list it as a hierarchy with a FORMAT container with multiple layouts inside.
Like with most hierarchical tree presentations, double-clicking on a container, rather than on an item in the container, is meant to open or close the container in that list; and that’s exactly what the Function List panel does. Double-clicking on an item inside that list (in general for Function List, the function inside the class; in your case, it is the layout inside the FORMAT) will perform the main action on that entry (in the case of Function List, going to that function inside that class).
The sorting that the Function List panel uses by default (when the A-Z button isn’t clicked) is to sort any classes by the order they appear in the file; within a given class, the functions are sorted by the order they appear inside that class; then finally, after all the classes, any functions that are found outside of any classes will be listed, in the order they are found.
For example, in my class-based-Perl customized Function List,
If you click the A-Z button, then each top-level item is sorted alphabetically (so classes may go before-or-after classless functions), and inside each class container, the functions are sorted alphabetically as well. In my class-based-Per example:
Thank you for your insight. I added a PR for my other “wishes”.