Comments (6)
from simpylfold.
I can confirm this is occurring in my Vim setup exactly as nabeel-ms describes it.
However, If I close the file and then I open it again, the folds are correct again.
from simpylfold.
Please paste the output of :set foldmethod? foldexpr? foldlevel? foldminlines? foldnestmax?
.
What is the state of the existing folds in the file at the time that you add the additional line at the end? Are they open or closed?
I'm still not seeing this behavior, so I'm trying to figure out what's different for me.
It would still be helpful if you could try this with all plugins except for this one disabled. A lot of weird problems can be caused by the interaction between multiple plugins that weren't designed to work together, since Vim doesn't really isolate them.
from simpylfold.
The output is as follows:
foldmethod=expr
foldexpr=SimpylFold#FoldExpr(v:lnum)
foldlevel=3
foldminlines=1
foldnestmax=20
I have uninstalled all my plugins excluding YouCompleteMe.
In this case, to avoid issues, I used zR
to reopen all folds before appending. I still encountered the same issues. However, it should be noted that when I use zx
to recompute the folds in the file, the file folding is fixed and has no issues.
from simpylfold.
I've encountered the same issue. Thanks for the zx
workaround!
This is my output of running the above:
foldexpr=SimpylFold#FoldExpr(v:lnum)
foldlevel=0
foldminlines=1
foldnestmax=20
I removed all my config and left only this plugin then I was able to replicate with a file like the following:
def some_fuction(var):
var = 1 + 2
Then I added and an extra line:
def some_fuction(var):
var = 1 + 2
var2 =2
Then press <Esc>
to go back to normal mode and then zm
and this is what I got:
+-- 2 lines: def some_fuction(var):------------------------
var2 = 2
from simpylfold.
Hi all -
I suspect this has something to do with the caching of the folds. I have a similar issue whereby if I add lines before a fold, all subsequent folds get messed up badly upon saving. This technically sounds closer to #112 but since the video there is no longer accessible I'm not sure if the behaviour is the same.
With git bisect
I find that the behaviour was introduced in commit 2dfeb35.
zx
alone does not work for me, unfortunately. I find that I need to regenerate the cache, so the following autocmd (which I placed in ~/.vim/after/ftplugin/python.vim
) solves my issue:
function UpdateFolds()
call SimpylFold#Recache()
FastFoldUpdate!
endfunction
autocmd BufWritePre <buffer> call UpdateFolds()
There is probably a tiny bit of lag especially with large files, but since it's only triggered upon saving (which takes a while anyway), it's quite difficult to notice. On a 1200-line file it takes me 100–200 ms to recalculate the folds and write the buffer. One could probably use normal zx
in place of FastFoldUpdate!
if FastFold isn't installed.
from simpylfold.
Related Issues (20)
- Folds are invalid after running formatter with ale HOT 3
- Releases Support HOT 1
- More configuration HOT 2
- SimpylFold with large modules makes basic operations slow HOT 3
- Auto close fold include current line after delete line HOT 5
- Comment BLOCKS (in file licenses)
- Plugin ceases to work if a module is named after its parent directory HOT 1
- docstring folding not working with empty line HOT 2
- Support folding long block of code by indentation? HOT 4
- Plugin is not working on Ubuntu Vi IMproved 8.0 HOT 3
- Folds only exist after using zx (E490: No fold found) when using "telescope" fzf plugin HOT 6
- Support for other languages? HOT 1
- is it possible to have only 1 line separating folds ? HOT 2
- the function/class names should have an higher contrast than the lines numbers HOT 3
- Possibility of defining custom folds? HOT 1
- Repository not found HOT 1
- Folding Code in Child Classes HOT 2
- SimpylFold won't indent top level functions HOT 4
- Can't turn off docstring folding HOT 5
- SimpylFold not working (E490: no fold found) on macOS Sonoma with Vundle HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simpylfold.