This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Transferred from https://nbpython.dev.java.net/issues/show_bug.cgi?id=20 I was playing around with m7, and noticed that sometimes code folding is getting confused. Attached are two screenshots. The first shows the contents of the file that I was using, unfolded. The second shows what happened when I tried to fold the 'doit' method on class 'ted'. You can see that the defintion of 'redoit' gets pulled up next to the folded code, which shouldn't happen.
Created attachment 74036 [details] Image of Problem
This bug makes code folding unusable. Folding at class level works ok. However, folding of methods within a class fail. It appears to append the following method onto the line being collapsed. Less importantly, if the final method happens to be on the last line of the file and you fold that method, the last character of the method appears at the end of the folded line. e.g. [BEFORE folding] class TestClass1: def test1(self): pass def test2(self): pass def test3(self): pass [AFTER folding] class TestClass1: def test1(self): [{...}] def test2(self): pass def test3(self): pass
The problem here is that the source offsets from the Jython parsetree are off. For certain operations, like refactoring, we correct for this by manually checking certain things (like when you rename a function name, we look for the actual offset of the corresponding name string in the source document and adjust the offset if necessary). This is too expensive to do during folding hierarchy updates for all fold regions - the root cause (AST offsets in the Jython parser) must be fixed.
*** This bug has been marked as a duplicate of bug 151932 ***
Thanks for your evaluation Julien. Reporter, if you think your issue is still valid and needs to be addressed, don't hesitate to reopen it with additional information. Closing for now.