AvalonStudio.Languages.CPlusPlus.CPlusPlusLanguageService.Format C# (CSharp) Method

Format() public method

public Format ( TextDocument textDocument, uint offset, uint length, int cursor ) : int
textDocument AvalonStudio.TextEditor.Document.TextDocument
offset uint
length uint
cursor int
return int
        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);
        }