Add a "fold all docstrings" command #3933
Replies: 6 comments 8 replies
-
Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue. |
Beta Was this translation helpful? Give feedback.
-
Thank you to everyone who upvoted this issue! Since the community showed interest in this feature request we will leave this issue open as something to consider implementing at some point in the future. We do encourage people to continue 👍 the first/opening comment as it helps us prioritize our work based on what the community seems to want the most. |
Beta Was this translation helpful? Give feedback.
-
Actually, I'm afraid we made a mistake and this is actually a Pylance feature request that we should have forwarded! I'll rectify that right now. |
Beta Was this translation helpful? Give feedback.
-
+1 this is one of my most sought after features when working with python and vscode. Somewhat offtopic and would be a new feature request, but I would also really appreciate the ability to toggle type hint notations. I am tempted to write something general purpose which stashes them in stub files |
Beta Was this translation helpful? Give feedback.
-
I would really like this feature as well. Meanwhile, this is in progress, I made a quick and dirty VScode extension called Toggle Docstrings, which does the job for me. (https://marketplace.visualstudio.com/items?itemName=vikasdubey055.toggle-docstrings) to fold docstrings. Here is how it works: |
Beta Was this translation helpful? Give feedback.
-
You can add me to the list of souls that want this feature. I tried some other hacks and extensions, but it's not working for me. I usually follow the google style guide and I use the docstrings also for documentation, so the docstring content is fairly long at times and include sample code etc. The side affect of this is that the bulk of your editor window is comments and scrolling even to the next method in a class can become a point of frustration. My current preference is to rely more on the "outline" and navigate through my code that way - but the amount of text from the docstrings still creates a distraction. So, the only way for me to get work done is to manually go through the entire code file an collapse each docstring manually. This is not really ideal. |
Beta Was this translation helpful? Give feedback.
-
Docstrings covering all input parameters, types and precise function/class descriptions can become quite long and get in the way of the actual code. Usually, you only need to look into them when writing them or when looking up a specific function/class and it would be preferable to have them folded most of the time. You can do this by clicking the arrow next to the line numbers for each of them. This becomes tedious for files with a lot of docstrings, though.
There exists the "fold all block comments" command in VS Code but docstrings are not considered as block comments since they have the same format as multi-line strings and you wouldn't want to fold them away (see microsoft/vscode-python#20330).
Proposal: a "fold all docstrings" command that, well, folds all docstrings, so multi-line strings that are the first item in a function/class definition.
Alternative proposal: classify all multi-line strings as block comments that are are not inside of a function call or variable assignment. This would be consistent with the "toggle block comment" command that wraps the selection in triple quotes. Creating a block comment like this but then not being able to fold it with "fold all block comments" seems contradictory.
Beta Was this translation helpful? Give feedback.
All reactions