-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fold multiline docstrings. #9
Conversation
Implementation is not strict but works fine.
Thanks for your contribution! Just a few comments:
|
Hello. Thanks for swift response.
The first line of a docstring is usually a very short definition of what the method/class/module do. So if we fold it, we would hide only detailed explanation keeping the necessary information visible. Well-written docstrings for classes are of the same size or even bigger than methods in it. So if we have foldlevel=1 (as I set it in .vimrc), we'll see classes with huge docstrings and short list of methods. I think, the point of folding is to get as much high-level information on the screen as possible with as less scrolling as possible. That's exactly what we get when we fold these docstrings: class, short info on what it does, list of it's methods. Well, of course we can hide this behind an option. But isn't "no configuration needed" a cool thing? :) |
OK, that sounds reasonable to me. If you can just fix up the single/double quotes issue, I'll merge it. I agree that zero configuration is good, but flexible configuration with well-chosen defaults is even better, in my opinion. That said, I think it will be fine to have this enabled by default, though I may add an option to disable it at some point. |
What about folding long doctests in the multiline docstring as well as a separate embedded fold? |
@reckoner |
Something like:
folds like
and then unfolds to
and then unfolds again to
and then unfolds again to
I hope that helps. |
@YorikSar I apologize for taking so long to merge this. I missed the second commit you added and forgot to come back and check on this ticket until today. Anyway, it's merged now. Thanks again for contributing. I see the utility in your suggestion, but I feel that it probably exceeds the upper threshold of complexity that I'd like to include in this plugin. As I mentioned in an earlier comment, there are a lot of things that we could fold in Python code, but which I have deliberately chosen not to in order to keep the plugin simple. I am open to discussing it further, but I'd suggest opening a separate issue for that, so that we can consider this one closed. |
@tmhedberg, no worries. I just realized that GH doesn't send notifications on new commits for pull requests myself. |
Hi @tmhedberg, I'm one of folks who would prefer to keep this turned off most of the time. My docstrings are usually just a few lines long and I prefer the simpler "see it all or don't see it at all" behavior for methods and classes. Is there a configuration variable I can use to turn off the folding of docstrings? |
No, I've never gotten around to adding that option. For personal reasons, I probably won't be able to work on this in the very near future, but this should be a pretty simple feature to add, and I'd welcome a patch for it, if you're so inclined. |
Sure Taylor, let me take a look and see if I can work it out. I'm an experienced programmer, but haven't written any Vimscript yet. I've been dipping in and out of Steve Losh's text on it though so this will make a good exercise :) |
Implementation is not strict but works fine.