public static IList<Edit> GetEditsAfterKeystroke(SyntaxTree syntaxTree, int position, char character, FormattingOptions options)
{
var location = syntaxTree.MapRootFilePosition(position);
// Find span of block / statement terminated by the character just typed.
var token = syntaxTree.Root.FindTokenOnLeft(location);
if (token.Text != character.ToString())
return new List<Edit>();
// Get span of node containing this token.
var span = token.Parent.GetTextSpanRoot();
if (span == TextSpan.None)
return new List<Edit>();
return GetEdits(syntaxTree, span, options);
}