SimpylFold should not get confused by `class` or `def` in docstrings.
Closed this issue · 1 comments
Here's a sample Python file:
class FoldingExample(object):
"""
This is a perfectly reasonable class.
Unfortunately, it accidentally happens to have the word
CLASS at the beginning of one of the lines of its docstring.
"""
I would expect this to have one fold, covering the "class FoldingExample" line all the way to the end. Instead, it has two folds: one covering "class FoldingExample" to "Unfortunately, it...", and one covering "CLASS at..." to the end.
Of course, this is with g:SimpylFold_fold_docstring
set to 0, if I set it to 1 then I would expect two folds but get three.
I've made the matching of class
and def
case-sensitive so that this will only occur if the word is all-lowercase. That doesn't really fix the issue, but at least it will occur in fewer cases than before.
Solving this in the general case would require actually parsing the Python code, which would make the implementation of this plugin overly complicated.