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.

Bug 153686 - Code Folding confused in python
Summary: Code Folding confused in python
Status: CLOSED DUPLICATE of bug 151932
Alias: None
Product: python
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 2 votes (vote)
Assignee: Torbjorn Norbye
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-22 00:50 UTC by Peter Lam
Modified: 2017-06-23 08:06 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Image of Problem (19.67 KB, image/png)
2008-11-22 00:52 UTC, Peter Lam
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Lam 2008-11-22 00:50:53 UTC
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.
Comment 1 Peter Lam 2008-11-22 00:52:16 UTC
Created attachment 74036 [details]
Image of Problem
Comment 2 andrew.blake 2010-03-10 08:44:36 UTC
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
Comment 3 andrew.blake 2010-03-10 08:45:22 UTC
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
Comment 4 Torbjorn Norbye 2010-03-10 09:36:22 UTC
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.
Comment 5 Jenselme 2017-06-22 22:06:54 UTC

*** This bug has been marked as a duplicate of bug 151932 ***
Comment 6 Jiri Kovalsky 2017-06-23 08:06:14 UTC
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.