Beispiel #1
0
        public CopyFqnProvidersOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext) : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            AddText("\"Copy Fully-qualified name/ Source browser URI to Clipboard\" will be extended by the following entries.");

            AddSpacer();

            AddBoolOption((CopyFqnProvidersSettings s) => s.EnableShortNames, "Short names");

            AddSpacer();

            AddText("URL templates:");

            // Use BeControls.GetTextControl() + manual Bind() instead of GetBeTextBox() to support multi-line
            // editing (no handling of the "Enter" key). Just like the `ReSpellerSettingsPage`.

            var textControl = BeControls.GetTextControl(isReadonly: false);

            OptionsSettingsSmartContext
            .GetValueProperty(Lifetime, (CopyFqnProvidersSettings s) => s.UrlTemplates)
            .Bind(Lifetime, textControl.Text);

            AddControl(textControl);
        }
Beispiel #2
0
        public ComplexityAnalysisOptionPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext,
            ILanguages languages,
            ILanguageManager languageManager)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            AddText("Specify cyclomatic complexity thresholds:");

            var thresholds = OptionsSettingsSmartContext.Schema.GetIndexedEntry((CyclomaticComplexityAnalysisSettings s) => s.Thresholds);

            var list = new List <LanguageSpecificComplexityProperty>();

            foreach (var languageType in languages.All.Where(languageManager.HasService <IControlFlowBuilder>).OrderBy(GetPresentableName))
            {
                var presentableName = GetPresentableName(languageType);
                var thing           = new LanguageSpecificComplexityProperty(lifetime, optionsSettingsSmartContext, thresholds, languageType.Name, presentableName, CyclomaticComplexityAnalysisSettings.DefaultThreshold);
                list.Add(thing);
            }

            var treeGrid = list.GetBeList(lifetime,
                                          (l, e, p) => new List <BeControl>
            {
                e.Name.GetBeLabel(),
                e.Threshold.GetBeSpinner(lifetime, min: 1)
            },
                                          new TreeConfiguration(new [] { "Language,*", "Threshold,auto" }));

            AddControl(treeGrid, isStar: true);
        }
        public StructuredLoggingOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext,
            bool wrapInScrollablePanel = false)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext, wrapInScrollablePanel)
        {
            AddHeader("Log properties naming style");
            AddComboOptionFromEnum(
                (StructuredLoggingSettings settings) => settings.PropertyNamingType,
                type =>
            {
                switch (type)
                {
                case PropertyNamingType.PascalCase:
                    return("PascalCase");

                case PropertyNamingType.CamelCase:
                    return("camelCase");

                case PropertyNamingType.SnakeCase:
                    return("snake_case");

                default:
                    throw new ArgumentOutOfRangeException(nameof(type), type, null);
                }
            });
        }
Beispiel #4
0
 public InspectionLevelOptionsPage(Lifetime lifetime, OptionsPageContext optionsPageContext, OptionsSettingsSmartContext optionsSettingsSmartContext, bool wrapInScrollablePanel = false) : base(lifetime, optionsPageContext, optionsSettingsSmartContext, wrapInScrollablePanel)
 {
     CreateCheckboxInspectPublic(lifetime, optionsSettingsSmartContext.StoreOptionsTransactionContext);
     CreateCheckboxInspectInternal(lifetime, optionsSettingsSmartContext.StoreOptionsTransactionContext);
     CreateCheckboxInspectProtected(lifetime, optionsSettingsSmartContext.StoreOptionsTransactionContext);
     CreateCheckboxInspectPrivate(lifetime, optionsSettingsSmartContext.StoreOptionsTransactionContext);
 }
