Beispiel #1
0
        public override void OnBeforeSave(object sender, Document aDocument)
        {
            var clangFormatOptionPage = GetUserOptions();

            if (false == clangFormatOptionPage.EnableFormatOnSave)
            {
                return;
            }

            if (false == Vsix.IsDocumentDirty(aDocument))
            {
                return;
            }

            if (false == FileHasExtension(aDocument.FullName, clangFormatOptionPage.FileExtensions))
            {
                return;
            }

            if (true == SkipFile(aDocument.FullName, clangFormatOptionPage.SkipFiles))
            {
                return;
            }

            var option = GetUserOptions().Clone();

            option.FallbackStyle = "none";

            FormatDocument(aDocument, option);
        }