Folding user regions in Pycharm do not work after certain levels of indentation

Pycharm folding user regions do not seem to work after certain levels of indentation.

This work does not work:

def test_a():
    def function():
        for g in group:
            if g[0] is not "BLA":
                task(g)  # <editor-fold desc="# Log...">
                logger.debug('Log this')  # Log  #  </editor-fold>

It works:

def test_b():
    def function():
        for g in group:
            task(g)  # <editor-fold desc="# Log...">
            logger.debug('Log this')  # Log  #  </editor-fold>

The VisualStudio style (#region, #endregion) does not work in this scenario either. This problem only occurs when line comments are placed at the end of lines.

Thanks for the help for the help!

+4
source share
1 answer

My workaround for this issue with VisualStudio style (#region, #endregion) is as follows:

# region test
def test_a():
    def function():
        for g in group:
            if g[0] is not "BLA":
                task(g)
                logger.debug('Log this')
pass
# endregion

In python code, I just add passto the end of the scope. If anyone finds a better solution, answer.

UPD: - : https://youtrack.jetbrains.com/issue/PY-17017

UPD: ! 2017.3!

0

All Articles