Beispiel #5
0
        public AdditionalFileLayoutOptionsPage(Lifetime lifetime, OptionsPageContext optionsPageContext,
                                               OptionsSettingsSmartContext optionsSettingsSmartContext,
                                               RiderDialogHost dialogHost)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            var fileLayoutSettings = new AdditionalFileLayoutSettingsHelper(lifetime, optionsSettingsSmartContext, dialogHost);
            var textControl        = BeControls.GetLanguageTextControl(fileLayoutSettings.Text, lifetime, false, myFileLayoutLanguage, DummyFileName, true);
            var toolbar            = BeControls.GetToolbar(textControl);

            var emptyPatternItem = BeControls.GetButton("Empty", lifetime, () => fileLayoutSettings.LoadDefaultPattern(DefaultPatternKind.Empty));
            var defaultPatternWithoutRegionsItem = BeControls.GetButton("Default", lifetime, () => fileLayoutSettings.LoadDefaultPattern(DefaultPatternKind.WithoutRegions));
            var defaultPatternWithRegionsItem    = BeControls.GetButton("Default with regions", lifetime, () => fileLayoutSettings.LoadDefaultPattern(DefaultPatternKind.WithRegions));

            toolbar.AddItem("Load patterns:".GetBeLabel());
            toolbar.AddItem(emptyPatternItem);
            toolbar.AddItem(defaultPatternWithoutRegionsItem);
            toolbar.AddItem(defaultPatternWithRegionsItem);

            var grid = BeControls.GetGrid();

            grid.AddElement(toolbar, BeSizingType.Fill);

            var margin = BeMargins.Create(5, 1, 5, 1);

            AddControl(grid.WithMargin(margin), true);

            AddKeyword("File Layout");
        }
        public ReSharperHelpersOptionsPage(Lifetime lifetime, [NotNull] OptionsPageContext optionsPageContext, [NotNull] OptionsSettingsSmartContext settingsSmart) :
            base(lifetime, optionsPageContext, settingsSmart)
        {
            var projectNameProperty = settingsSmart.GetValueProperty(lifetime, (ReSharperHelperSettings settings) => settings.TestsProjectName);

            this.AddHeader("Test project name");
            this.AddControl(projectNameProperty.GetBeTextBox(lifetime));
            this.AddRichText(new RichText()
                             .Append("This setting is used to explicitly specify single project in solution where all unit tests are located.\r\n")
                             .Append("The setting has less priority than ")
                             .Append("[assembly: AssemblyMetadata(\"ReSharperHelpers.TestProject\", \"<name>\")]) ", new TextStyle(FontStyle.Italic))
                             .Append("project attribute.\r\n", TextStyle.Default)
                             .Append("Ensure to save this setting to solution specific layer.", new TextStyle(FontStyle.Bold)));

            this.AddSpacer();

            var testClassNameSuffix = settingsSmart.GetValueProperty(lifetime, (ReSharperHelperSettings settings) => settings.TestClassNameSuffix);

            this.AddHeader("Test class name suffix");
            this.AddControl(testClassNameSuffix.GetBeTextBox(lifetime));
            this.AddRichText(new RichText()
                             .Append("This setting specifies test class name suffix that should be used for the new tests.\r\n")
                             .Append("Consider saving this setting to solution specific layer.", new TextStyle(FontStyle.Italic)));

            this.AddSpacer();

            var validTestClassNameSuffixes = settingsSmart.GetValueProperty(lifetime, (ReSharperHelperSettings settings) => settings.ValidTestClassNameSuffixes);

            this.AddHeader("Valid test class name suffixes");
            this.AddControl(validTestClassNameSuffixes.GetBeTextBox(lifetime));
            this.AddRichText(new RichText()
                             .Append("This setting defines additional test suffixes valid for discovering the existing test classes.\r\n")
                             .Append("Suffixes should be delimited by comma (e.g. value1,value2).\r\n")
                             .Append("Consider saving this setting to solution specific layer.", new TextStyle(FontStyle.Italic)));
        }
 public UnrealLinkOptionsPage(Lifetime lifetime,
                              OptionsPageContext optionsPageContext,
                              OptionsSettingsSmartContext optionsSettingsSmartContext)
     : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
 {
     AddBoolOption((UnrealLinkSettings k) => k.InstallRiderLinkPlugin,
                   "Automatically install and update Rider's UnrealLink editor plugin (recommended)");
 }
Beispiel #8
0
        public GeneralPage(Lifetime lifetime, [NotNull] OptionsPageContext optionsPageContext, [NotNull] OptionsSettingsSmartContext store)
            : base(lifetime, optionsPageContext, store)
        {
            AddHeader("Naming options");
            AddBoolOption((GeneralSettings options) => options.ExcludeTestMethodsFromRanaming, "Do not suggest add 'Async' suffix to test method.");

            AddHeader("Eliding options");
            AddBoolOption((GeneralSettings options) => options.ExcludeTestMethodsFromEliding, "Do not suggest elide await in test method.");
        }
        public MismatchedFileNamesOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext) : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            var allowedFileNamePostfixRegex =
                OptionsSettingsSmartContext.GetValueProperty(lifetime, (MismatchedFileNamesSettings s) => s.AllowedFileNamePostfixRegex);

            AddControl(allowedFileNamePostfixRegex.GetBeTextBox(lifetime).WithDescription("Allowed file name postfix regex: ", lifetime));
        }
        public UnrealLinkOptionsPage(Lifetime lifetime,
                                     OptionsPageContext optionsPageContext,
                                     OptionsSettingsSmartContext optionsSettingsSmartContext)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            AddBoolOption((UnrealLinkSettings k) => k.InstallRiderLinkPlugin,
                          "Automatically update RiderLink plugin for Unreal Editor (recommended)");

            SetupInstallButtons();
        }
 public UnityFileTemplatesOptionsPage(Lifetime lifetime,
                                      UnityProjectScopeCategoryUIProvider uiProvider,
                                      OptionsPageContext optionsPageContext,
                                      OptionsSettingsSmartContext optionsSettingsSmartContext,
                                      StoredTemplatesProvider storedTemplatesProvider,
                                      ScopeCategoryManager scopeCategoryManager,
                                      TemplatesUIFactory uiFactory, IconHostBase iconHostBase)
     : base(lifetime, uiProvider, optionsPageContext, optionsSettingsSmartContext, storedTemplatesProvider, scopeCategoryManager,
            uiFactory, iconHostBase, "CSHARP")
 {
 }
