icsharpcode / NRefactory

NRefactory - Refactoring Your C# Code
684 stars 261 forks source link

DocumentScript.FormatText is called during dispose #515

Closed robdcgnx closed 8 years ago

robdcgnx commented 8 years ago

Is there a reason for FormatText to be called during Dispose? I mean I'm finished using the object, why does it do more processing? I do a lot of modifications to a script which means the FormatText call takes a long time. For my script, it took 14s in 5.0.0, with 5.5.1 it improved to 3.7s, but it's still a long time.

mkrueger commented 8 years ago

Format text is called there because it closes the script operation. When inserting nodes they need to be formatted - that's why it's called there. Formatting isn't done on insert because formatting depends on how many things get inserted/removed so formatting needs to be done at the end.