SimpylFold
SimpylFold copied to clipboard
Option to start definition fold after docstring
It would be nice to have a config option to always display the docstring, even when the method is folded.
What do you mean by "always display the docstring"? Please, elaborate.
So even when folded:
def method(): " Docstring " +-- 20 lines ------------
Fold the method body but not its declaration or docstring?
I vote against implementing this, as it increases code complexity and predictability of folds for little gain.
I agree. Unless we start seeing a significant number of requests for this, I don't think it's worth the added complexity.
I would use this feature, if it were implemented.
Opposite of this issue #93
I'd like to have this feature also. Somehow it's nice to read all/a half/visual of folds docstrings.
I also want this feature.
I was also looking for an option to toggle this, but there appears to be none. +1 for this feature. Seeing the function header (with all the syntax coloring etc - the fold itself is colorless) increases readability. Using the builtin indent fold behaviour you get this feature as a side effect. Unfortunately the indent fold has other problems.
+1. I was looking for an option where, when I open a python file, all method implementations are folded, but all the function headers and docs are visible. E.g.,
def foo():
"""
does the thing
"""
[+] FOLDED
Leaving a comment here as this feature is closest to the behaviour I'd be expecting from folds. I am actually a little annoyed by the fact that there is no option to fold only the body of namespaces (class/method/function definition), i.e. results one would get when using vim's native set foldmethod=indent. Having the definitions included into the fold removes syntax highlighting from them and messes up the indentation.
So I think having the option to fold only the 'body' together with the already present functionality to include/exclude docstrings in the fold would constitute what people are asking for here.
Either way, thanks for the plugin, I really appreciate the conscious choice of keeping the feature set small.
Added screenshot to clarify 'body' folding

The screenshot above really shows why this feature is so needed. It allows you to identify interesting/relevant parts of the code, which are not always obvious from the method name (particularly when there are similar methods). As a security person, I too appreciate keeping code to a minimum, but I can't see this adding significant complexity.
Would love to see something similar to @fprawits 's screenshot.. I like the folding but really wish I still had the highlighting on the function signature and just the body folded.