AvalonStudio.Languages.CSharp.IndentationReformatter.Reformat C# (CSharp) Method

Reformat() public method

public Reformat ( IDocumentAccessor doc, IndentationSettings set ) : void
doc IDocumentAccessor
set IndentationSettings
return void
        public void Reformat(IDocumentAccessor doc, IndentationSettings set)
        {
            Init();

            while (doc.MoveNext())
            {
                Step(doc, set);
            }
        }

Usage Example

Example #1
0
        /// <summary>
        ///     Performs indentation using the specified document accessor.
        /// </summary>
        /// <param name="document">Object used for accessing the document line-by-line</param>
        /// <param name="keepEmptyLines">Specifies whether empty lines should be kept</param>
        public int Indent(IDocumentAccessor document, bool keepEmptyLines, int caretIndex)
        {
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }
            var settings = new IndentationSettings();

            settings.IndentString    = IndentationString;
            settings.LeaveEmptyLines = keepEmptyLines;

            var r = new IndentationReformatter();

            r.Reformat(document, settings);

            return(caretIndex);
        }