Included FunctionList is not compatible with the most Java files
-
I use Notepad++ 6.7.9.2 and noticed that the included function list is not compatible with the most Java files. I only have limited RegExp abilities, so I don’t fully understand the RegExp at the functionList.xml. Maybe someone can help me with it?
Of course, if everything works like expected after fixing that, it would be nice to have this in the official release, but I can open an issue in the BugTracker with the solution, as soon as I have one.
Here an example Java file, where the FunctionList is displaying nothing (I know much more, but they are quite similar to this one):
JTS3ServerQuery.java
Very simple Java files without any comments and other stuff working fine. But more complex Java files don’t work. -
I was looking at this, I figured out the problem is really really simple:
It expects the file ends with a blank line – or a comment, or anything that can make the last function closing tag “}” not the last character in the file. -
Hello Ricardo,
Many thanks for your clever solution !
Of course, I downloaded the Java file of Stefan1200_de but was unable to find the problem :-(( I tried to do some tests, changing the regular expressions of the Java parser, in the functionList.xml file, without any positive result.
BTW, I’m not sure but I think that the regex for comments, in the Java parser, is invalid.
Instead, of the form
((/\*.*?\*)/|(//.**$))
, it should, simply, be written/\*.*?\*/|//.*?$
Best Regards,
guy038
-
I’ve tested clearing
commentExpr
for java and php in functionList.xml but it simply didn’t chance anything when exhibiting files (yes, restarted Npp). Do you confirm?I think comments might be controlled by Scintilla source, more exactly LexCPP.cxx
-
Hi Ricardo,
The part of the Java regex comments that is invalid is the second part :
(//.**$)
. However, in PHP, the comments regex seems OK.Anyway, I think that you’re right about the control of comments. Indeed, I did some tests and whatever the part
commentExpr="((/\*.*?\*)/|(//.**$))
is present or NOT, it doesn’t change, at all, the behaviour of FunctionList !?
For instance, if I add the text, below
public Test() { }
anywhere, inside a Java file, the functionList, normally, shows this fonction, on saving the Java file
As soon as I surround this fonction by comments character as :
/* public Test() */ { }
or as :
/** public Test() **/ { }
or as :
// public Test() { }
FunctionList DOESN’T list, as expected, the function Test
Results are similar, after deleting the
commentexpr
part, of the Java parser, and restarting N++. So, as you said, it must be handled at Scintilla level. Otherwise, it should have showed the Test function, although the function Test is glued in comments !Unfortunately, my poor programmer skills prevent me to go further, in that matter :-((
Cheers,
guy038
-
Hello Ricardo and Guy038,
thanks for being investigative at this topic.
I’m not sure how to solve this issue. Is this solvable by changing the functionList.xml file, or do I have to file a bug report at the bug tracker?
Best Regards,
Stefan -
With Notepad++ v7 I still have this problems. Can someone help fixing this? Thanks in advance. :)