Beispiel #12
0
        public SampleOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            _lifetime = lifetime;

            AddHeader("Sample header");
            AddTextBox((SampleSettings x) => x.SampleText, "Description");
        }
Beispiel #13
0
        public RiderBlockJumperOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            _lifetime = lifetime;

            AddHeader("General");
            AddBoolOption((RiderBlockJumperSettings x) => x.JumpOutsideEdge, "Jump Outside Edge", "If enabled, the cursor will jump outside of the block edge (blank line), otherwise it jumps inside the block edge (text line)");
            AddBoolOption((RiderBlockJumperSettings x) => x.SkipClosestEdge, text: "Skip Closest Edge", toolTipText: "If enabled, the cursor will only jump to the far edge of a block, otherwise it visits every edge of a block");
        }
Beispiel #14
0
        public ReSharperOptionsPage(Lifetime lifetime, OptionsPageContext pageContext,
                                    [NotNull] OptionsSettingsSmartContext settingsStore,
                                    RunsProducts.ProductConfigurations productConfigurations)
            : base(lifetime, pageContext, settingsStore)
        {
            AddHeader("C#");
            AddBoolOption(ourEnableBurstHighlightingAccessor, "Enable analysis for Burst compiler issues");
            AddBoolOption(ourEnablePerformanceHighlightingAccessor,
                          "Enable performance analysis in frequently called code");

            using (Indent())
            {
                var option = AddComboOption((UnitySettings s) => s.PerformanceHighlightingMode,
                                            "Highlight performance critical contexts:", string.Empty, string.Empty,
                                            new RadioOptionPoint(PerformanceHighlightingMode.Always, "Always"),
                                            new RadioOptionPoint(PerformanceHighlightingMode.CurrentMethod, "Current method only"),
                                            new RadioOptionPoint(PerformanceHighlightingMode.Never, "Never")
                                            );
                AddBinding(option, BindingStyle.IsEnabledProperty, ourEnablePerformanceHighlightingAccessor,
                           enable => enable);
                option = AddBoolOption((UnitySettings s) => s.EnableIconsForPerformanceCriticalCode,
                                       "Show icons for frequently called methods");
                AddBinding(option, BindingStyle.IsEnabledProperty, ourEnablePerformanceHighlightingAccessor,
                           enable => enable);
            }

            // The default is when code vision is disabled. Let's keep this so that if/when ReSharper ever gets Code
            // Vision, we'll show the items, or if the user installs Rider, the copied settings will still be useful
            AddBoolOption((UnitySettings s) => s.GutterIconMode,
                          GutterIconMode.CodeInsightDisabled, GutterIconMode.None,
                          "Show gutter icons for implicit script usages");

            AddHeader("Text based assets");
            AddBoolOption((UnitySettings s) => s.IsAssetIndexingEnabled,
                          "Parse text based asset files for implicit script usages (requires re-opening solution)");


            AddHeader("Shaders");
            AddBoolOption((UnitySettings s) => s.SuppressShaderErrorHighlighting,
                          "Suppress resolve errors of unqualified names");

            if (productConfigurations.IsInternalMode())
            {
                AddHeader("Internal");

                AddBoolOption((UnitySettings s) => s.SuppressShaderErrorHighlightingInRenderPipelinePackages,
                              "Suppress resolve errors in render-pipeline packages");

                AddBoolOption((UnitySettings s) => s.EnableCgErrorHighlighting,
                              "[Deprecated] Parse GLSL files for syntax errors (requires internal mode, and re-opening solution)");
            }
        }
