Example #1
0
                internal override OptionKey Wrap(RoslynPreferences preferences)
                {
                    var optionKey = new OptionKey(this);

                    preferences.Wrap <T> (optionKey);
                    return(optionKey);
                }
Example #2
0
            internal PerLanguagePreferences(string language, RoslynPreferences preferences)
            {
                PlaceSystemNamespaceFirst = preferences.Wrap <bool> (
                    new OptionKey(Microsoft.CodeAnalysis.Editing.GenerationOptions.PlaceSystemNamespaceFirst, language),
                    language + ".PlaceSystemNamespaceFirst"
                    );

                SeparateImportDirectiveGroups = preferences.Wrap <bool> (
                    new OptionKey(Microsoft.CodeAnalysis.Editing.GenerationOptions.SeparateImportDirectiveGroups, language),
                    language + ".SeparateImportDirectiveGroups"
                    );

                SuggestForTypesInNuGetPackages = preferences.Wrap(
                    new OptionKey(Microsoft.CodeAnalysis.SymbolSearch.SymbolSearchOptions.SuggestForTypesInNuGetPackages, language),
                    true
                    );
            }
Example #3
0
            internal PerLanguagePreferences(string language, RoslynPreferences preferences)
            {
                this.language     = language;
                roslynPreferences = preferences;

                AutoFormattingOnCloseBrace = preferences.Wrap <bool> (
                    new OptionKey(FeatureOnOffOptions.AutoFormattingOnCloseBrace, language),
                    language + ".AutoFormattingOnCloseBrace"
                    );

                AutoFormattingOnReturn = preferences.Wrap <bool> (
                    new OptionKey(FeatureOnOffOptions.AutoFormattingOnReturn, language),
                    language + ".AutoFormattingOnReturn"
                    );

                AutoFormattingOnSemicolon = preferences.Wrap <bool> (
                    new OptionKey(FeatureOnOffOptions.AutoFormattingOnSemicolon, language),
                    language + ".AutoFormattingOnSemicolon"
                    );
                AutoFormattingOnTyping = preferences.Wrap <bool> (
                    new OptionKey(FeatureOnOffOptions.AutoFormattingOnTyping, language),
                    language + ".AutoFormattingOnTyping"
                    );

                FormatOnPaste = preferences.Wrap <bool> (
                    new OptionKey(FeatureOnOffOptions.FormatOnPaste, language),
                    language + ".FormatOnPaste"
                    );

                PlaceSystemNamespaceFirst = preferences.Wrap <bool> (
                    new OptionKey(Microsoft.CodeAnalysis.Editing.GenerationOptions.PlaceSystemNamespaceFirst, language),
                    language + ".PlaceSystemNamespaceFirst"
                    );

                SeparateImportDirectiveGroups = preferences.Wrap <bool> (
                    new OptionKey(Microsoft.CodeAnalysis.Editing.GenerationOptions.SeparateImportDirectiveGroups, language),
                    language + ".SeparateImportDirectiveGroups"
                    );

                SuggestForTypesInNuGetPackages = preferences.Wrap(
                    new OptionKey(Microsoft.CodeAnalysis.SymbolSearch.SymbolSearchOptions.SuggestForTypesInNuGetPackages, language),
                    true
                    );

                SolutionCrawlerClosedFileDiagnostic = new ClosedFileDiagnosticProperty(preferences.Wrap <bool?> (
                                                                                           new OptionKey(ServiceFeatureOnOffOptions.ClosedFileDiagnostic, language)
                                                                                           ), language, roslynPreferences);
            }
        public void TestRoslynPropertyMigration()
        {
            var preferences = new RoslynPreferences();

            const string mdKey = "TEST_ROSLYN_MIGRATION_KEY";

            foreach (var option in GetOptionKeys <bool> ())
            {
                PropertyService.Set(mdKey, true);
                var prop = preferences.Wrap(option, default(bool), mdKey);

                Assert.AreEqual(true, PropertyService.Get <bool> (option.GetPropertyName()));
                Assert.AreEqual(true, prop.Value);

                Assert.AreEqual(false, PropertyService.HasValue(mdKey));

                prop.Value = false;
                Assert.AreEqual(false, PropertyService.Get <bool> (option.GetPropertyName()));
                Assert.AreEqual(false, prop.Value);
            }
        }
