コード例 #1
0
 private void SetSettingsModels(CompilerSettingsModel compilerModel, FormatSettingsModel formatModel, TidySettingsModel tidyModel, GeneralSettingsModel generalModel)
 {
     settingsProvider.SetCompilerSettingsModel(compilerModel);
     settingsProvider.SetFormatSettingsModel(formatModel);
     settingsProvider.SetTidySettingsModel(tidyModel);
     settingsProvider.SetGeneralSettingsModel(generalModel);
 }
コード例 #2
0
        private void BeforeSaveClangFormat(Document aDocument)
        {
            FormatSettingsModel formatSettings = settingsProvider.GetFormatSettingsModel();
            TidySettingsModel   tidySettings   = settingsProvider.GetTidySettingsModel();

            if (currentCommand == CommandIds.kTidyFixId && running && tidySettings.FormatAfterTidy && formatSettings.FormatOnSave)
            {
                mFormatAfterTidyFlag = true;
                return;
            }

            if (false == formatSettings.FormatOnSave)
            {
                return;
            }

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

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

            if (true == SkipFile(aDocument.FullName, formatSettings.FilesToIgnore))
            {
                return;
            }

            FormatCommand.Instance.FormatOnSave(aDocument);
        }
コード例 #3
0
 private void SetSettingsModels(CompilerSettingsModel compilerModel, FormatSettingsModel formatModel,
                                TidySettingsModel tidyModel, GeneralSettingsModel generalModel, LlvmSettingsModel llvmModel)
 {
     SettingsProvider.CompilerSettingsModel = compilerModel;
     SettingsProvider.FormatSettingsModel   = formatModel;
     SettingsProvider.TidySettingsModel     = tidyModel;
     SettingsProvider.GeneralSettingsModel  = generalModel;
     SettingsProvider.LlvmSettingsModel     = llvmModel;
 }
コード例 #4
0
        private void MapClangFormatOptionsToSettings(ClangFormatOptions clangFormat)
        {
            FormatSettingsModel formatSettingsModel = new FormatSettingsModel();
              formatSettingsModel.FileExtensions = clangFormat.FileExtensions;
              formatSettingsModel.FilesToIgnore = clangFormat.SkipFiles;
              formatSettingsModel.AssumeFilename = clangFormat.AssumeFilename;
              formatSettingsModel.CustomExecutable = clangFormat.ClangFormatPath.Value;
              formatSettingsModel.Style = clangFormat.Style;
              formatSettingsModel.FallbackStyle = clangFormat.FallbackStyle;
              formatSettingsModel.FormatOnSave = clangFormat.EnableFormatOnSave;

              settingsProvider.SetFormatSettingsModel(formatSettingsModel);
        }
コード例 #5
0
        private void MapClangFormatOptionsToSettings(ClangFormatOptions clangFormat)
        {
            var formatSettingsModel = new FormatSettingsModel
            {
                FileExtensions   = clangFormat.FileExtensions,
                FilesToIgnore    = clangFormat.SkipFiles,
                AssumeFilename   = clangFormat.AssumeFilename,
                CustomExecutable = clangFormat.ClangFormatPath.Value,
                Style            = clangFormat.Style,
                FallbackStyle    = clangFormat.FallbackStyle,
                FormatOnSave     = clangFormat.EnableFormatOnSave
            };

            SettingsProvider.FormatSettingsModel = formatSettingsModel;
        }
コード例 #6
0
        private void DeserializeSettings(string path)
        {
            using (StreamReader sw = new StreamReader(path))
            {
                string         json       = sw.ReadToEnd();
                JsonSerializer serializer = new JsonSerializer();

                try
                {
                    List <object>         models        = JsonConvert.DeserializeObject <List <object> >(json);
                    CompilerSettingsModel compilerModel = JsonConvert.DeserializeObject <CompilerSettingsModel>(models[0].ToString());
                    FormatSettingsModel   formatModel   = JsonConvert.DeserializeObject <FormatSettingsModel>(models[1].ToString());
                    TidySettingsModel     tidyModel     = JsonConvert.DeserializeObject <TidySettingsModel>(models[2].ToString());
                    GeneralSettingsModel  generalModel  = JsonConvert.DeserializeObject <GeneralSettingsModel>(models[3].ToString());

                    SetSettingsModels(compilerModel, formatModel, tidyModel, generalModel);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Cannot Load Clang Power Tools Settings", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #7
0
 public TidyConfigFile()
 {
     compilerSettingsModel = SettingsProvider.CompilerSettingsModel;
     tidySettingsModel     = SettingsProvider.TidySettingsModel;
     formatSettingsModel   = SettingsProvider.FormatSettingsModel;
 }
コード例 #8
0
 public FormatSettingsViewModel()
 {
     formatModel = SettingsProvider.FormatSettingsModel;
 }
コード例 #9
0
        public FormatSettingsViewModel()
        {
            var settingsProvider = new SettingsProvider();

            formatModel = settingsProvider.GetFormatSettingsModel();
        }
コード例 #10
0
 public void SetFormatSettingsModel(FormatSettingsModel model)
 {
     formatSettingsModel = model;
 }
コード例 #11
0
 public TidyConfigFile()
 {
     compilerSettingsModel = settingsProvider.GetCompilerSettingsModel();
     tidySettingsModel     = settingsProvider.GetTidySettingsModel();
     formatSettingsModel   = settingsProvider.GetFormatSettingsModel();
 }