my vs2008 addin for textformatting is awfully slow

02/07/2009 - 09:40 von tob | Report spam
Hi folks,
i wrote a little addin, which does some formatting of my C# code.
in the addins Exec method i do the following

try {
TextSelection selection =
(EnvDTE.TextSelection)_applicationObject.ActiveDocument.Selection;
String foo = String.Empty;
if (!text.IsEmpty) {
foo = someCoolObjectThatFormatsText.Format(selection.Text);
selection.Text = foobar; // here everything gets painfully slow :-(
}
}
catch (Exception) {
throw;
}

when the line with the code "SelectedText.Text = foobar;" is call, VS
rebuilds each line of the selection step by step. You can easily watch it
doing this step. But i don't get, why it is that slow.

Any hints?
TIA
 

Lesen sie die antworten

#1 tob
02/07/2009 - 11:43 | Warnen spam
Hopla,
der Ursprungspost sollte eigtnlich nach microsoft.public.vstudio.extensibility
daher das viele Englisch. Sorry ;-)
aber ich nehme natürlich auch gerne hier antworten entgegen :-)

grüße tob

"tob" wrote:
Hi folks,
i wrote a little addin, which does some formatting of my C# code.
in the addins Exec method i do the following

try {
TextSelection selection =
(EnvDTE.TextSelection)_applicationObject.ActiveDocument.Selection;
String foo = String.Empty;
if (!text.IsEmpty) {
foo = someCoolObjectThatFormatsText.Format(selection.Text);
selection.Text = foobar; // here everything gets painfully slow :-(
}
}
catch (Exception) {
throw;
}

when the line with the code "SelectedText.Text = foobar;" is call, VS
rebuilds each line of the selection step by step. You can easily watch it
doing this step. But i don't get, why it is that slow.

Any hints?
TIA

Ähnliche fragen