public int Format(TextDocument textDocument, uint offset, uint length, int cursor)
{
bool replaceCursor = cursor >= 0 ? true : false;
if (!replaceCursor)
{
cursor = 0;
}
var replacements = ClangFormat.FormatXml(textDocument.Text, offset, length, (uint)cursor,
ClangFormatSettings.Default);
return ApplyReplacements(textDocument, cursor, replacements, replaceCursor);
}