Beispiel #15
0
        public AccessorOverridesOptionsPage(Lifetime lifetime, OptionsPageContext optionsPageContext, OptionsSettingsSmartContext optionsSettingsSmartContext, bool wrapInScrollablePanel = true) : base(lifetime, optionsPageContext, optionsSettingsSmartContext, wrapInScrollablePanel)
        {
            AddText(OptionsLabels.AccessorOverrides.Description);

            CreateCheckboxUsePredefined(lifetime, optionsSettingsSmartContext.StoreOptionsTransactionContext);

            AddButton(OptionsLabels.AccessorOverrides.ShowPredefined, ShowPredefined);

            AddSpacer();

            AddText(OptionsLabels.AccessorOverrides.Note);
            CreateRichTextAccessorOverrides(lifetime, optionsSettingsSmartContext.StoreOptionsTransactionContext);
        }
        public TestLinkerOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            _lifetime = lifetime;

            AddHeader("Navigation");

            AddTextBox((TestLinkerSettings x) => x.NamingSuffixes, "Name suffixes for tests (comma-separated):");
            AddTextBox((TestLinkerSettings x) => x.TypeofAttributeName, "Attribute name for typeof mentions:");
        }
Beispiel #17
0
        public ExceptionTypesAsHintOptionsPage(Lifetime lifetime, OptionsPageContext optionsPageContext, OptionsSettingsSmartContext optionsSettingsSmartContext) : base(lifetime, optionsPageContext, optionsSettingsSmartContext, true)
        {
            AddText(OptionsLabels.ExceptionTypesAsHint.Description);

            CreateCheckboxUsePredefined(lifetime, optionsSettingsSmartContext.StoreOptionsTransactionContext);

            AddButton(OptionsLabels.ExceptionTypesAsHint.ShowPredefined, ShowPredefined);

            AddSpacer();

            AddText(OptionsLabels.ExceptionTypesAsHint.Note);
            CreateRichTextExceptionTypesAsHint(lifetime, optionsSettingsSmartContext.StoreOptionsTransactionContext);
        }
Beispiel #18
0
        public ExceptionTypesAsHintForMethodOrPropertyOptionsPage(Lifetime lifetime, OptionsPageContext optionsPageContext, OptionsSettingsSmartContext optionsSettingsSmartContext, bool wrapInScrollablePanel = true) : base(lifetime, optionsPageContext, optionsSettingsSmartContext, wrapInScrollablePanel)
        {
            AddText(OptionsLabels.ExceptionTypesAsHintForMethodOrProperty.Description);

            CreateCheckboxUsePredefined(lifetime, optionsSettingsSmartContext.StoreOptionsTransactionContext);

            AddButton(OptionsLabels.ExceptionTypesAsHintForMethodOrProperty.ShowPredefined, ShowPredefined);

            AddSpacer();

            AddText(OptionsLabels.ExceptionTypesAsHintForMethodOrProperty.Note);
            CreateRichTextExceptionTypesAsHint(lifetime, optionsSettingsSmartContext.StoreOptionsTransactionContext);
        }
Beispiel #19
0
        public CleanCodeOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            CreateSettingsArea("Single Responsibility", CreateSingleResponsibilitySettings);
            CreateSettingsArea("Coupling", CreateCouplingSettingsArea);
            CreateSettingsArea("Legibility", CreateLegibilitySettingsArea);
            CreateSettingsArea("Complexity", CreateComplexitySettingsArea);

            CreateFooterArea();
        }
        public ReSharperHelpersOptionsPage(Lifetime lifetime, [NotNull] OptionsPageContext optionsPageContext, [NotNull] OptionsSettingsSmartContext settingsSmart) :
            base(lifetime, optionsPageContext, settingsSmart)
        {
            this.AddControl(
                BeControls
                .GetGrid(
                    GridOrientation.Vertical,
                    (BeControls.GetSpacer(), BeSizingType.Fit),
                    (BeControls.GetRichText("It's recommended to save project specific settings to .editorconfig file instead of configuring them here."), BeSizingType.Fit),
                    (BeControls.GetLinkButton("Read documentation", lifetime, () => Process.Start("https://github.com/zvirja/ReSharperHelpers#editor-config")), BeSizingType.Fit),
                    (BeControls.GetSpacer(), BeSizingType.Fit)
                    )
                .WithColor(Color.LightYellow)
                .InGroupBox("⚠ Use Editor Config")
                );
            this.AddSpacer();

            var projectNameProperty = settingsSmart.GetValueProperty(lifetime, (ReSharperHelperSettings settings) => settings.TestsProjectName);

            this.AddHeader("Test project name [deprecated, use .editorconfig]");
            this.AddControl(projectNameProperty.GetBeTextBox(lifetime));
            this.AddRichText(new RichText()
                             .AppendLine("This setting is used to explicitly specify single project in solution where all unit tests are located.")
                             .Append("The setting has less priority than ")
                             .Append("[assembly: AssemblyMetadata(\"ReSharperHelpers.TestProject\", \"<name>\")]) ", new TextStyle(FontStyle.Italic))
                             .Append("project attribute.", TextStyle.Default).AppendLine()
                             .Append("Save it to .editorconfig file instead", new TextStyle(FontStyle.Bold)).AppendLine()
                             );
            this.AddSpacer();

            var testClassNameSuffix = settingsSmart.GetValueProperty(lifetime, (ReSharperHelperSettings settings) => settings.TestClassNameSuffix);

            this.AddHeader("New test class name suffix");
            this.AddControl(testClassNameSuffix.GetBeTextBox(lifetime));
            this.AddRichText(new RichText()
                             .AppendLine("This setting specifies test class name suffix that should be used for the new tests.")
                             .Append("Consider saving this setting to .editorconfig file or solution specific layer.", new TextStyle(FontStyle.Italic)));

            this.AddSpacer();

            var validTestClassNameSuffixes = settingsSmart.GetValueProperty(lifetime, (ReSharperHelperSettings settings) => settings.ValidTestClassNameSuffixes);

            this.AddHeader("Existing test class name suffixes");
            this.AddControl(validTestClassNameSuffixes.GetBeTextBox(lifetime));
            this.AddRichText(new RichText()
                             .AppendLine("This setting defines additional test suffixes valid for discovering the existing test classes.")
                             .AppendLine("Suffixes should be delimited by comma (e.g. value1,value2).")
                             .Append("Consider saving this setting to .editorconfig file or solution specific layer.", new TextStyle(FontStyle.Italic)));
        }
