regex in functionList/php.xml to display a specific comment in functionlist
-
Hello.
I have been using version 7.8.4 so far.
For better clarity in long procedural PHP source code, I have made a small additionn. All lines of code that begin with “###mainblock:” are displayed like a function in the function list on a right area.
I have extended the functionList.xml under functionList > parser > function as follows:
<function mainExpr="^\s*(function|###mainblock:)\s+[\.\w]+\s*\(">
Unfortunately, this no longer works in version 8.7.4. The RegEx for source code parsing has been greatly expanded there. There I have the file functionlist/php.xml.
If I extend the MainExpression there under functionList > parser > function accordingly:
(?-i:function|###mainblock:)\s+
But it does not work. It is not displayed as an entry in the function list. I suspect it is because of the # , which is why the whole line is treated as a comment. But this is necessary, because it is only comment. After 4 hours of trial and error, I have to give up and hope for a little help from you. please
What I have to do so that in version 8.7.4 a line like ###mainblock(‘my_title’) {} is displayed in the function list?
-
@Tom_1978 said in regex in functionList/php.xml to display a specific comment in functionlist:
I have been using version 7.8.4 so far.
If that’s not a typo, then that was pretty old. And the FunctionList definitions changed around v7.9. The user manual has a section on updating old definitions to the “new” style. If you want a definition from pre-7.9 to work in modern v8.7.4, you’ll have to follow those instructions.
-
-
@PeterJones Yes, I know. My old Notepad++Version was already very old. That’s why I updated it. I have also seen and read the documentation. Unfortunately, I’m not experienced with regex and spent 6 hours today trying it out in vain. I was hoping that you could help me. I’m sure it’s just a small thing.
I just want a specific keyword from a comment line to cause that comment line to be included in the function list on the right side of the Notpad++.
I would be very happy if someone could help me.
-
@Tom_1978 This changeset in the year 2020 modified
commentExpr
to include single line comments that start with#
.Line 19 in
php.xml
sets#
and//
as comment zones not valid for matching. Changing or removing that line may help to get back the v8.7.4 behavior though their might be some side effects as the other patterns have changed so much. -
@mpheath Your are a legend! Thanks. It works. :-)
Unfortunately, my reputation is too low. That’s why I’m not allowed to give your post a positive vote.