Posted 21 years ago
by GMilano

I'm going to implement Code Snippets similar to the whidbey. For example when I write foreach I would like to replace for
foreach ( $Type$ $Var$ in $Collection$)
{
MessageBox.Show($Var$.ToString())
}
After replacing the $Type$ should be selected, press tab and $Var$ should be selected (all that seems not dificult) but my problem is now because when I'm modifing the text of $Var$ the text before the ToString (I mean the text before ToString is $Var$ too) should be modified to because is the same reference.
I'm new using SyntaxEditor , I would like to know if there is some feature that help me in order to implement this last point.
I would like to implement this in a easy way like:
suppose that I'm already processed the other things and in some spans variable have all text spans
TextSpans spans = GetSpans("$Var");
OnKeyDown(char c)
{
InsertTextOnSpans(c, spans); // This should do the work of insert the character in a couple of text spans
}
foreach ( $Type$ $Var$ in $Collection$)
{
MessageBox.Show($Var$.ToString())
}
After replacing the $Type$ should be selected, press tab and $Var$ should be selected (all that seems not dificult) but my problem is now because when I'm modifing the text of $Var$ the text before the ToString (I mean the text before ToString is $Var$ too) should be modified to because is the same reference.
I'm new using SyntaxEditor , I would like to know if there is some feature that help me in order to implement this last point.
I would like to implement this in a easy way like:
suppose that I'm already processed the other things and in some spans variable have all text spans
TextSpans spans = GetSpans("$Var");
OnKeyDown(char c)
{
InsertTextOnSpans(c, spans); // This should do the work of insert the character in a couple of text spans
}