Beispiel #21
0
        public TestLinkerOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            _lifetime = lifetime;

            AddSuffixSearchOptions();
            AddTypeofSearchOptions();

            AddText("");
            AddText("Warning: After changing these settings, cleaning the solution cache (see \"General\" options page)");
            AddText("is necessary to update already analyzed code.");
        }
        public TodoItemsCountOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext) : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            AddBoolOption((TodoItemsCountSettings s) => s.IsEnabled, "Enabled");

            AddText("Definitions:");

            // Use BeControls.GetTextControl() + manual Bind() instead of GetBeTextBox() to support multi-line
            // editing (no handling of the "Enter" key). Just like the `ReSpellerSettingsPage`.

            var textControl = BeControls.GetTextControl(isReadonly: false);

            OptionsSettingsSmartContext
            .GetValueProperty(Lifetime, (TodoItemsCountSettings s) => s.Definitions)
            .Bind(Lifetime, textControl.Text);

            AddBinding(textControl, BindingStyle.IsEnabledProperty, (TodoItemsCountSettings s) => s.IsEnabled, x => x);

            AddControl(textControl);
            AddText("Syntax: <To-do title>[<Optional text-matching used to filter the counted items>]");
        }
Beispiel #23
0
        public CleanCodeOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            AddHeader("Single Responsibility");
            AddText("A class should only have a single responsibility. Do not do too much in a class or method.");

            AddIntOption((CleanCodeSettings s) => s.MaximumMethodsInClass, Resources.Settings.MaximumMethodsPerClass);
            AddIntOption((CleanCodeSettings s) => s.MaximumMethodParameters, Resources.Settings.MaximumMethodDeclarationParameters);
            AddIntOption((CleanCodeSettings s) => s.MaximumMethodStatements, Resources.Settings.MaximumStatementsPerMethod);
            AddIntOption((CleanCodeSettings s) => s.MaximumDeclarationsInMethod, Resources.Settings.DeclarationsMaximum);
            AddIntOption((CleanCodeSettings s) => s.MaximumIndentationDepth, Resources.Settings.MaximumLevelOfNestingInAMethod);

            AddHeader("Coupling");
            AddText("Avoid excessive coupling beween classes.");

            AddIntOption((CleanCodeSettings s) => s.MaximumConstructorDependencies, Resources.Settings.MaximumConstructorDependencies);
            AddIntOption((CleanCodeSettings s) => s.MaximumChainedReferences, Resources.Settings.MaximumChainedReferences);

            AddHeader("Legibility");
            AddText("Names should be meaningful.");

            AddIntOption((CleanCodeSettings s) => s.MinimumMeaningfulMethodNameLength, Resources.Settings.MinimumMethodNameLength);
            AddStringOption((CleanCodeSettings s) => s.MeaninglessClassNameSuffixes, Resources.Settings.MeaninglessNameSuffixes);

            AddHeader("Complexity");
            AddText("Reduce complexity in individual statements.");

            AddIntOption((CleanCodeSettings s) => s.MaximumExpressionsInCondition, Resources.Settings.MaximumExpressionsInsideACondition);

            AddSpacer();
            AddRichText(new RichText("Note: All references to Clean Code, including but not limited to the Clean Code icon are used with permission of Robert C. Martin (a.k.a. UncleBob)",
                                     new TextStyle(System.Drawing.FontStyle.Italic)));
        }
 public AsyncConverterConfigureAwaitPage(Lifetime lifetime, OptionsPageContext optionsPageContext, [NotNull] OptionsSettingsSmartContext store)
     : base(lifetime, optionsPageContext, store)
 {
     AddBoolOption((AsyncConverterConfigureAwaitSettings options) => options.ExcludeTestMethodsFromConfigureAwait,
                   "Do not suggest add 'ConfigureAwait' in test method.");
 }
