Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Region folding not working at last region, if region only contains indented code #3375

Closed
brettcannon opened this issue Sep 20, 2022 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@brettcannon
Copy link
Member

Discussed in microsoft/vscode-python#19815

Originally posted by Roffelkopter5 September 12, 2022
I have a Python class with a lot of diffrent methods, wich I want to group into regions. For the first 5 regions the folding works perfectly normal, but after the the region PROPERTIES it just stops working.

Here is a stripped down version of my code.

# Bunch of imports


class Sprite:
    def __init__(self):
        ...

    # region MOTION

    def change_pos(self):
        ...

    # Some other functions

    def bounce_on_edge(self):
        ...

    # endregion

    # region LOOKS

    def set_image(self):
        ...

    # Some other functions

    def show(self):
        ...

    # endregion

    # region EVENTS

    def on_key(self):
        ...

    # Some other functions

    def clone(self):
        ...

    # endregion

    # region CONTROLS

    def wait(self):
        ...

    # Some other functions

    def repeat_until(self):
        ...

    # endregion

    # region PROPERTIES

    @property
    def image(self):
        ...

    # Some other functions

    @property
    def name(self):
        ...

    # endregion

    # region PRIVATE

    def _update(self):
        ...

    # Some other methods

    def _scale_and_rotate(self):
        ...
    # endregion

After further testing I noticed, that the problem does not occur espacially at the fith region, but on the last one. And the nature of the problem seems to lie in the fact that the region only contains indented Code. I don't know if this behaviour is intentional, or if there's an easy fix for it, but it's kind of annoying not being able to collapse the last region.

I hope I described the problem clearly and that my english is not too bad :)

@karrtikr karrtikr transferred this issue from microsoft/vscode-python Sep 21, 2022
@debonte
Copy link
Contributor

debonte commented Sep 21, 2022

Simplified form:

class Sprite:
    # region PRIVATE

    def _update(self):
        ...

    # endregion

This is a duplicate of #3290

@debonte debonte closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2022
@debonte debonte added the duplicate This issue or pull request already exists label Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants