Alpha version for reformatting. After some test (more particularly with prepropressor directives), we definitely need a fully implemented lexical-parser in order to perform a correct reformatting.
コード例 #1
0
        private void DoFormatting(EditArray mgr, TextSpan span)
        {
            // Make sure there is one space after every comma unless followed
            // by a tab or comma is at end of line.
            IVsTextLines pBuffer = GetTextLines();

            if (pBuffer != null)
            {
                List <EditSpan> changeList = AsmHighlighterFormatHelper.ReformatCode(pBuffer, span, LanguageService.GetLanguagePreferences().TabSize);
                if (changeList != null)
                {
                    foreach (EditSpan editSpan in changeList)
                    {
                        // Add edit operation
                        mgr.Add(editSpan);
                    }
                }
            }
        }