Vasily-X / AutoFoldCode

A Sublime Text package that saves/restores folded code regions in files automatically.
25 stars 5 forks source link

git merges #8

Closed ghost closed 5 years ago

ghost commented 5 years ago

Package works great, but I have noticed that when the using source control like git folds are lost after merging branches. Do you think it's something that could be developed to prevent this scenario?

acheronfail commented 5 years ago

I've just tried to replicate this a few times, but I haven't been able to do it.

Any chance you can create a small scenario where you see this happening?

ghost commented 5 years ago

i have made folds on master branch. I start to work on the new feature so I branch of the master branch. I work on the same file (keeping previous folds). Once the feature is finished I push all changes. Then I switch back to master, merge the feature branch and all folds are gone.

If you need any more details I do not mind creating a little screen-recording

acheronfail commented 5 years ago

We've made some changes (today) to the internals of AutoFoldCode since you've created your issue. In order to maintain code folds across file saves and also hot exits, we've opted for an approach that saves the hash of the file and this is used to match the folds to each file.

That notwithstanding, any earlier versions would also not have worked for your use case. 😞

Unfortunately, since you're merging your files their content changes, and so it's impossible for AutoFoldCode to know if the regions it has saved for each code fold are still valid. Since any changes to the file will most likely invalidate the folds.

I'm afraid that as far as I can tell there's no viable way to solve your problem.

ghost commented 5 years ago

that is fair enough, thanks for considering anyway