Can no longer fold python dictionaries in VS Code
Question:
I used to be able to collapse (fold) python dictionaries just fine in my VS Code. Randomly I am not able to do that anymore. I can still fold classes and functions just fine, but dictionaries cannot fold, the arrow on the left hand side just isn’t there. I’ve checked my settings but I can’t figure out what would’ve changed. I’m not sure the best forum to go to for help, so I’m hoping this is ok. Any ideas?
Answers:
With the help of yoonghm’s comment, I found out it was the Pylance by Microsoft extension causing the issue.
It’s caused by Pylance v2022.1.1. Use v2022.1.0 instead.
Issue #2248
It is the latest Pylance version 2022.1.1 caused it, the issue has been raised in the github
You could install the older version:
- Go to Extensions,
- Find Pylance and click on the setting to Install Another Version.
For me, it wasn’t a problem with Pylance but rather with Jupyter[*] extensions.
I disabled all my extensions and enabled them one by one. See that enabling the Python extension will not just enable Python extension. I disabled Jupyter related extensions and Pylance wasn’t the problem.
I can also confirm that the Jupyter notebook VSCode extensions was the culprit for me. It doesn’t disable just the dictionary folding. It straight up disables any code folding abilities in the .py files.
I used to be able to collapse (fold) python dictionaries just fine in my VS Code. Randomly I am not able to do that anymore. I can still fold classes and functions just fine, but dictionaries cannot fold, the arrow on the left hand side just isn’t there. I’ve checked my settings but I can’t figure out what would’ve changed. I’m not sure the best forum to go to for help, so I’m hoping this is ok. Any ideas?
With the help of yoonghm’s comment, I found out it was the Pylance by Microsoft extension causing the issue.
It’s caused by Pylance v2022.1.1. Use v2022.1.0 instead.
Issue #2248
It is the latest Pylance version 2022.1.1 caused it, the issue has been raised in the github
You could install the older version:
- Go to Extensions,
- Find Pylance and click on the setting to Install Another Version.
For me, it wasn’t a problem with Pylance but rather with Jupyter[*] extensions.
I disabled all my extensions and enabled them one by one. See that enabling the Python extension will not just enable Python extension. I disabled Jupyter related extensions and Pylance wasn’t the problem.
I can also confirm that the Jupyter notebook VSCode extensions was the culprit for me. It doesn’t disable just the dictionary folding. It straight up disables any code folding abilities in the .py files.