Example #5
0
            internal PerLanguagePreferences(string language, RoslynPreferences preferences)
            {
                this.language     = language;
                roslynPreferences = preferences;

                AutoFormattingOnCloseBrace = preferences.Wrap <bool> (
                    new OptionKey(FeatureOnOffOptions.AutoFormattingOnCloseBrace, language),
                    language + ".AutoFormattingOnCloseBrace"
                    );

                AutoFormattingOnReturn = preferences.Wrap <bool> (
                    new OptionKey(FormattingOptions.AutoFormattingOnReturn, language),
                    language + ".AutoFormattingOnReturn"
                    );

                AutoFormattingOnSemicolon = preferences.Wrap <bool> (
                    new OptionKey(FeatureOnOffOptions.AutoFormattingOnSemicolon, language),
                    language + ".AutoFormattingOnSemicolon"
                    );
                AutoFormattingOnTyping = preferences.Wrap <bool> (
                    new OptionKey(FeatureOnOffOptions.AutoFormattingOnTyping, language),
                    language + ".AutoFormattingOnTyping"
                    );

                FormatOnPaste = preferences.Wrap <bool> (
                    new OptionKey(FeatureOnOffOptions.FormatOnPaste, language),
                    language + ".FormatOnPaste"
                    );

                PlaceSystemNamespaceFirst = preferences.Wrap <bool> (
                    new OptionKey(Microsoft.CodeAnalysis.Editing.GenerationOptions.PlaceSystemNamespaceFirst, language),
                    language + ".PlaceSystemNamespaceFirst"
                    );

                SeparateImportDirectiveGroups = preferences.Wrap <bool> (
                    new OptionKey(Microsoft.CodeAnalysis.Editing.GenerationOptions.SeparateImportDirectiveGroups, language),
                    language + ".SeparateImportDirectiveGroups"
                    );

                ShowCompletionItemFilters = preferences.Wrap <bool> (
                    new OptionKey(CompletionOptions.ShowCompletionItemFilters, language),
                    language + ".ShowCompletionItemFilters"
                    );

                ShowItemsFromUnimportedNamespaces = preferences.Wrap <bool?> (
                    new OptionKey(CompletionOptions.ShowItemsFromUnimportedNamespaces, language),
                    IdeApp.Preferences.AddImportedItemsToCompletionList.Value,
                    language + ".ShowItemsFromUnimportedNamespaces"
                    );

                SuggestForTypesInNuGetPackages = preferences.Wrap(
                    new OptionKey(Microsoft.CodeAnalysis.SymbolSearch.SymbolSearchOptions.SuggestForTypesInNuGetPackages, language),
                    true
                    );

                SolutionCrawlerClosedFileDiagnostic = new ClosedFileDiagnosticProperty(preferences.Wrap <bool?> (
                                                                                           new OptionKey(ServiceFeatureOnOffOptions.ClosedFileDiagnostic, language)
                                                                                           ), language, roslynPreferences);

                TriggerOnDeletion = preferences.Wrap <bool?> (
                    new OptionKey(CompletionOptions.TriggerOnDeletion, language),
                    language + ".TriggerOnDeletion"
                    );

                triggerOnTypingLetters = new Lazy <ConfigurationProperty <bool> > (() => preferences.Wrap <bool> (
                                                                                       new OptionKey(CompletionOptions.TriggerOnTypingLetters, language),
                                                                                       MonoDevelop.Ide.Editor.DefaultSourceEditorOptions.Instance.EnableAutoCodeCompletion,
                                                                                       language + ".TriggerOnTypingLetters"
                                                                                       ));
            }