-
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
Allow docstrings to happen anywhere in the code #18
Conversation
In Python docstring can happen just in the middle of the code, e.g. documentation for class or instance variables. So let's fold them. This also removes assumption that any string ending with '):' is an end for def: or class: (it can by if: or anything else).
The removal of the Additionally, the use of docstrings on instance variables is, in my admittedly subjective experience, very rare in Python. PEP 257 states that, while they are allowed, they do not get any of the special functionality associated with class and method docstrings (e.g. runtime accessibility via the In general, I am not particularly interested in supporting all of the nuances of technically-legal Python syntax; I only care that the common usage works correctly with this plugin. I would rather not introduce support for rarely-used syntax if that comes at the cost of heightened complexity. If you can accomplish this in a different way that does not cause regressions or significantly increase complexity, I'll consider merging it. |
It didn't reintroduce that bug. Strings that end with '):' are strings that don't end with ''. In fact I wanted to do this change not to allow rare docstrings to fold but to get rid of that '):' because it seemed... non-deterministic? |
Allow docstrings to happen anywhere in the code
You're right. I both misread your patch and wrote a flawed test case to verify it. Sorry about that! In that case, I think this looks good. Thanks! |
What do you think about adding automated testing here? I'd be happy to play with vim-vspec and see how it goes :) |
Testing would be a good thing to have, for sure. If you want to try that out, that would be great. |
In Python docstring can happen just in the middle of the code, e.g. documentation for class or instance variables. So let's fold them.
This also removes assumption that any string ending with '):' is an end for def: or class: (it can by if: or anything else).