diff --git a/.addon b/.addon index 3ae7b07..1ea666c 100644 --- a/.addon +++ b/.addon @@ -10,7 +10,6 @@ "ResourcePaths": [], "HasCode": true, "CodePath": "code", - "RootNamespace": "Tools", "Metadata": { "ProjectTemplate": null } diff --git a/code/DiagnosticsListView.cs b/code/DiagnosticsListView.cs index 1fe53e1..41bec1b 100644 --- a/code/DiagnosticsListView.cs +++ b/code/DiagnosticsListView.cs @@ -1,5 +1,5 @@ -using Sandbox.Internal; -using Tools; +using Editor; +using Sandbox.Internal; namespace Gooman.Tools.ProjectDiagnostics; diff --git a/code/ProjectDiagnostics.cs b/code/ProjectDiagnostics.cs index b2ffb27..1e3ac80 100644 --- a/code/ProjectDiagnostics.cs +++ b/code/ProjectDiagnostics.cs @@ -1,9 +1,9 @@ -using Sandbox; +using Editor; +using Sandbox; using Sandbox.Internal; using System; using System.Collections.Generic; using System.Linq; -using Tools; namespace Gooman.Tools.ProjectDiagnostics; @@ -52,10 +52,6 @@ public sealed class ProjectDiagnostics : Widget /// private readonly ComboBox ProjectFilterBox; /// - /// Check box for whether or not to hide unaffiliated diagnostics. - /// - private readonly CheckBox HideUnaffiliatedDiagnosticsCheckBox; - /// /// The visual list of all diagnostics. /// private readonly DiagnosticsListView DiagnosticsView; @@ -80,10 +76,6 @@ public sealed class ProjectDiagnostics : Widget /// The current filter for projects. /// private string FilteredProject = "all"; - /// - /// Whether or not to hide unaffiliated diagnostics in projects. - /// - private bool HideUnaffiliatedDiagnostics = false; /// /// Initializes a new instance of . @@ -153,12 +145,6 @@ public ProjectDiagnostics( Widget parent ) : base( parent ) }; ResetFilterBox(); - HideUnaffiliatedDiagnosticsCheckBox = new CheckBox( "Hide unaffialiated diagnostics", this ) - { - Toggled = ToggleDiagnosticsCheckBox, - StatusTip = "Whether or not to hide diagnostics from projects not directly affiliated with the compiled project" - }; - var clearButton = new Button( string.Empty, "delete", this ) { ButtonType = "clear", @@ -168,7 +154,6 @@ public ProjectDiagnostics( Widget parent ) : base( parent ) clearButton.SetProperty( "cssClass", "clear" ); layout.Add( ProjectFilterBox ); - layout.Add( HideUnaffiliatedDiagnosticsCheckBox ); layout.Add( clearButton ); // Error list. @@ -185,7 +170,6 @@ public ProjectDiagnostics( Widget parent ) : base( parent ) ShowInfo = Cookie.Get( "project_diag_info_shown", true ); ShowWarnings = Cookie.Get( "project_diag_warnings_shown", true ); ShowErrors = Cookie.Get( "project_diag_errors_shown", true ); - HideUnaffiliatedDiagnosticsCheckBox.Value = Cookie.Get( "project_diag_hide_unaf_diag", false ); // Update. UpdateErrors(); } @@ -254,14 +238,11 @@ private void ResetFilterBox() /// /// If provided, sets the project name filter. /// If provided, sets whether or not to hide unaffiliated diagnostics. - private void UpdateErrors( string projectName = null, bool? hideUnaffiliatedDiagnostics = null ) + private void UpdateErrors( string projectName = null ) { if ( projectName is not null ) FilteredProject = projectName; - if ( hideUnaffiliatedDiagnostics is not null ) - HideUnaffiliatedDiagnostics = hideUnaffiliatedDiagnostics.Value; - // Fast path if ( Diagnostics.Count == 0 || (!ShowInfo && !ShowWarnings && !ShowErrors) ) { @@ -312,24 +293,9 @@ private bool FilterDiagnostic( ICSharpCompiler.Diagnostic diagnostic ) if ( FilteredProject != "all" && diagnostic.Project != FilteredProject ) return false; - var projectName = diagnostic.Project; - var relatedProject = Utility.Projects.GetAll().First( proj => proj.Config.FullIdent == projectName ); - if ( HideUnaffiliatedDiagnostics && !diagnostic.FilePath.StartsWith( relatedProject.GetRootPath() ) ) - return false; - return true; } - /// - /// Callback method when the value has changed. - /// - private void ToggleDiagnosticsCheckBox() - { - var hide = HideUnaffiliatedDiagnosticsCheckBox.State == CheckState.On; - UpdateErrors( null, hide ); - Cookie.Set( "project_diag_hide_unaf_diag", hide ); - } - /// /// Paints a button. ///