I'm using VSCode to write Python code. I'd like to use #region foo and #endregion foo to provide custom folding. This sometimes works. When I say sometimes I mean it works for some instances but not others.
import pytest
from unittest.mock import Mock
def test_advanced_function_call_count(myfile, monkeypatch, mocker):
# region setup
monkeypatch.setattr(myfile, 'basic_function', Mock())
# endregion setup
# region execution
myfile.advanced_function2()
assert myfile.basic_function.call_count == 1
# endregion execution
In the above example I can fold # region setup but I can't fold # region execution. In my real code there doesn't appear to be a pattern of it only folding one region, the first region, or the last region. It appears to be random.
Any ideas what is preventing random regions from being able to fold?