Beispiel #25
0
        public XamlStylerOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext,
            [NotNull] IconHostBase iconHost,
            [NotNull] ICommonFileDialogs commonFileDialogs)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            _iconHost = iconHost;

#if RIDER
            // General
            AddHeader("General");
            AddBoolOption((XamlStylerSettings x) => x.FormatOnSave, "Format XAML on save");
#endif

            // Indentation
            AddHeader("Indentation");
            var indentSizeOption = AddSpinner((XamlStylerSettings x) => x.IndentSize, "Indent size:");
            using (Indent())
            {
                AddBoolOption((XamlStylerSettings x) => x.UseIdeIndentSize, "Use IDE value");
            }

            AddBinding(indentSizeOption, BindingStyle.IsEnabledProperty,
                       (XamlStylerSettings x) => x.UseIdeIndentSize,
                       x => !(bool)x);

            var indentWithTabsOption = AddBoolOption((XamlStylerSettings x) => x.IndentWithTabs, "Indent with tabs");
            using (Indent())
            {
                AddBoolOption((XamlStylerSettings x) => x.UseIdeIndentWithTabs, "Use IDE value");
            }

            AddBinding(indentWithTabsOption, BindingStyle.IsEnabledProperty,
                       (XamlStylerSettings x) => x.UseIdeIndentWithTabs,
                       x => !(bool)x);

            // Attribute formatting
            AddHeader("Attribute formatting");
            AddSpinner((XamlStylerSettings x) => x.AttributesTolerance, "Attribute tolerance:");
            AddBoolOption((XamlStylerSettings x) => x.KeepFirstAttributeOnSameLine, "Keep first attribute on same line");
            AddSpinner((XamlStylerSettings x) => x.MaxAttributeCharactersPerLine, "Max attribute characters per line:");
            AddSpinner((XamlStylerSettings x) => x.MaxAttributesPerLine, "Max attributes per line:");
            AddTextBox((XamlStylerSettings x) => x.NoNewLineElements, "Newline exemption elements:");
            AddBoolOption((XamlStylerSettings x) => x.PutAttributeOrderRuleGroupsOnSeparateLines, "Separate by groups");
            AddSpinner((XamlStylerSettings x) => x.AttributeIndentation, "Attribute indentation:");
            AddComboEnum((XamlStylerSettings x) => x.AttributeIndentationStyle, "Attribute indentation style:");
            AddBoolOption((XamlStylerSettings x) => x.RemoveDesignTimeReferences, "Remove design-time references");

            // Attribute Reordering
            AddHeader("Attribute reordering");
            AddBoolOption((XamlStylerSettings x) => x.EnableAttributeReordering, "Enable attribute reordering");

            var attributeOrderingRuleGroupsOption = AddListControl((XamlStylerSettings x) => x.AttributeOrderingRuleGroups, new StylerOptions().AttributeOrderingRuleGroups, "Attribute ordering rule groups");

            var firstLineAttributesOption   = AddTextBox((XamlStylerSettings x) => x.FirstLineAttributes, "First-line attributes:");
            var orderAttributesByNameOption = AddBoolOption((XamlStylerSettings x) => x.OrderAttributesByName, "Order attributes by name");

            AddBinding(attributeOrderingRuleGroupsOption, BindingStyle.IsEnabledProperty,
                       (XamlStylerSettings x) => x.EnableAttributeReordering,
                       x => (bool)x);

            AddBinding(firstLineAttributesOption, BindingStyle.IsEnabledProperty,
                       (XamlStylerSettings x) => x.EnableAttributeReordering,
                       x => (bool)x);

            AddBinding(orderAttributesByNameOption, BindingStyle.IsEnabledProperty,
                       (XamlStylerSettings x) => x.EnableAttributeReordering,
                       x => (bool)x);

            // Element formatting
            AddHeader("Element formatting");
            AddBoolOption((XamlStylerSettings x) => x.PutEndingBracketOnNewLine, "Put ending brackets on new line");
            AddBoolOption((XamlStylerSettings x) => x.RemoveEndingTagOfEmptyElement, "Remove ending tag of empty element");
            AddBoolOption((XamlStylerSettings x) => x.SpaceBeforeClosingSlash, "Space before ending slash in self-closing elements");
            AddComboEnum((XamlStylerSettings x) => x.RootElementLineBreakRule, "Root element line breaks between attributes:");

            // Element reordering
            AddHeader("Element reordering");
            AddComboEnum((XamlStylerSettings x) => x.ReorderVSM, "Reorder visual state manager:");
            AddBoolOption((XamlStylerSettings x) => x.ReorderGridChildren, "Reorder grid panel children");
            AddBoolOption((XamlStylerSettings x) => x.ReorderCanvasChildren, "Reorder canvas panel children");
            AddComboEnum((XamlStylerSettings x) => x.ReorderSetters, "Reorder setters:");

            // Markup extension
            AddHeader("Markup extension");
            AddBoolOption((XamlStylerSettings x) => x.FormatMarkupExtension, "Enable markup extension formatting");
            var noNewLineMarkupExtensionsOption = AddTextBox((XamlStylerSettings x) => x.NoNewLineMarkupExtensions, "Keep markup extensions of these types on one line:");

            AddBinding(noNewLineMarkupExtensionsOption, BindingStyle.IsEnabledProperty,
                       (XamlStylerSettings x) => x.FormatMarkupExtension,
                       x => (bool)x);

            // Thickness formatting
            AddHeader("Thickness formatting");
            AddComboEnum((XamlStylerSettings x) => x.ThicknessStyle, "Thickness separator:");
            AddTextBox((XamlStylerSettings x) => x.ThicknessAttributes, "Thickness attributes:");

            // Misc
            AddHeader("Misc");
            AddSpinner((XamlStylerSettings x) => x.CommentSpaces, "Comment padding:");

            // Configuration
            AddHeader("Configuration");
            AddText("External configuration file:");
            var configPath = new Property <FileSystemPath>(lifetime, "XamlStylerOptionsPage::configPath");
            OptionsSettingsSmartContext.SetBinding(lifetime, (XamlStylerSettings k) => k.ConfigPath, configPath);
            AddFileChooserOption(configPath, "External configuration file", FileSystemPath.Empty, null, commonFileDialogs, null, false, "", null, null, null, null);
            AddBoolOption((XamlStylerSettings x) => x.SearchToDriveRoot, "Search to drive root");
            AddBoolOption((XamlStylerSettings x) => x.SuppressProcessing, "Suppress processing");
        }
