private string MethodNamesArePascalCaseOptionString() { var symbolSpecification = new SymbolSpecification( Guid.NewGuid(), "Name", SpecializedCollections.SingletonEnumerable(new SymbolSpecification.SymbolKindOrTypeKind(SymbolKind.Method)).ToList(), SpecializedCollections.EmptyList <SymbolSpecification.AccessibilityKind>(), SpecializedCollections.EmptyList <SymbolSpecification.ModifierKind>()); var namingStyle = new NamingStyle(); namingStyle.CapitalizationScheme = Capitalization.PascalCase; namingStyle.Name = "Name"; namingStyle.Prefix = ""; namingStyle.Suffix = ""; namingStyle.WordSeparator = ""; var namingRule = new SerializableNamingRule(); namingRule.SymbolSpecificationID = symbolSpecification.ID; namingRule.NamingStyleID = namingStyle.ID; namingRule.EnforcementLevel = DiagnosticSeverity.Error; var info = new SerializableNamingStylePreferencesInfo(); info.SymbolSpecifications.Add(symbolSpecification); info.NamingStyles.Add(namingStyle); info.NamingRules.Add(namingRule); return(info.CreateXElement().ToString()); }
internal override void SaveSettings() { var info = new SerializableNamingStylePreferencesInfo(); foreach (var item in _viewModel.CodeStyleItems) { if (!item.IsComplete()) { continue; } var rule = new SerializableNamingRule() { EnforcementLevel = item.SelectedNotificationPreference.Value, NamingStyleID = item.SelectedStyle.ID, SymbolSpecificationID = item.SelectedSpecification.ID }; info.NamingRules.Add(rule); } foreach (var item in _viewModel.Specifications) { info.SymbolSpecifications.Add(item); } foreach (var item in _viewModel.NamingStyles) { info.NamingStyles.Add(item); } var oldOptions = OptionService.GetOptions(); var newOptions = oldOptions.WithChangedOption(SimplificationOptions.NamingPreferences, _languageName, info.CreateXElement().ToString()); OptionService.SetOptions(newOptions); OptionLogger.Log(oldOptions, newOptions); }