Closed mmadrid closed 1 year ago
Try :SimpylFoldDocstring!
and then reload the buffer.
This is counterintuitive behavior and the documentation is misleading; changing the configuration variable directly doesn't seem to have the intended effect. This is likely due to how we're caching folds. The command invalidates the cache, but changing the variable does not.
Try
:SimpylFoldDocstring!
and then reload the buffer.This is counterintuitive behavior and the documentation is misleading; changing the configuration variable directly doesn't seem to have the intended effect. This is likely due to how we're caching folds. The command invalidates the cache, but changing the variable does not.
Thanks for the reply. This doesn't do anything.
If that's the case, then I don't know what to tell you. It works for me when I run the command and reload.
Adding let g:SimpylFold_fold_docstring = 0
to my .vimrc
also works. However, changing the config variable after Vim has already loaded a Python buffer has no effect.
This is actually a misunderstanding on my part. It works as intended. What I thought g:SimpylFold_fold_docstring = 0
would do is not fold the docstring (and thus not the function def either), but fold the rest of the function contents so that I would always be able to see the docstring (something like below). I realize now that that is not the intended functionality, and that I'm not sure I want that anyway. It was a good exersize in learning about folding in Vim!
def a_function():
"""This is a multiline docstring
It prints out three lines of stuff
"""
+-- 3 lines: print("Some stuff")··························
I thought exactly the same thing, that the docstring would be visible but the code would be folded, because what I was looking forward is to get an overview of the code and see whether functions should be renamed.
The documentation/README needs to be updated to make this clear IMO. Like you I lost quite some time figuring why my docstrings would stay folded.
I'm probably missing something simple, but I can't get docstring folding turned off.
I have tested in a completely clean environment with no other plugins or filetype settings. Here's my setup:
Ubuntu 22.04.1 LTS Python 3.11.1
NVIM v0.7.2 Build type: Release LuaJIT 2.1.0-beta3 Compiled by team+vim@tracker.debian.org Features: +acl +iconv +tui
:checkhealth
set foldexpr?
foldexpr=SimpylFold#FoldExpr(v:lnum)set foldmethod?
foldmethod=exprinit.vim:
python code:
Folded code:
Note that SimpylFold_docstring_preview does work if I turn that on. I'd really like to use this feature. What am I missing?
Thanks in advance