Beispiel #26
0
        public GeneralOptionsPage(Lifetime lifetime, OptionsPageContext optionsPageContext, OptionsSettingsSmartContext optionsSettingsSmartContext, bool wrapInScrollablePanel = false) : base(lifetime, optionsPageContext, optionsSettingsSmartContext, wrapInScrollablePanel)
        {
            CreateCheckboxInspectPublic(lifetime, optionsSettingsSmartContext.StoreOptionsTransactionContext);

            CreateDocumentationSection(lifetime, optionsSettingsSmartContext.StoreOptionsTransactionContext);
        }
        public UnityOptionsPage(Lifetime lifetime, OptionsPageContext pageContext,
                                OptionsSettingsSmartContext settingsStore,
                                RunsProducts.ProductConfigurations productConfigurations)
            : base(lifetime, pageContext, settingsStore)
        {
            AddHeader("General");
            AddBoolOption((UnitySettings s) => s.InstallUnity3DRiderPlugin,
                          "Automatically install and update Rider's Unity editor plugin (recommended)");
            AddBoolOption((UnitySettings s) => s.AllowAutomaticRefreshInUnity, "Automatically refresh assets in Unity");

            AddPerformanceAnalysisSection();
            AddBurstAnalysisSection();

            AddHeader("C#");
            AddComboOption((UnitySettings s) => s.GutterIconMode,
                           "Show gutter icons for implicit script usages:", string.Empty, string.Empty,
                           new RadioOptionPoint(GutterIconMode.Always, "Always"),
                           new RadioOptionPoint(GutterIconMode.CodeInsightDisabled, "When Code Vision is disabled"),
                           new RadioOptionPoint(GutterIconMode.None, "Never")
                           );

            AddNamingSection(lifetime, settingsStore);

            AddHeader("Text based assets");
            AddBoolOption((UnitySettings s) => s.IsAssetIndexingEnabled,
                          "Parse text based asset files for script and event handler usages");
            AddBoolOption((UnitySettings s) => s.EnableInspectorPropertiesEditor,
                          "Show Inspector values in the editor");
            AddBoolOption((UnitySettings s) => s.IsPrefabCacheEnabled,
                          "Cache prefab data to improve find usage performance");
            AddBoolOption((UnitySettings s) => s.EnableAssetIndexingPerformanceHeuristic,
                          "Automatically disable asset indexing for large solutions");
            AddBoolOption((UnitySettings s) => s.UseUnityYamlMerge, "Prefer UnityYamlMerge for merging YAML files");
            using (Indent())
            {
                var option = AddControl((UnitySettings s) => s.MergeParameters,
                                        p => p.GetBeTextBox(lifetime).WithDescription("Merge parameters", lifetime));
                AddBinding(option, BindingStyle.IsEnabledProperty, (Expression <Func <UnitySettings, bool> >)(s => s.UseUnityYamlMerge),
                           enable => enable);
            }

            AddHeader("Shaders");
            AddBoolOption((UnitySettings s) => s.SuppressShaderErrorHighlighting, "Suppress resolve errors of unqualified names");


            AddHeader("Debugging");
            AddBoolOption((UnitySettings s) => s.EnableDebuggerExtensions,
                          "Extend value rendering");
            using (Indent())
            {
                // AddCommentText doesn't match the UI guidelines for inline help. It should wrap at about 70 characters
                // and have a slightly smaller font size. We can do the wrapping manually, but there's nothing we can do
                // about the font.
                // https://youtrack.jetbrains.com/issue/RIDER-47090
                AddCommentText("When enabled, Rider will show extra values in debugger object views,\n" +
                               "such as active scene and GameObject component data and children.\n" +
                               "Rendering of summary values is also improved, such as showing Vector3\n" +
                               "float values with full precision.");
            }

            if (productConfigurations.IsInternalMode())
            {
                AddHeader("Internal");

                AddBoolOption((UnitySettings s) => s.SuppressShaderErrorHighlightingInRenderPipelinePackages,
                              "Suppress resolve errors in render-pipeline packages");

                AddBoolOption((UnitySettings s) => s.EnableCgErrorHighlighting,
                              "[Deprecated] Parse GLSL files for syntax errors (requires internal mode, and re-opening solution)");
            }
        }
        public CognitiveComplexityAnalysisOptionPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext,
            ILanguages languages,
            ILanguageManager languageManager)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            (Property <int> Property, BeSpinner Spinner) CreateComplexity(
                string id,
                Expression <Func <CognitiveComplexityAnalysisSettings, int> > setting)
            {
                var property = new Property <int>(lifetime, id + "Complexity");

                optionsSettingsSmartContext.SetBinding(lifetime, setting, property);
                return(property, property.GetBeSpinner(lifetime));
            }

            AddText("Language specific thresholds:");

            var csharpComplexity = CreateComplexity("csharp", s => s.CSharpThreshold);

            using (Indent())
            {
                AddControl(csharpComplexity.Spinner.WithDescription("CSharp:", lifetime));
            }

