thehogfather / brackets-code-folding

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

beautify extension colapse compacted blocks when is called #31

Open cmnstmntmn opened 11 years ago

cmnstmntmn commented 11 years ago

test scenario

  1. item
  2. item

then collapse the ol element; after that, try to use ALT + CTRL + L (beautify command)

you'll notice that the colapsed blocks will get expanded.

thehogfather commented 11 years ago

This is an interesting problem - and I would be happy for any suggestions on any elegant ways to fix it. As far as I can tell, beautifying a document sometimes changes the line numbers of statements in the file. So a folded statement may be moved to a new line when beautified. This means we cannot simply cache the line folds before formatting and then restore them after formatting.

One workaround is to format a subset of the document by selecting a code region before formatting.