thehogfather / brackets-code-folding

Code folding extension for brackets IDE
134 stars 42 forks source link

Randomly folding #12

Closed mistic100 closed 11 years ago

mistic100 commented 11 years ago

Hello

I have a small issue with your extension : it regularly folds part of the code, randomly and without any action from me.

It happens on all files (css, js, html) and apparently when I'm switching between files.

thehogfather commented 11 years ago

Some more information would be useful. Are there any steps I can take to reproduce the issue?

Note that the extension currently tries to remember the fold settings per file opened. If a file is opened and edited outside of brackets, or if you have more than one instance of brackets opened, then this might cause folding to occur in a potentially undefined manner. But this is a guess. It would be good to have more details if you can.

mistic100 commented 11 years ago

I said "randomly" because I didn't see any special steps to reproduce it :-) I use Brackets everyday and it happens constantly during the day. I can only guess it happens when changing current file.

I don't use any other editor on my project.

thehogfather commented 11 years ago

ok thanks for the info :) -- it seems that the extension reloads/reinstates the saved linefolds every time the active editor is changed. Fix in progress.

Here is how you can reproduce my version

  1. Open brackets and fold some code regions in file A.
  2. Close brackets (so that code fold extension saves the folds for the open editor - file A).
  3. Reopen brackets (so that code fold extension restores previously saved folds in file A).
  4. Expand some folded regions in file A.
  5. Open another file (file B) in the same project
  6. Switch back to file A.

Outcome: extension restores fold to the state they were in step 3. Expected: folds should be as they were after some folded regions were expanded in step 4.

Please confirm if this summarises your issue.

Thanks for reporting!

mistic100 commented 11 years ago

I reproduce this, but I think it also happen without closing Brackets. I absolutely don't know how and when you store folding states, but perhaps it doesn't save everytime we switch between files, so when switching back to a previous file the state is "old".

thehogfather commented 11 years ago

This should now be fixed. I'd appreciate some tests whenever you get some time.

Cheers

mistic100 commented 11 years ago

I update it now and tell you tomorow if it happens again (I might forget so... no news good news :-) )

mistic100 commented 11 years ago

seems to be ok, at least I don't get any folded blocks I didn't folded previously

but I realized a small incompatibility with Brackets Right-Trim plugin, when I save the file, Right-Trim is applied causing all blocks to unfold, it's absolutely not a big deal and Code Folding seems to handle it nicely (the folding state is saved aftermath and I don't get inconsistant states)

thehogfather commented 11 years ago

Thanks I shall take note of that issue in a new ticket.