//            var thresholds =
//                OptionsSettingsSmartContext.Schema.GetIndexedEntry((CognitiveComplexityAnalysisSettings s) =>
//                    s.CSharpThreshold);
//
//            var list = new List<LanguageSpecificComplexityProperty>();
//            foreach (var languageType in languages.All.Where(languageManager.HasService<IControlFlowBuilder>)
//                .OrderBy(GetPresentableName))
//            {
//                var presentableName = GetPresentableName(languageType);
//                var thing = new LanguageSpecificComplexityProperty(lifetime, optionsSettingsSmartContext, thresholds,
//                    languageType.Name, presentableName, CognitiveComplexityAnalysisSettings.DefaultThreshold);
//                list.Add(thing);
//            }
//
//            var treeGrid = list.GetBeList(lifetime,
//                (l, e, p) => new List<BeControl>
//                {
//                    e.Name.GetBeLabel(),
//                    e.Threshold.GetBeSpinner(lifetime, min: 1)
//                },
//                new TreeConfiguration(new[] {"Language,*", "Threshold,auto"}));
//
//            AddControl(treeGrid, isStar: true);

            AddText("CodeVision thresholds (in %):");

            var lowComplexity    = CreateComplexity("low", s => s.LowComplexityThreshold);
            var middleComplexity = CreateComplexity("middle", s => s.MiddleComplexityThreshold);
            var highComplexity   = CreateComplexity("high", s => s.HighComplexityThreshold);

            using (Indent())
            {
                AddControl(lowComplexity.Spinner.WithDescription("Simple enough:", lifetime));
                AddControl(middleComplexity.Spinner.WithDescription("Mildly complex:", lifetime));
                AddControl(highComplexity.Spinner.WithDescription("Very complex:", lifetime));
            }
        }