From 93b3588a112eaafc8f69f10c8266c4918a013716 Mon Sep 17 00:00:00 2001 From: Eli Pinkerton Date: Sat, 10 Oct 2026 04:28:28 +0000 Subject: [PATCH] Set CSharpier print width to 180 and reflow sources Users found the 100-column default too narrow. Add a .csharpierrc with printWidth 180, set max_line_length to 180 in .editorconfig, and reformat Editor, Runtime, and Tests with CSharpier 1.1.2. 66 of 110 files change; the diff is mechanical formatter output joining lines that now fit, with no manual edits. Validation: CSharpier check, member-order, null-assertions, usings, assembly-warnings, file-length, and llm lints pass; npm pack succeeds; EditMode 357/357 and PlayMode 15/15 on the connected host (Unity 6000.5.2f1). --- .csharpierrc | 3 + .editorconfig | 1 + .llm/context.md | 4 +- .../Data/DataVisualizerSettings.cs | 69 +- .../Data/DataVisualizerUserState.cs | 64 +- .../Data/LastObjectSelectionEntry.cs | 6 +- .../Data/NamespaceCollapseState.cs | 29 +- .../DataVisualizer/Data/NamespaceTypeOrder.cs | 40 +- .../DataVisualizer/Data/PersistedStateCopy.cs | 16 +- .../Data/TypeLabelFilterConfig.cs | 5 +- Editor/DataVisualizer/DataVisualizer.cs | 2270 ++++------------- .../Extensions/ListViewCompatExtensions.cs | 5 +- .../DataVisualizer/Extensions/UIExtensions.cs | 24 +- Editor/DataVisualizer/NamespaceController.cs | 285 +-- .../Search/SearchHighlightUtility.cs | 16 +- .../Search/SearchResultMatchInfo.cs | 32 +- .../Styles/DataVisualizerThemeSelection.cs | 36 +- .../Styles/DataVisualizerThemeSettings.cs | 6 +- .../DataVisualizer/UI/ActionButtonToggle.cs | 10 +- Editor/DataVisualizer/UI/HorizontalToggle.cs | 59 +- .../UI/SearchableThemeDropdown.cs | 53 +- .../DataVisualizer/UI/ThemeDropdownPopup.cs | 13 +- .../Unity/DataVisualizerAssetPostProcessor.cs | 25 +- .../Utilities/AssetGuidDiscovery.cs | 58 +- .../Utilities/AssetGuidOrder.cs | 16 +- .../Utilities/AssetGuidTypeIndex.cs | 26 +- .../Utilities/AssetsFolderUtility.cs | 40 +- .../Utilities/DirectoryHelper.cs | 57 +- .../Utilities/MonitorUtility.cs | 58 +- .../Utilities/ReadOnlyPropertyDrawer.cs | 4 +- .../Utilities/ReflectionHelpers.cs | 11 +- .../Utilities/ReusableDisposalLease.cs | 6 +- Runtime/DataVisualizer/BaseDataObject.cs | 22 +- .../Editor/AssetGuidDiscoveryDeferralTests.cs | 14 +- Tests/Editor/AssetGuidDiscoveryTests.cs | 192 +- Tests/Editor/AssetGuidOrderTests.cs | 35 +- .../Editor/AssetGuidTypeIndexDeferralTests.cs | 32 +- Tests/Editor/AssetsFolderUtilityTests.cs | 49 +- Tests/Editor/BaseDataObjectIdentityTests.cs | 24 +- Tests/Editor/ConsoleNoiseRegressionTests.cs | 269 +- Tests/Editor/DataProcessorTests.cs | 9 +- Tests/Editor/DirectoryHelperTests.cs | 71 +- Tests/Editor/DisposalScopeTests.cs | 18 +- Tests/Editor/DocsImageCapture.cs | 546 +--- Tests/Editor/DocsImageCaptureTests.cs | 438 +--- Tests/Editor/EditorSurfaceCapture.cs | 70 +- Tests/Editor/EditorSurfaceCaptureResult.cs | 11 +- Tests/Editor/EditorSurfaceCaptureTests.cs | 129 +- Tests/Editor/EnumContractTests.cs | 18 +- Tests/Editor/LabelFilterEvaluatorTests.cs | 165 +- Tests/Editor/MonitorUtilityTests.cs | 393 +-- Tests/Editor/NamespaceOrderingTests.cs | 88 +- Tests/Editor/ObjectIdExtensionsTests.cs | 22 +- Tests/Editor/PersistenceContractTests.cs | 57 +- Tests/Editor/PlayModeMutationGateTests.cs | 282 +- Tests/Editor/PlayModeSuspensionTests.cs | 91 +- Tests/Editor/RuntimeAssemblySurfaceTests.cs | 32 +- Tests/Editor/RuntimeSignatureContractTests.cs | 96 +- .../SavedSelectionNormalizationTests.cs | 132 +- Tests/Editor/SearchHighlightUtilityTests.cs | 131 +- Tests/Editor/SearchResultMatchInfoTests.cs | 4 +- Tests/Editor/SelectionPersistenceTests.cs | 128 +- Tests/Editor/SettingsPersistenceTests.cs | 101 +- Tests/Editor/SplitterWidthPersistenceTests.cs | 139 +- Tests/Editor/ThemeSelectionTests.cs | 623 +---- Tests/Editor/TypePopoverLayoutTests.cs | 85 +- Tests/Runtime/BaseDataObjectLifecycleTests.cs | 50 +- 67 files changed, 1508 insertions(+), 6405 deletions(-) create mode 100644 .csharpierrc diff --git a/.csharpierrc b/.csharpierrc new file mode 100644 index 0000000..19997cc --- /dev/null +++ b/.csharpierrc @@ -0,0 +1,3 @@ +{ + "printWidth": 180 +} diff --git a/.editorconfig b/.editorconfig index 414305d..a78703a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,6 +6,7 @@ trim_trailing_whitespace = false insert_final_newline = false indent_style = space indent_size = 4 +max_line_length = 180 # Microsoft .NET properties csharp_new_line_before_members_in_object_initializers = false diff --git a/.llm/context.md b/.llm/context.md index 71063c0..629cba3 100644 --- a/.llm/context.md +++ b/.llm/context.md @@ -61,8 +61,8 @@ editing any skill with `pwsh -NoProfile -File scripts/generate-skills-index.ps1` enforces this; file-level usings are sanctioned only for namespaceless assembly-attribute files and `[assembly: ...]` preambles such as `InternalsVisibleTo` (#124). -2. Format every modified `.cs` file with CSharpier 1.1.2 - (`dotnet tool run csharpier -- format `); treat formatting as a gate. +2. Format every modified `.cs` file with CSharpier 1.1.2 (print width 180 in + `.csharpierrc`; `dotnet tool run csharpier -- format `); gate on it. 3. Resolve analyzer warnings before review. 4. Prefer explicit namespaces so the window's namespace/type tree stays predictable. 5. Avoid runtime reflection and stringly-typed lookups; wire menu items, property diff --git a/Editor/DataVisualizer/Data/DataVisualizerSettings.cs b/Editor/DataVisualizer/Data/DataVisualizerSettings.cs index 01cdeb1..2bb5503 100644 --- a/Editor/DataVisualizer/Data/DataVisualizerSettings.cs +++ b/Editor/DataVisualizer/Data/DataVisualizerSettings.cs @@ -8,20 +8,14 @@ namespace WallstopStudios.DataVisualizer.Editor.Data using Utilities; using WallstopStudios.DataVisualizer; - [CreateAssetMenu( - fileName = "DataVisualizerSettings", - menuName = "Wallstop Studios/DxVisualizer/DxVisualizer Settings", - order = 1 - )] + [CreateAssetMenu(fileName = "DataVisualizerSettings", menuName = "Wallstop Studios/DxVisualizer/DxVisualizer Settings", order = 1)] public sealed class DataVisualizerSettings : ScriptableObject { public const string DefaultDataFolderPath = "Assets/Data"; public string DataFolderPath => _dataFolderPath; - [Tooltip( - "If true, window state (selection, order, collapse) is saved in a special ScriptableObject. If false, state is saved within this settings asset file." - )] + [Tooltip("If true, window state (selection, order, collapse) is saved in a special ScriptableObject. If false, state is saved within this settings asset file.")] public bool persistStateInSettingsAsset; [Tooltip("If true, when selecting an Object, it will be selected in the Inspector.")] @@ -31,9 +25,7 @@ public sealed class DataVisualizerSettings : ScriptableObject [ReadOnly] public string themeGuid = string.Empty; - [Tooltip( - "Path relative to the project root (e.g., Assets/Data) where DataObject assets might be located or created." - )] + [Tooltip("Path relative to the project root (e.g., Assets/Data) where DataObject assets might be located or created.")] [SerializeField] internal string _dataFolderPath = DefaultDataFolderPath; @@ -111,17 +103,11 @@ public void HydrateFrom(DataVisualizerUserState userState) lastSelectedTypeFullName = userState.lastSelectedTypeFullName; namespaceOrder = PersistedStateCopy.CloneStrings(userState.namespaceOrder); typeOrders = PersistedStateCopy.CloneNamespaceTypeOrders(userState.typeOrders); - lastObjectSelections = PersistedStateCopy.CloneLastObjectSelections( - userState.lastObjectSelections - ); - namespaceCollapseStates = PersistedStateCopy.CloneNamespaceCollapseStates( - userState.namespaceCollapseStates - ); + lastObjectSelections = PersistedStateCopy.CloneLastObjectSelections(userState.lastObjectSelections); + namespaceCollapseStates = PersistedStateCopy.CloneNamespaceCollapseStates(userState.namespaceCollapseStates); objectOrders = PersistedStateCopy.CloneTypeObjectOrders(userState.objectOrders); managedTypeNames = PersistedStateCopy.CloneStrings(userState.managedTypeNames); - labelFilterConfigs = PersistedStateCopy.CloneTypeLabelFilterConfigs( - userState.labelFilterConfigs - ); + labelFilterConfigs = PersistedStateCopy.CloneTypeLabelFilterConfigs(userState.labelFilterConfigs); processorStates = PersistedStateCopy.CloneProcessorStates(userState.processorStates); MarkDirty(); } @@ -134,11 +120,7 @@ public bool SetNamespaceCollapsed(string namespaceKey, bool isCollapsed) } namespaceCollapseStates ??= new List(); - bool changed = NamespaceCollapseState.SetCollapsed( - namespaceCollapseStates, - namespaceKey, - isCollapsed - ); + bool changed = NamespaceCollapseState.SetCollapsed(namespaceCollapseStates, namespaceKey, isCollapsed); if (changed) { MarkDirty(); @@ -160,9 +142,7 @@ public bool RemoveNamespaceCollapseState(string namespaceKey) internal List GetOrCreateObjectOrderList(string typeFullName) { - TypeObjectOrder entry = objectOrders.Find(o => - string.Equals(o.TypeFullName, typeFullName, StringComparison.Ordinal) - ); + TypeObjectOrder entry = objectOrders.Find(o => string.Equals(o.TypeFullName, typeFullName, StringComparison.Ordinal)); if (entry != null) { return entry.ObjectGuids; @@ -181,9 +161,7 @@ internal bool SetLastObjectForType(string typeFullName, string guid) } lastObjectSelections ??= new List(); - int existingIndex = lastObjectSelections.FindIndex(e => - string.Equals(e.typeFullName, typeFullName, StringComparison.Ordinal) - ); + int existingIndex = lastObjectSelections.FindIndex(e => string.Equals(e.typeFullName, typeFullName, StringComparison.Ordinal)); if (string.IsNullOrWhiteSpace(guid)) { if (existingIndex < 0) @@ -196,14 +174,7 @@ internal bool SetLastObjectForType(string typeFullName, string guid) return true; } - if ( - 0 <= existingIndex - && string.Equals( - lastObjectSelections[existingIndex].objectGuid, - guid, - StringComparison.Ordinal - ) - ) + if (0 <= existingIndex && string.Equals(lastObjectSelections[existingIndex].objectGuid, guid, StringComparison.Ordinal)) { return false; } @@ -214,9 +185,7 @@ internal bool SetLastObjectForType(string typeFullName, string guid) } else { - lastObjectSelections.Add( - new LastObjectSelectionEntry { typeFullName = typeFullName, objectGuid = guid } - ); + lastObjectSelections.Add(new LastObjectSelectionEntry { typeFullName = typeFullName, objectGuid = guid }); } MarkDirty(); @@ -230,16 +199,12 @@ internal string GetLastObjectForType(string typeFullName) return null; } - return lastObjectSelections - ?.Find(e => string.Equals(e.typeFullName, typeFullName, StringComparison.Ordinal)) - ?.objectGuid; + return lastObjectSelections?.Find(e => string.Equals(e.typeFullName, typeFullName, StringComparison.Ordinal))?.objectGuid; } internal List GetOrCreateTypeOrderList(string namespaceKey) { - NamespaceTypeOrder entry = typeOrders.Find(o => - string.Equals(o.namespaceKey, namespaceKey, StringComparison.Ordinal) - ); + NamespaceTypeOrder entry = typeOrders.Find(o => string.Equals(o.namespaceKey, namespaceKey, StringComparison.Ordinal)); if (entry != null) { return entry.typeNames; @@ -252,17 +217,13 @@ internal List GetOrCreateTypeOrderList(string namespaceKey) internal bool HasCollapseState(string namespaceKey) { - NamespaceCollapseState entry = namespaceCollapseStates.Find(o => - string.Equals(o.namespaceKey, namespaceKey, StringComparison.Ordinal) - ); + NamespaceCollapseState entry = namespaceCollapseStates.Find(o => string.Equals(o.namespaceKey, namespaceKey, StringComparison.Ordinal)); return entry != null; } internal NamespaceCollapseState GetOrCreateCollapseState(string namespaceKey) { - NamespaceCollapseState entry = namespaceCollapseStates.Find(o => - string.Equals(o.namespaceKey, namespaceKey, StringComparison.Ordinal) - ); + NamespaceCollapseState entry = namespaceCollapseStates.Find(o => string.Equals(o.namespaceKey, namespaceKey, StringComparison.Ordinal)); if (entry != null) { return entry; diff --git a/Editor/DataVisualizer/Data/DataVisualizerUserState.cs b/Editor/DataVisualizer/Data/DataVisualizerUserState.cs index d5fcecd..c644fbd 100644 --- a/Editor/DataVisualizer/Data/DataVisualizerUserState.cs +++ b/Editor/DataVisualizer/Data/DataVisualizerUserState.cs @@ -34,19 +34,14 @@ public static DataVisualizerUserState FromJson(string json) try { - DataVisualizerUserState userState = JsonUtility.FromJson( - json - ); + DataVisualizerUserState userState = JsonUtility.FromJson(json); if (userState == null) { return userState; } LegacyUserState legacyUserState = JsonUtility.FromJson(json); - if ( - string.IsNullOrWhiteSpace(userState.lastSelectedTypeFullName) - && !string.IsNullOrWhiteSpace(legacyUserState?.lastSelectedTypeName) - ) + if (string.IsNullOrWhiteSpace(userState.lastSelectedTypeFullName) && !string.IsNullOrWhiteSpace(legacyUserState?.lastSelectedTypeName)) { userState.lastSelectedTypeFullName = legacyUserState.lastSelectedTypeName; } @@ -71,25 +66,17 @@ public void HydrateFrom(DataVisualizerSettings settings) lastSelectedTypeFullName = settings.lastSelectedTypeFullName; namespaceOrder = PersistedStateCopy.CloneStrings(settings.namespaceOrder); typeOrders = PersistedStateCopy.CloneNamespaceTypeOrders(settings.typeOrders); - lastObjectSelections = PersistedStateCopy.CloneLastObjectSelections( - settings.lastObjectSelections - ); - namespaceCollapseStates = PersistedStateCopy.CloneNamespaceCollapseStates( - settings.namespaceCollapseStates - ); + lastObjectSelections = PersistedStateCopy.CloneLastObjectSelections(settings.lastObjectSelections); + namespaceCollapseStates = PersistedStateCopy.CloneNamespaceCollapseStates(settings.namespaceCollapseStates); objectOrders = PersistedStateCopy.CloneTypeObjectOrders(settings.objectOrders); managedTypeNames = PersistedStateCopy.CloneStrings(settings.managedTypeNames); - labelFilterConfigs = PersistedStateCopy.CloneTypeLabelFilterConfigs( - settings.labelFilterConfigs - ); + labelFilterConfigs = PersistedStateCopy.CloneTypeLabelFilterConfigs(settings.labelFilterConfigs); processorStates = PersistedStateCopy.CloneProcessorStates(settings.processorStates); } public List GetOrCreateObjectOrderList(string typeFullName) { - TypeObjectOrder entry = objectOrders.Find(o => - string.Equals(o.TypeFullName, typeFullName, StringComparison.Ordinal) - ); + TypeObjectOrder entry = objectOrders.Find(o => string.Equals(o.TypeFullName, typeFullName, StringComparison.Ordinal)); if (entry != null) { return entry.ObjectGuids; @@ -108,9 +95,7 @@ public bool SetLastObjectForType(string typeFullName, string guid) } lastObjectSelections ??= new List(); - int existingIndex = lastObjectSelections.FindIndex(e => - string.Equals(e.typeFullName, typeFullName, StringComparison.Ordinal) - ); + int existingIndex = lastObjectSelections.FindIndex(e => string.Equals(e.typeFullName, typeFullName, StringComparison.Ordinal)); if (string.IsNullOrWhiteSpace(guid)) { if (existingIndex < 0) @@ -122,14 +107,7 @@ public bool SetLastObjectForType(string typeFullName, string guid) return true; } - if ( - 0 <= existingIndex - && string.Equals( - lastObjectSelections[existingIndex].objectGuid, - guid, - StringComparison.Ordinal - ) - ) + if (0 <= existingIndex && string.Equals(lastObjectSelections[existingIndex].objectGuid, guid, StringComparison.Ordinal)) { return false; } @@ -140,9 +118,7 @@ public bool SetLastObjectForType(string typeFullName, string guid) } else { - lastObjectSelections.Add( - new LastObjectSelectionEntry { typeFullName = typeFullName, objectGuid = guid } - ); + lastObjectSelections.Add(new LastObjectSelectionEntry { typeFullName = typeFullName, objectGuid = guid }); } return true; @@ -155,16 +131,12 @@ public string GetLastObjectForType(string typeFullName) return null; } - return lastObjectSelections - ?.Find(e => string.Equals(e.typeFullName, typeFullName, StringComparison.Ordinal)) - ?.objectGuid; + return lastObjectSelections?.Find(e => string.Equals(e.typeFullName, typeFullName, StringComparison.Ordinal))?.objectGuid; } public List GetOrCreateTypeOrderList(string namespaceKey) { - NamespaceTypeOrder entry = typeOrders.Find(o => - string.Equals(o.namespaceKey, namespaceKey, StringComparison.Ordinal) - ); + NamespaceTypeOrder entry = typeOrders.Find(o => string.Equals(o.namespaceKey, namespaceKey, StringComparison.Ordinal)); if (entry != null) { return entry.typeNames; @@ -177,9 +149,7 @@ public List GetOrCreateTypeOrderList(string namespaceKey) public bool HasCollapseState(string namespaceKey) { - NamespaceCollapseState entry = namespaceCollapseStates.Find(o => - string.Equals(o.namespaceKey, namespaceKey, StringComparison.Ordinal) - ); + NamespaceCollapseState entry = namespaceCollapseStates.Find(o => string.Equals(o.namespaceKey, namespaceKey, StringComparison.Ordinal)); return entry != null; } @@ -191,11 +161,7 @@ public bool SetNamespaceCollapsed(string namespaceKey, bool isCollapsed) } namespaceCollapseStates ??= new List(); - return NamespaceCollapseState.SetCollapsed( - namespaceCollapseStates, - namespaceKey, - isCollapsed - ); + return NamespaceCollapseState.SetCollapsed(namespaceCollapseStates, namespaceKey, isCollapsed); } public bool RemoveNamespaceCollapseState(string namespaceKey) @@ -205,9 +171,7 @@ public bool RemoveNamespaceCollapseState(string namespaceKey) public NamespaceCollapseState GetOrCreateCollapseState(string namespaceKey) { - NamespaceCollapseState entry = namespaceCollapseStates.Find(o => - string.Equals(o.namespaceKey, namespaceKey, StringComparison.Ordinal) - ); + NamespaceCollapseState entry = namespaceCollapseStates.Find(o => string.Equals(o.namespaceKey, namespaceKey, StringComparison.Ordinal)); if (entry != null) { return entry; diff --git a/Editor/DataVisualizer/Data/LastObjectSelectionEntry.cs b/Editor/DataVisualizer/Data/LastObjectSelectionEntry.cs index 033fd4c..8d13e67 100644 --- a/Editor/DataVisualizer/Data/LastObjectSelectionEntry.cs +++ b/Editor/DataVisualizer/Data/LastObjectSelectionEntry.cs @@ -10,11 +10,7 @@ public sealed class LastObjectSelectionEntry public LastObjectSelectionEntry Clone() { - return new LastObjectSelectionEntry - { - typeFullName = typeFullName ?? string.Empty, - objectGuid = objectGuid ?? string.Empty, - }; + return new LastObjectSelectionEntry { typeFullName = typeFullName ?? string.Empty, objectGuid = objectGuid ?? string.Empty }; } } } diff --git a/Editor/DataVisualizer/Data/NamespaceCollapseState.cs b/Editor/DataVisualizer/Data/NamespaceCollapseState.cs index 25b4ed8..a53e8cb 100644 --- a/Editor/DataVisualizer/Data/NamespaceCollapseState.cs +++ b/Editor/DataVisualizer/Data/NamespaceCollapseState.cs @@ -9,29 +9,17 @@ public sealed class NamespaceCollapseState public string namespaceKey = string.Empty; public bool isCollapsed; - public static bool SetCollapsed( - List states, - string namespaceKey, - bool isCollapsed - ) + public static bool SetCollapsed(List states, string namespaceKey, bool isCollapsed) { if (states == null || string.IsNullOrWhiteSpace(namespaceKey)) { return false; } - NamespaceCollapseState entry = states.Find(state => - string.Equals(state?.namespaceKey, namespaceKey, StringComparison.Ordinal) - ); + NamespaceCollapseState entry = states.Find(state => string.Equals(state?.namespaceKey, namespaceKey, StringComparison.Ordinal)); if (entry == null) { - states.Add( - new NamespaceCollapseState - { - namespaceKey = namespaceKey, - isCollapsed = isCollapsed, - } - ); + states.Add(new NamespaceCollapseState { namespaceKey = namespaceKey, isCollapsed = isCollapsed }); return true; } @@ -51,19 +39,12 @@ public static bool Remove(List states, string namespaceK return false; } - return 0 - < states.RemoveAll(state => - string.Equals(state?.namespaceKey, namespaceKey, StringComparison.Ordinal) - ); + return 0 < states.RemoveAll(state => string.Equals(state?.namespaceKey, namespaceKey, StringComparison.Ordinal)); } public NamespaceCollapseState Clone() { - return new NamespaceCollapseState - { - namespaceKey = namespaceKey ?? string.Empty, - isCollapsed = isCollapsed, - }; + return new NamespaceCollapseState { namespaceKey = namespaceKey ?? string.Empty, isCollapsed = isCollapsed }; } } } diff --git a/Editor/DataVisualizer/Data/NamespaceTypeOrder.cs b/Editor/DataVisualizer/Data/NamespaceTypeOrder.cs index 06c876d..576302a 100644 --- a/Editor/DataVisualizer/Data/NamespaceTypeOrder.cs +++ b/Editor/DataVisualizer/Data/NamespaceTypeOrder.cs @@ -9,43 +9,23 @@ public sealed class NamespaceTypeOrder public string namespaceKey = string.Empty; public List typeNames = new(); - public static int CompareTypesByFullNameOrder( - Type lhs, - Type rhs, - IReadOnlyList typeFullNameOrder - ) + public static int CompareTypesByFullNameOrder(Type lhs, Type rhs, IReadOnlyList typeFullNameOrder) { - return CompareTypeFullNames( - lhs?.FullName ?? string.Empty, - rhs?.FullName ?? string.Empty, - typeFullNameOrder - ); + return CompareTypeFullNames(lhs?.FullName ?? string.Empty, rhs?.FullName ?? string.Empty, typeFullNameOrder); } public static int CompareTypesByFullName(Type lhs, Type rhs) { - return string.Compare( - lhs?.FullName ?? string.Empty, - rhs?.FullName ?? string.Empty, - StringComparison.Ordinal - ); + return string.Compare(lhs?.FullName ?? string.Empty, rhs?.FullName ?? string.Empty, StringComparison.Ordinal); } public static int CompareTypesByNameThenFullName(Type lhs, Type rhs) { - int nameComparison = string.Compare( - lhs?.Name ?? string.Empty, - rhs?.Name ?? string.Empty, - StringComparison.Ordinal - ); + int nameComparison = string.Compare(lhs?.Name ?? string.Empty, rhs?.Name ?? string.Empty, StringComparison.Ordinal); return nameComparison != 0 ? nameComparison : CompareTypesByFullName(lhs, rhs); } - public static int CompareTypeFullNames( - string lhsFullName, - string rhsFullName, - IReadOnlyList typeFullNameOrder - ) + public static int CompareTypeFullNames(string lhsFullName, string rhsFullName, IReadOnlyList typeFullNameOrder) { int indexA = IndexOf(typeFullNameOrder, lhsFullName); int indexB = IndexOf(typeFullNameOrder, rhsFullName); @@ -58,9 +38,7 @@ IReadOnlyList typeFullNameOrder return -1; } - return 0 <= indexB - ? 1 - : string.Compare(lhsFullName, rhsFullName, StringComparison.Ordinal); + return 0 <= indexB ? 1 : string.Compare(lhsFullName, rhsFullName, StringComparison.Ordinal); } public static Type FindTypeByFullName(IEnumerable types, string typeFullName) @@ -101,11 +79,7 @@ private static int IndexOf(IReadOnlyList values, string value) public NamespaceTypeOrder Clone() { - return new NamespaceTypeOrder - { - namespaceKey = namespaceKey ?? string.Empty, - typeNames = PersistedStateCopy.CloneStrings(typeNames), - }; + return new NamespaceTypeOrder { namespaceKey = namespaceKey ?? string.Empty, typeNames = PersistedStateCopy.CloneStrings(typeNames) }; } } } diff --git a/Editor/DataVisualizer/Data/PersistedStateCopy.cs b/Editor/DataVisualizer/Data/PersistedStateCopy.cs index 028f239..0ab145c 100644 --- a/Editor/DataVisualizer/Data/PersistedStateCopy.cs +++ b/Editor/DataVisualizer/Data/PersistedStateCopy.cs @@ -9,9 +9,7 @@ internal static List CloneStrings(List source) return source == null ? new List() : new List(source); } - internal static List CloneNamespaceTypeOrders( - List source - ) + internal static List CloneNamespaceTypeOrders(List source) { List clones = new(source?.Count ?? 0); if (source == null) @@ -27,9 +25,7 @@ List source return clones; } - internal static List CloneLastObjectSelections( - List source - ) + internal static List CloneLastObjectSelections(List source) { List clones = new(source?.Count ?? 0); if (source == null) @@ -45,9 +41,7 @@ List source return clones; } - internal static List CloneNamespaceCollapseStates( - List source - ) + internal static List CloneNamespaceCollapseStates(List source) { List clones = new(source?.Count ?? 0); if (source == null) @@ -79,9 +73,7 @@ internal static List CloneTypeObjectOrders(List CloneTypeLabelFilterConfigs( - List source - ) + internal static List CloneTypeLabelFilterConfigs(List source) { List clones = new(source?.Count ?? 0); if (source == null) diff --git a/Editor/DataVisualizer/Data/TypeLabelFilterConfig.cs b/Editor/DataVisualizer/Data/TypeLabelFilterConfig.cs index e923b92..642c10b 100644 --- a/Editor/DataVisualizer/Data/TypeLabelFilterConfig.cs +++ b/Editor/DataVisualizer/Data/TypeLabelFilterConfig.cs @@ -30,10 +30,7 @@ public TypeLabelFilterConfig Clone() isCollapsed = isCollapsed, isAdvancedCollapsed = isAdvancedCollapsed, #pragma warning disable CS0618 // Type or member is obsolete - combinationType = - combinationType == LabelCombinationType.None - ? LabelCombinationType.And - : combinationType, + combinationType = combinationType == LabelCombinationType.None ? LabelCombinationType.And : combinationType, #pragma warning restore CS0618 // Type or member is obsolete typeFullName = typeFullName ?? string.Empty, andLabels = PersistedStateCopy.CloneStrings(andLabels), diff --git a/Editor/DataVisualizer/DataVisualizer.cs b/Editor/DataVisualizer/DataVisualizer.cs index 49915cf..af01758 100644 --- a/Editor/DataVisualizer/DataVisualizer.cs +++ b/Editor/DataVisualizer/DataVisualizer.cs @@ -37,8 +37,7 @@ public sealed class DataVisualizer : EditorWindow private const string PrefsSplitterInnerKey = PrefsPrefix + "SplitterInnerFixedPaneWidth"; private const string PrefsInitialSizeAppliedKey = PrefsPrefix + "InitialSizeApplied"; private const string PrefsPreferredWindowSizeKey = PrefsPrefix + "PreferredWindowSize"; - private const string PrefsTemporaryWindowClampSizeKey = - PrefsPrefix + "TemporaryWindowClampSize"; + private const string PrefsTemporaryWindowClampSizeKey = PrefsPrefix + "TemporaryWindowClampSize"; private const string SettingsDefaultPath = "Assets/Editor/DataVisualizerSettings.asset"; private const string UserStateFileName = "DataVisualizerUserState.json"; @@ -49,8 +48,7 @@ public sealed class DataVisualizer : EditorWindow private const string ObjectItemActionsClass = "object-item-actions"; private const string PopoverListItemClassName = "type-selection-list-item"; - private const string PopoverListItemDisabledClassName = - "type-selection-list-item--disabled"; + private const string PopoverListItemDisabledClassName = "type-selection-list-item--disabled"; private const string PopoverListNamespaceClassName = "type-selection-list-namespace"; private const string PopoverNamespaceHeaderClassName = "popover-namespace-header"; @@ -61,10 +59,8 @@ public sealed class DataVisualizer : EditorWindow private const string LabelSuggestionItemClass = "label-suggestion-item"; private const string SearchPlaceholder = "Search..."; - private const string SelectDataFolderDialogTitle = - "Select Data Object Type Load Folder (Must be inside Assets)"; - private const string SelectScriptFolderDialogTitle = - "Select Script Load Folder (Must be inside Assets)"; + private const string SelectDataFolderDialogTitle = "Select Data Object Type Load Folder (Must be inside Assets)"; + private const string SelectScriptFolderDialogTitle = "Select Script Load Folder (Must be inside Assets)"; private const int MaxSearchResults = 25; private const float DefaultOuterSplitWidth = 350f; @@ -72,8 +68,7 @@ public sealed class DataVisualizer : EditorWindow private const float MinNamespacePaneWidth = 320f; private const float MinObjectPaneWidth = 220f; private const float MinInspectorPaneWidth = 260f; - private const float MinWindowWidth = - MinNamespacePaneWidth + MinObjectPaneWidth + MinInspectorPaneWidth + 60f; + private const float MinWindowWidth = MinNamespacePaneWidth + MinObjectPaneWidth + MinInspectorPaneWidth + 60f; private const float MinWindowHeight = 480f; private const int SplitterWidthSaveDebounceMilliseconds = 250; private const int AsyncLoadBatchSize = 100; @@ -108,33 +103,20 @@ Set to true to see detailed loading performance logs in Unity Console private static readonly char[] WhitespaceSeparators = { ' ' }; - private static readonly ReusableDisposalScope<( - DataVisualizer window, - HashSet typeElements - )> TypeSearchCleanupScopes = new(FinalizeTypeSearch); + private static readonly ReusableDisposalScope<(DataVisualizer window, HashSet typeElements)> TypeSearchCleanupScopes = new(FinalizeTypeSearch); - private static readonly ReusableDisposalScope<( - DataVisualizer window, - string filter - )> TypePopoverCleanupScopes = new(FinalizeTypePopover); + private static readonly ReusableDisposalScope<(DataVisualizer window, string filter)> TypePopoverCleanupScopes = new(FinalizeTypePopover); - private static readonly ReusableDisposalScope<( - DataVisualizer window, - bool buildObjectsView - )> LabelFilterCleanupScopes = new(FinalizeLabelFilter); + private static readonly ReusableDisposalScope<(DataVisualizer window, bool buildObjectsView)> LabelFilterCleanupScopes = new(FinalizeLabelFilter); - private static readonly ReusableDisposalScope<( - DataVisualizer window, - VisualElement draggedElement - )> DragCleanupScopes = new(FinalizeDrag); + private static readonly ReusableDisposalScope<(DataVisualizer window, VisualElement draggedElement)> DragCleanupScopes = new(FinalizeDrag); /* Action buttons stop pointer-down here so clicking one doesn't retarget the ListView's selection (which otherwise drops the current selection when using go-up/go-down/etc.) or start a row drag from a button. */ - private static readonly EventCallback StopRowChildPointerDown = evt => - evt.StopPropagation(); + private static readonly EventCallback StopRowChildPointerDown = evt => evt.StopPropagation(); internal DataVisualizerUserState UserState { @@ -173,11 +155,9 @@ this so user-initiated actions cannot edit assets or the managed catalog during */ internal bool IsAssetEditingSuspended => _suspendedForPlayMode; - private TypeLabelFilterConfig CurrentTypeLabelFilterConfig => - LoadOrCreateLabelFilterConfig(_namespaceController.SelectedType); + private TypeLabelFilterConfig CurrentTypeLabelFilterConfig => LoadOrCreateLabelFilterConfig(_namespaceController.SelectedType); - private ProcessorState CurrentProcessorState => - LoadOrCreateProcessorState(_namespaceController.SelectedType); + private ProcessorState CurrentProcessorState => LoadOrCreateProcessorState(_namespaceController.SelectedType); private int HiddenNamespaces { @@ -194,22 +174,18 @@ private int HiddenNamespaces } else if (value <= 15) { - _namespaceColumnLabel.text = - $"Namespaces ({value} hidden)"; + _namespaceColumnLabel.text = $"Namespaces ({value} hidden)"; } else { - _namespaceColumnLabel.text = - $"Namespaces ({value} hidden)"; + _namespaceColumnLabel.text = $"Namespaces ({value} hidden)"; } } } #pragma warning restore CS0618 // Type or member is obsolete } - internal readonly Dictionary> _scriptableObjectTypes = new( - StringComparer.Ordinal - ); + internal readonly Dictionary> _scriptableObjectTypes = new(StringComparer.Ordinal); internal bool _isDragging; private readonly Dictionary _namespaceOrder = new(StringComparer.Ordinal); @@ -428,9 +404,7 @@ Incremented on each fresh (non-continuation) async load. Scheduled callbacks (au assets by this so user ordering survives batched loading instead of being overwritten by an alphabetical sort. Rebuilt at the start of each LoadObjectTypesAsync. */ - private readonly Dictionary _asyncDisplayOrderByGuid = new( - StringComparer.Ordinal - ); + private readonly Dictionary _asyncDisplayOrderByGuid = new(StringComparer.Ordinal); /* Display-order index cached per already-inserted object so batch insertion stays cheap @@ -473,11 +447,7 @@ public static void ShowWindow() } Vector2 preferredSize = window.ReadPreferredWindowSize(); - Rect centeredRect = MonitorUtility.CalculateCenteredRect( - placementArea, - preferredSize.x, - preferredSize.y - ); + Rect centeredRect = MonitorUtility.CalculateCenteredRect(placementArea, preferredSize.x, preferredSize.y); WriteWindowSize(PrefsPreferredWindowSizeKey, preferredSize); window.BeginPackageWindowPlacement(centeredRect.size, preferredSize); /* @@ -498,10 +468,7 @@ public static void SignalRefresh() } } - public static bool ApplySelectActiveObjectPreference( - DataVisualizerSettings settings, - bool selectActiveObject - ) + public static bool ApplySelectActiveObjectPreference(DataVisualizerSettings settings, bool selectActiveObject) { if (settings == null || !settings.SetSelectActiveObject(selectActiveObject)) { @@ -512,10 +479,7 @@ bool selectActiveObject return true; } - public static VisualElement FindAncestorNamespaceGroup( - VisualElement startingElement, - VisualElement namespaceListContainer - ) + public static VisualElement FindAncestorNamespaceGroup(VisualElement startingElement, VisualElement namespaceListContainer) { if (startingElement == null) { @@ -536,9 +500,7 @@ VisualElement namespaceListContainer return null; } - public static string FindFirstNamespaceKeyByOrder( - IReadOnlyDictionary namespaceOrder - ) + public static string FindFirstNamespaceKeyByOrder(IReadOnlyDictionary namespaceOrder) { if (namespaceOrder == null || namespaceOrder.Count == 0) { @@ -551,13 +513,7 @@ IReadOnlyDictionary namespaceOrder { if ( entry.Value < firstNamespaceIndex - || ( - entry.Value == firstNamespaceIndex - && ( - firstNamespaceKey == null - || string.CompareOrdinal(entry.Key, firstNamespaceKey) < 0 - ) - ) + || (entry.Value == firstNamespaceIndex && (firstNamespaceKey == null || string.CompareOrdinal(entry.Key, firstNamespaceKey) < 0)) ) { firstNamespaceKey = entry.Key; @@ -589,10 +545,7 @@ string savedTypeFullName continue; } - Type savedType = NamespaceTypeOrder.FindTypeByFullName( - namespaceTypes, - savedTypeFullName - ); + Type savedType = NamespaceTypeOrder.FindTypeByFullName(namespaceTypes, savedTypeFullName); if (savedType != null) { return savedType; @@ -600,11 +553,7 @@ string savedTypeFullName } } - if ( - !string.IsNullOrWhiteSpace(savedNamespaceKey) - && typesByNamespace.TryGetValue(savedNamespaceKey, out List savedTypes) - && savedTypes is { Count: > 0 } - ) + if (!string.IsNullOrWhiteSpace(savedNamespaceKey) && typesByNamespace.TryGetValue(savedNamespaceKey, out List savedTypes) && savedTypes is { Count: > 0 }) { return savedTypes[0]; } @@ -612,24 +561,16 @@ string savedTypeFullName string firstOrderedNamespaceKey = FindFirstNamespaceKeyByOrder(namespaceOrder); if ( !string.IsNullOrWhiteSpace(firstOrderedNamespaceKey) - && typesByNamespace.TryGetValue( - firstOrderedNamespaceKey, - out List firstOrderedTypes - ) + && typesByNamespace.TryGetValue(firstOrderedNamespaceKey, out List firstOrderedTypes) && firstOrderedTypes is { Count: > 0 } ) { return firstOrderedTypes[0]; } - foreach ( - string namespaceKey in OrderNamespaceKeysByOrderThenOrdinalName(namespaceOrder) - ) + foreach (string namespaceKey in OrderNamespaceKeysByOrderThenOrdinalName(namespaceOrder)) { - if ( - typesByNamespace.TryGetValue(namespaceKey, out List orderedTypes) - && orderedTypes is { Count: > 0 } - ) + if (typesByNamespace.TryGetValue(namespaceKey, out List orderedTypes) && orderedTypes is { Count: > 0 }) { return orderedTypes[0]; } @@ -726,9 +667,7 @@ private static bool OrderedStringListsEqual(List lhs, List rhs) comparison. List.Sort is unstable, so the tie-break belongs in the comparison itself. Dictionary keys are unique, so persisting one order value per key yields a total order. */ - private static List OrderNamespaceKeysByOrderThenOrdinalName( - IReadOnlyDictionary namespaceOrder - ) + private static List OrderNamespaceKeysByOrderThenOrdinalName(IReadOnlyDictionary namespaceOrder) { List> entries = new(namespaceOrder?.Count ?? 0); if (namespaceOrder != null) @@ -743,9 +682,7 @@ IReadOnlyDictionary namespaceOrder static (lhs, rhs) => { int valueComparison = lhs.Value.CompareTo(rhs.Value); - return valueComparison != 0 - ? valueComparison - : string.CompareOrdinal(lhs.Key, rhs.Key); + return valueComparison != 0 ? valueComparison : string.CompareOrdinal(lhs.Key, rhs.Key); } ); @@ -762,9 +699,7 @@ IReadOnlyDictionary namespaceOrder Returns the first type of the first non-empty namespace type list in Ordinal namespace-key order, the last fallback of ResolveSelectedTypeByFullName. */ - private static Type FindFirstTypeByOrdinalNamespaceKey( - IReadOnlyDictionary> typesByNamespace - ) + private static Type FindFirstTypeByOrdinalNamespaceKey(IReadOnlyDictionary> typesByNamespace) { List>> entries = new(typesByNamespace.Count); foreach (KeyValuePair> entry in typesByNamespace) @@ -789,16 +724,11 @@ private static DataVisualizerSettings LoadOrCreateSettings() { DataVisualizerSettings settings = null; - string[] settingsGuids = AssetDatabase.FindAssets( - $"t:{nameof(DataVisualizerSettings)}" - ); + string[] settingsGuids = AssetDatabase.FindAssets($"t:{nameof(DataVisualizerSettings)}"); int foundSettingsCount = 0; foreach (string settingsGuid in settingsGuids) { - DataVisualizerSettings candidate = - AssetDatabase.LoadAssetAtPath( - AssetDatabase.GUIDToAssetPath(settingsGuid) - ); + DataVisualizerSettings candidate = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(settingsGuid)); if (candidate == null) { continue; @@ -813,9 +743,7 @@ private static DataVisualizerSettings LoadOrCreateSettings() if (1 < foundSettingsCount) { - Debug.LogWarning( - $"Multiple DataVisualizerSettings assets found ({foundSettingsCount}). Using the first one." - ); + Debug.LogWarning($"Multiple DataVisualizerSettings assets found ({foundSettingsCount}). Using the first one."); } if (settings == null) @@ -834,8 +762,7 @@ private static DataVisualizerSettings LoadOrCreateSettings() AssetDatabase.CreateAsset(settings, SettingsDefaultPath); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); - DataVisualizerSettings newSettings = - AssetDatabase.LoadAssetAtPath(SettingsDefaultPath); + DataVisualizerSettings newSettings = AssetDatabase.LoadAssetAtPath(SettingsDefaultPath); if (newSettings != null) { settings = newSettings; @@ -855,9 +782,7 @@ private static void LoadStyleSheetIfAvailable(VisualElement root) { StyleSheet styleSheet = null; Font font = null; - string packageRoot = DirectoryHelper.FindPackageRootPath( - DirectoryHelper.GetCallerScriptDirectory() - ); + string packageRoot = DirectoryHelper.FindPackageRootPath(DirectoryHelper.GetCallerScriptDirectory()); if (!string.IsNullOrWhiteSpace(packageRoot)) { // Convert absolute path to Unity relative path if needed @@ -871,26 +796,16 @@ private static void LoadStyleSheetIfAvailable(VisualElement root) string normalizedProjectPath = projectPath.Replace('\\', '/'); string normalizedPackageRoot = packageRoot.Replace('\\', '/'); - if ( - normalizedPackageRoot.StartsWith( - normalizedProjectPath, - StringComparison.OrdinalIgnoreCase - ) - ) + if (normalizedPackageRoot.StartsWith(normalizedProjectPath, StringComparison.OrdinalIgnoreCase)) { // Extract the part after project root - string relativePart = normalizedPackageRoot - .Substring(normalizedProjectPath.Length) - .TrimStart('/'); + string relativePart = normalizedPackageRoot.Substring(normalizedProjectPath.Length).TrimStart('/'); packagePath = relativePart; } else { // Not within project, try to find Packages folder in path - int packagesIndex = normalizedPackageRoot.IndexOf( - "/Packages/", - StringComparison.OrdinalIgnoreCase - ); + int packagesIndex = normalizedPackageRoot.IndexOf("/Packages/", StringComparison.OrdinalIgnoreCase); if (0 <= packagesIndex) { packagePath = normalizedPackageRoot.Substring(packagesIndex + 1); // +1 to skip the leading slash so the path starts at "Packages/" @@ -899,13 +814,7 @@ private static void LoadStyleSheetIfAvailable(VisualElement root) { // Just try to extract the folder name string folderName = Path.GetFileName(packageRoot); - if ( - !string.IsNullOrWhiteSpace(folderName) - && folderName.Contains( - "DataVisualizer", - StringComparison.OrdinalIgnoreCase - ) - ) + if (!string.IsNullOrWhiteSpace(folderName) && folderName.Contains("DataVisualizer", StringComparison.OrdinalIgnoreCase)) { packagePath = $"Packages/{folderName}"; } @@ -951,11 +860,7 @@ private static void LoadStyleSheetIfAvailable(VisualElement root) } } - string[] fontPathsToTry = new[] - { - $"{packagePath}/Editor/Fonts/IBMPlexMono-Regular.ttf", - $"Packages/{PackageId}/Editor/Fonts/IBMPlexMono-Regular.ttf", - }; + string[] fontPathsToTry = new[] { $"{packagePath}/Editor/Fonts/IBMPlexMono-Regular.ttf", $"Packages/{PackageId}/Editor/Fonts/IBMPlexMono-Regular.ttf" }; foreach (string fontPath in fontPathsToTry) { @@ -970,15 +875,9 @@ private static void LoadStyleSheetIfAvailable(VisualElement root) // Fallback to absolute path conversion if direct paths didn't work if (styleSheet == null || font == null) { - if ( - packageRoot.StartsWith("Packages", StringComparison.OrdinalIgnoreCase) - && !packageRoot.Contains(PackageId, StringComparison.OrdinalIgnoreCase) - ) + if (packageRoot.StartsWith("Packages", StringComparison.OrdinalIgnoreCase) && !packageRoot.Contains(PackageId, StringComparison.OrdinalIgnoreCase)) { - int dataVisualizerIndex = packageRoot.LastIndexOf( - "DataVisualizer", - StringComparison.Ordinal - ); + int dataVisualizerIndex = packageRoot.LastIndexOf("DataVisualizer", StringComparison.Ordinal); if (0 <= dataVisualizerIndex) { packageRoot = packageRoot[..dataVisualizerIndex]; @@ -989,106 +888,68 @@ private static void LoadStyleSheetIfAvailable(VisualElement root) char pathSeparator = Path.DirectorySeparatorChar; if (styleSheet == null) { - string styleSheetPath = - $"{packageRoot}{pathSeparator}Editor{pathSeparator}DataVisualizer{pathSeparator}Styles{pathSeparator}DataVisualizerStyles.uss"; - string unityRelativeStyleSheetPath = - DirectoryHelper.AbsoluteToUnityRelativePath(styleSheetPath); + string styleSheetPath = $"{packageRoot}{pathSeparator}Editor{pathSeparator}DataVisualizer{pathSeparator}Styles{pathSeparator}DataVisualizerStyles.uss"; + string unityRelativeStyleSheetPath = DirectoryHelper.AbsoluteToUnityRelativePath(styleSheetPath); unityRelativeStyleSheetPath = unityRelativeStyleSheetPath.SanitizePath(); const string packageCache = "PackageCache/"; int packageCacheIndex; if (!string.IsNullOrWhiteSpace(unityRelativeStyleSheetPath)) { - styleSheet = AssetDatabase.LoadAssetAtPath( - unityRelativeStyleSheetPath - ); + styleSheet = AssetDatabase.LoadAssetAtPath(unityRelativeStyleSheetPath); } - if ( - styleSheet == null - && !string.IsNullOrWhiteSpace(unityRelativeStyleSheetPath) - ) + if (styleSheet == null && !string.IsNullOrWhiteSpace(unityRelativeStyleSheetPath)) { - packageCacheIndex = unityRelativeStyleSheetPath.IndexOf( - packageCache, - StringComparison.OrdinalIgnoreCase - ); + packageCacheIndex = unityRelativeStyleSheetPath.IndexOf(packageCache, StringComparison.OrdinalIgnoreCase); if (0 <= packageCacheIndex) { - unityRelativeStyleSheetPath = unityRelativeStyleSheetPath[ - (packageCacheIndex + packageCache.Length).. - ]; - int forwardIndex = unityRelativeStyleSheetPath.IndexOf( - "/", - StringComparison.Ordinal - ); + unityRelativeStyleSheetPath = unityRelativeStyleSheetPath[(packageCacheIndex + packageCache.Length)..]; + int forwardIndex = unityRelativeStyleSheetPath.IndexOf("/", StringComparison.Ordinal); if (0 <= forwardIndex) { - unityRelativeStyleSheetPath = - unityRelativeStyleSheetPath.Substring(forwardIndex); - unityRelativeStyleSheetPath = - "Packages/" + PackageId + "/" + unityRelativeStyleSheetPath; + unityRelativeStyleSheetPath = unityRelativeStyleSheetPath.Substring(forwardIndex); + unityRelativeStyleSheetPath = "Packages/" + PackageId + "/" + unityRelativeStyleSheetPath; } else { - unityRelativeStyleSheetPath = - "Packages/" + unityRelativeStyleSheetPath; + unityRelativeStyleSheetPath = "Packages/" + unityRelativeStyleSheetPath; } } if (!string.IsNullOrWhiteSpace(unityRelativeStyleSheetPath)) { - styleSheet = AssetDatabase.LoadAssetAtPath( - unityRelativeStyleSheetPath - ); + styleSheet = AssetDatabase.LoadAssetAtPath(unityRelativeStyleSheetPath); if (styleSheet == null) { - Debug.LogError( - $"Failed to load DxVisualizer style sheet (package root: '{packageRoot}'), relative path '{unityRelativeStyleSheetPath}'." - ); + Debug.LogError($"Failed to load DxVisualizer style sheet (package root: '{packageRoot}'), relative path '{unityRelativeStyleSheetPath}'."); } } else { - Debug.LogError( - $"Failed to convert absolute path '{styleSheetPath}' to Unity relative path." - ); + Debug.LogError($"Failed to convert absolute path '{styleSheetPath}' to Unity relative path."); } } } if (font == null) { - string fontPath = - $"{packageRoot}{pathSeparator}Editor{pathSeparator}Fonts{pathSeparator}IBMPlexMono-Regular.ttf"; - string unityRelativeFontPath = DirectoryHelper.AbsoluteToUnityRelativePath( - fontPath - ); + string fontPath = $"{packageRoot}{pathSeparator}Editor{pathSeparator}Fonts{pathSeparator}IBMPlexMono-Regular.ttf"; + string unityRelativeFontPath = DirectoryHelper.AbsoluteToUnityRelativePath(fontPath); font = AssetDatabase.LoadAssetAtPath(unityRelativeFontPath); if (font == null && !string.IsNullOrWhiteSpace(unityRelativeFontPath)) { const string packageCache = "PackageCache/"; - int packageCacheIndex = unityRelativeFontPath.IndexOf( - packageCache, - StringComparison.OrdinalIgnoreCase - ); + int packageCacheIndex = unityRelativeFontPath.IndexOf(packageCache, StringComparison.OrdinalIgnoreCase); if (0 <= packageCacheIndex) { - unityRelativeFontPath = unityRelativeFontPath[ - (packageCacheIndex + packageCache.Length).. - ]; - int forwardIndex = unityRelativeFontPath.IndexOf( - "/", - StringComparison.Ordinal - ); + unityRelativeFontPath = unityRelativeFontPath[(packageCacheIndex + packageCache.Length)..]; + int forwardIndex = unityRelativeFontPath.IndexOf("/", StringComparison.Ordinal); if (0 <= forwardIndex) { - unityRelativeFontPath = unityRelativeFontPath.Substring( - forwardIndex - ); - unityRelativeFontPath = - "Packages/" + PackageId + "/" + unityRelativeFontPath; + unityRelativeFontPath = unityRelativeFontPath.Substring(forwardIndex); + unityRelativeFontPath = "Packages/" + PackageId + "/" + unityRelativeFontPath; } else { @@ -1106,9 +967,7 @@ private static void LoadStyleSheetIfAvailable(VisualElement root) } else { - Debug.LogError( - $"Failed to find DxVisualizer style sheet (package root: '{packageRoot}')." - ); + Debug.LogError($"Failed to find DxVisualizer style sheet (package root: '{packageRoot}')."); } if (styleSheet != null) @@ -1117,9 +976,7 @@ private static void LoadStyleSheetIfAvailable(VisualElement root) } else { - Debug.LogError( - $"Failed to find DxVisualizer style sheet (package root: '{packageRoot}')." - ); + Debug.LogError($"Failed to find DxVisualizer style sheet (package root: '{packageRoot}')."); } if (font != null) @@ -1128,9 +985,7 @@ private static void LoadStyleSheetIfAvailable(VisualElement root) } else { - Debug.LogError( - $"Failed to find DxVisualizer font (package root: '{packageRoot}')." - ); + Debug.LogError($"Failed to find DxVisualizer font (package root: '{packageRoot}')."); } } @@ -1145,10 +1000,7 @@ private static Button FindPopoverPrimaryAction(VisualElement popover) for (int i = 0; i < childCount; ++i) { VisualElement child = popover.ElementAt(i); - if ( - child is Button button - && button.ClassListContains(StyleConstants.PopoverPrimaryActionClass) - ) + if (child is Button button && button.ClassListContains(StyleConstants.PopoverPrimaryActionClass)) { return button; } @@ -1163,13 +1015,7 @@ child is Button button return null; } - private static MatchDetail SearchStringProperties( - object obj, - string searchTerm, - int currentDepth, - int maxDepth, - HashSet visited - ) + private static MatchDetail SearchStringProperties(object obj, string searchTerm, int currentDepth, int maxDepth, HashSet visited) { if (obj == null || maxDepth < currentDepth) { @@ -1199,9 +1045,7 @@ HashSet visited try { - FieldInfo[] fields = objType.GetFields( - BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic - ); + FieldInfo[] fields = objType.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic); foreach (FieldInfo field in fields) { object fieldValue = field.GetValue(obj); @@ -1213,32 +1057,14 @@ HashSet visited if (field.FieldType == typeof(string)) { string stringValue = fieldValue as string; - if ( - !string.IsNullOrWhiteSpace(stringValue) - && stringValue.Contains(searchTerm, StringComparison.OrdinalIgnoreCase) - ) + if (!string.IsNullOrWhiteSpace(stringValue) && stringValue.Contains(searchTerm, StringComparison.OrdinalIgnoreCase)) { - return new MatchDetail(searchTerm) - { - fieldName = field.Name, - matchedValue = stringValue, - }; + return new MatchDetail(searchTerm) { fieldName = field.Name, matchedValue = stringValue }; } } - else if ( - ( - field.FieldType.IsClass - || field.FieldType is { IsValueType: true, IsPrimitive: false } - ) && !typeof(Object).IsAssignableFrom(field.FieldType) - ) - { - MatchDetail nestedMatch = SearchStringProperties( - fieldValue, - searchTerm, - currentDepth + 1, - maxDepth, - visited - ); + else if ((field.FieldType.IsClass || field.FieldType is { IsValueType: true, IsPrimitive: false }) && !typeof(Object).IsAssignableFrom(field.FieldType)) + { + MatchDetail nestedMatch = SearchStringProperties(fieldValue, searchTerm, currentDepth + 1, maxDepth, visited); if (nestedMatch != null) { return nestedMatch; @@ -1270,11 +1096,7 @@ params VisualElement[] contexts label.enableRichText = true; - if ( - string.IsNullOrWhiteSpace(fullText) - || termsToHighlight == null - || termsToHighlight.Count == 0 - ) + if (string.IsNullOrWhiteSpace(fullText) || termsToHighlight == null || termsToHighlight.Count == 0) { label.text = fullText; return label; @@ -1286,19 +1108,11 @@ params VisualElement[] contexts label.text = SearchHighlightUtility.BuildHighlightedRichText(fullText, matches, true); label.RegisterCallback(_ => { - label.text = SearchHighlightUtility.BuildHighlightedRichText( - fullText, - matches, - false - ); + label.text = SearchHighlightUtility.BuildHighlightedRichText(fullText, matches, false); }); label.RegisterCallback(_ => { - label.text = SearchHighlightUtility.BuildHighlightedRichText( - fullText, - matches, - true - ); + label.text = SearchHighlightUtility.BuildHighlightedRichText(fullText, matches, true); }); if (bindToContextHovers) { @@ -1306,19 +1120,11 @@ params VisualElement[] contexts { context.RegisterCallback(_ => { - label.text = SearchHighlightUtility.BuildHighlightedRichText( - fullText, - matches, - false - ); + label.text = SearchHighlightUtility.BuildHighlightedRichText(fullText, matches, false); }); context.RegisterCallback(_ => { - label.text = SearchHighlightUtility.BuildHighlightedRichText( - fullText, - matches, - true - ); + label.text = SearchHighlightUtility.BuildHighlightedRichText(fullText, matches, true); }); } } @@ -1400,17 +1206,9 @@ inert mutation buttons have a visible explanation. Hidden again on resume. _searchField.RegisterCallback( static (_, context) => { - if ( - !string.IsNullOrWhiteSpace(context._searchField.value) - && 0 < context._searchPopover.childCount - && context._activePopover != context._searchPopover - ) + if (!string.IsNullOrWhiteSpace(context._searchField.value) && 0 < context._searchPopover.childCount && context._activePopover != context._searchPopover) { - context.OpenPopover( - context._searchPopover, - context._searchField, - shouldFocus: false - ); + context.OpenPopover(context._searchPopover, context._searchField, shouldFocus: false); } }, this @@ -1418,14 +1216,8 @@ inert mutation buttons have a visible explanation. Hidden again on resume. _searchField.RegisterCallback(HandleSearchKeyDown); headerRow.Add(_searchField); - float initialOuterWidth = Mathf.Max( - EditorPrefs.GetFloat(PrefsSplitterOuterKey, DefaultOuterSplitWidth), - MinNamespacePaneWidth - ); - float initialInnerWidth = Mathf.Max( - EditorPrefs.GetFloat(PrefsSplitterInnerKey, DefaultInnerSplitWidth), - MinObjectPaneWidth - ); + float initialOuterWidth = Mathf.Max(EditorPrefs.GetFloat(PrefsSplitterOuterKey, DefaultOuterSplitWidth), MinNamespacePaneWidth); + float initialInnerWidth = Mathf.Max(EditorPrefs.GetFloat(PrefsSplitterInnerKey, DefaultInnerSplitWidth), MinObjectPaneWidth); _lastSavedOuterWidth = initialOuterWidth; _lastSavedInnerWidth = initialInnerWidth; @@ -1434,27 +1226,11 @@ inert mutation buttons have a visible explanation. Hidden again on resume. _objectColumnElement = CreateObjectColumn(); VisualElement inspectorColumn = CreateInspectorColumn(); - _innerSplitView = new TwoPaneSplitView( - 0, - (int)initialInnerWidth, - TwoPaneSplitViewOrientation.Horizontal - ) - { - name = "inner-split-view", - style = { flexGrow = 1 }, - }; + _innerSplitView = new TwoPaneSplitView(0, (int)initialInnerWidth, TwoPaneSplitViewOrientation.Horizontal) { name = "inner-split-view", style = { flexGrow = 1 } }; _innerSplitView.Add(_objectColumnElement); _innerSplitView.Add(inspectorColumn); - _outerSplitView = new TwoPaneSplitView( - 0, - (int)initialOuterWidth, - TwoPaneSplitViewOrientation.Horizontal - ) - { - name = "outer-split-view", - style = { flexGrow = 1 }, - }; + _outerSplitView = new TwoPaneSplitView(0, (int)initialOuterWidth, TwoPaneSplitViewOrientation.Horizontal) { name = "outer-split-view", style = { flexGrow = 1 } }; _outerSplitView.Add(_namespaceColumnElement); _outerSplitView.Add(_innerSplitView); root.Add(_outerSplitView); @@ -1464,12 +1240,8 @@ inert mutation buttons have a visible explanation. Hidden again on resume. debounced save, and Cleanup flushes a pending save on close/reload. There is no periodic poll. */ - _namespaceColumnElement.RegisterCallback( - HandleSplitterPaneGeometryChanged - ); - _objectColumnElement.RegisterCallback( - HandleSplitterPaneGeometryChanged - ); + _namespaceColumnElement.RegisterCallback(HandleSplitterPaneGeometryChanged); + _objectColumnElement.RegisterCallback(HandleSplitterPaneGeometryChanged); _settingsPopover = CreatePopoverBase("settings-popover"); BuildSettingsPopoverContent(); @@ -1490,9 +1262,7 @@ periodic poll. _typeAddPopover = new VisualElement { name = "type-add-popover" }; _typeAddPopover.AddToClassList("type-add-popover"); - _inspectorLabelSuggestionsPopover = CreatePopoverBase( - "inspector-label-suggestions-popover" - ); + _inspectorLabelSuggestionsPopover = CreatePopoverBase("inspector-label-suggestions-popover"); root.Add(_inspectorLabelSuggestionsPopover); _inspectorLabelSuggestionsPopover.style.width = StyleKeyword.Auto; @@ -1537,19 +1307,9 @@ public void HandlePlayModeStateChanged(PlayModeStateChange state) } } - public void RefreshThemeIfAffected( - string[] importedAssets, - string[] deletedAssets, - string[] movedFromAssetPaths - ) + public void RefreshThemeIfAffected(string[] importedAssets, string[] deletedAssets, string[] movedFromAssetPaths) { - if ( - !_themeSelection.IsAffectedByAssetChanges( - importedAssets, - deletedAssets, - movedFromAssetPaths - ) - ) + if (!_themeSelection.IsAffectedByAssetChanges(importedAssets, deletedAssets, movedFromAssetPaths)) { return; } @@ -1557,10 +1317,7 @@ string[] movedFromAssetPaths ApplyThemeToWindow(GetSelectedTheme()); } - internal void PersistSettings( - Func settingsApplier, - Func userStateApplier - ) + internal void PersistSettings(Func settingsApplier, Func userStateApplier) { DataVisualizerSettings settings = Settings; if (settings.persistStateInSettingsAsset) @@ -1637,8 +1394,7 @@ internal void BuildProcessorColumnView() if (isCollapsed) { _processorToggleCollapseButton.text = StyleConstants.ArrowCollapsed; - _processorHeaderLabel.text = - $"Processors ({_compatibleDataProcessors.Count})"; + _processorHeaderLabel.text = $"Processors ({_compatibleDataProcessors.Count})"; if (_processorArea != null) { _processorArea.style.display = DisplayStyle.None; @@ -1674,11 +1430,7 @@ internal void BuildProcessorColumnView() Label processorButton = new(processorName) { tooltip = processor.Description, - style = - { - backgroundColor = color, - color = IsColorDark(color) ? Color.white : Color.black, - }, + style = { backgroundColor = color, color = IsColorDark(color) ? Color.white : Color.black }, }; processorButton.AddToClassList("processor-button"); processorButton.AddToClassList(StyleConstants.ClickableClass); @@ -1698,12 +1450,7 @@ internal void BuildProcessorColumnView() } } - internal void BuildAndOpenConfirmationPopover( - string message, - string confirmText, - Action onConfirm, - VisualElement triggerElement - ) + internal void BuildAndOpenConfirmationPopover(string message, string confirmText, Action onConfirm, VisualElement triggerElement) { if (_confirmActionPopover == null || onConfirm == null || IsAssetEditingSuspended) { @@ -1711,9 +1458,7 @@ VisualElement triggerElement } VisualElement dragHandle = _confirmActionPopover.Q(className: "popover-drag-handle"); - VisualElement contentWrapper = _confirmActionPopover.Q( - name: $"{_confirmActionPopover.name}-content-wrapper" - ); + VisualElement contentWrapper = _confirmActionPopover.Q(name: $"{_confirmActionPopover.name}-content-wrapper"); if (dragHandle == null || contentWrapper == null) { return; @@ -1723,19 +1468,14 @@ VisualElement triggerElement dragHandle.Clear(); contentWrapper.Clear(); - dragHandle.Add( - new Label("Remove") { style = { unityFontStyleAndWeight = FontStyle.Bold } } - ); + dragHandle.Add(new Label("Remove") { style = { unityFontStyleAndWeight = FontStyle.Bold } }); Button closeButton = new(CloseActivePopover) { text = "X" }; closeButton.AddToClassList("popover-close-button"); closeButton.AddToClassList(StyleConstants.ClickableClass); dragHandle.Add(closeButton); - Label messageLabel = new(message) - { - style = { whiteSpace = WhiteSpace.Normal, marginBottom = 15 }, - }; + Label messageLabel = new(message) { style = { whiteSpace = WhiteSpace.Normal, marginBottom = 15 } }; contentWrapper.Add(messageLabel); VisualElement buttonContainer = new(); @@ -1814,14 +1554,9 @@ an exception log at every editor start. Structs always expose the implicit parameterless constructor (GetConstructor reports it as null), so the check only applies to reference types. */ - if ( - !processorType.IsValueType - && processorType.GetConstructor(Type.EmptyTypes) is null - ) + if (!processorType.IsValueType && processorType.GetConstructor(Type.EmptyTypes) is null) { - Debug.LogWarning( - $"Skipping IDataProcessor '{processorType.FullName}' because it does not expose a public parameterless constructor." - ); + Debug.LogWarning($"Skipping IDataProcessor '{processorType.FullName}' because it does not expose a public parameterless constructor."); continue; } @@ -1834,9 +1569,7 @@ only applies to reference types. } catch (Exception ex) { - Debug.LogError( - $"Failed to create instance of IDataProcessor '{processorType.FullName}': {ex}" - ); + Debug.LogError($"Failed to create instance of IDataProcessor '{processorType.FullName}': {ex}"); } } @@ -1846,10 +1579,7 @@ only applies to reference types. Don't load types here - it blocks the UI from appearing LoadScriptableObjectTypes() is now deferred to CreateGUI */ - rootVisualElement.RegisterCallback( - HandleGlobalKeyDown, - TrickleDown.TrickleDown - ); + rootVisualElement.RegisterCallback(HandleGlobalKeyDown, TrickleDown.TrickleDown); rootVisualElement.RegisterCallback(HandleWindowGeometryChanged); } @@ -1862,24 +1592,15 @@ private void OnDisable() CompletePackageWindowPlacement(); } - rootVisualElement.UnregisterCallback( - HandleGlobalKeyDown, - TrickleDown.TrickleDown - ); + rootVisualElement.UnregisterCallback(HandleGlobalKeyDown, TrickleDown.TrickleDown); rootVisualElement.UnregisterCallback(HandleWindowGeometryChanged); Cleanup(); } private void RestoreWindowMinimumSizeFromPersistedClamp() { - bool hasPersistedClamp = TryReadWindowSize( - PrefsTemporaryWindowClampSizeKey, - out Vector2 clampedSize - ); - bool temporaryClampIsActive = - !docked - && hasPersistedClamp - && MonitorUtility.IsSameSize(position.size, clampedSize); + bool hasPersistedClamp = TryReadWindowSize(PrefsTemporaryWindowClampSizeKey, out Vector2 clampedSize); + bool temporaryClampIsActive = !docked && hasPersistedClamp && MonitorUtility.IsSameSize(position.size, clampedSize); _temporaryClampedWindowSize = temporaryClampIsActive ? clampedSize : default; ApplyWindowMinimumSize(temporaryClampIsActive); @@ -1887,25 +1608,13 @@ out Vector2 clampedSize private void ApplyWindowMinimumSize(bool temporaryClampIsActive) { - minSize = MonitorUtility.CalculateWindowMinimumSize( - new Vector2(MinWindowWidth, MinWindowHeight), - _temporaryClampedWindowSize, - temporaryClampIsActive - ); + minSize = MonitorUtility.CalculateWindowMinimumSize(new Vector2(MinWindowWidth, MinWindowHeight), _temporaryClampedWindowSize, temporaryClampIsActive); } private Vector2 ReadPreferredWindowSize() { - bool hasSavedSize = TryReadWindowSize( - PrefsPreferredWindowSizeKey, - out Vector2 savedSize - ); - return MonitorUtility.SelectPreferredSize( - savedSize, - hasSavedSize, - position.size, - new Vector2(MinWindowWidth, MinWindowHeight) - ); + bool hasSavedSize = TryReadWindowSize(PrefsPreferredWindowSizeKey, out Vector2 savedSize); + return MonitorUtility.SelectPreferredSize(savedSize, hasSavedSize, position.size, new Vector2(MinWindowWidth, MinWindowHeight)); } private void BeginPackageWindowPlacement(Vector2 requestedSize, Vector2 preferredSize) @@ -1929,10 +1638,7 @@ private void CompletePackageWindowPlacement() _packagePlacementPending = false; _hasObservedInitialWindowGeometry = true; _temporaryClampedWindowSize = position.size; - bool temporaryClampIsActive = !MonitorUtility.IsSameSize( - _temporaryClampedWindowSize, - _pendingPackagePreferredSize - ); + bool temporaryClampIsActive = !MonitorUtility.IsSameSize(_temporaryClampedWindowSize, _pendingPackagePreferredSize); _pendingPackagePreferredSize = default; if (temporaryClampIsActive) { @@ -1949,9 +1655,7 @@ private void CompletePackageWindowPlacement() private void SchedulePackageWindowPlacementCompletion() { _packagePlacementCompletionTask?.Pause(); - _packagePlacementCompletionTask = rootVisualElement.schedule.Execute( - CompletePackageWindowPlacement - ); + _packagePlacementCompletionTask = rootVisualElement.schedule.Execute(CompletePackageWindowPlacement); _packagePlacementCompletionTask.ExecuteLater(1); } @@ -1969,42 +1673,26 @@ private void HandleWindowGeometryChanged(GeometryChangedEvent _) return; } - if ( - MonitorUtility.IsSameSize(position.size, _temporaryClampedWindowSize) - && EditorPrefs.HasKey(PrefsTemporaryWindowClampSizeKey) - ) + if (MonitorUtility.IsSameSize(position.size, _temporaryClampedWindowSize) && EditorPrefs.HasKey(PrefsTemporaryWindowClampSizeKey)) { _hasObservedInitialWindowGeometry = true; ApplyWindowMinimumSize(true); return; } - bool shouldCapturePreferredSize = MonitorUtility.ShouldCapturePreferredSize( - _packagePlacementPending, - _hasObservedInitialWindowGeometry, - docked - ); + bool shouldCapturePreferredSize = MonitorUtility.ShouldCapturePreferredSize(_packagePlacementPending, _hasObservedInitialWindowGeometry, docked); _hasObservedInitialWindowGeometry = true; if (shouldCapturePreferredSize) { - Vector2 preferredSize = MonitorUtility.NormalizePreferredSize( - position.size, - new Vector2(MinWindowWidth, MinWindowHeight) - ); + Vector2 preferredSize = MonitorUtility.NormalizePreferredSize(position.size, new Vector2(MinWindowWidth, MinWindowHeight)); WriteWindowSize(PrefsPreferredWindowSizeKey, preferredSize); ClearTemporaryWindowSizeClamp(); ApplyWindowMinimumSize(false); return; } - bool hasPersistedClamp = TryReadWindowSize( - PrefsTemporaryWindowClampSizeKey, - out Vector2 persistedClampedSize - ); - bool persistedClampIsActive = - !docked - && hasPersistedClamp - && MonitorUtility.IsSameSize(position.size, persistedClampedSize); + bool hasPersistedClamp = TryReadWindowSize(PrefsTemporaryWindowClampSizeKey, out Vector2 persistedClampedSize); + bool persistedClampIsActive = !docked && hasPersistedClamp && MonitorUtility.IsSameSize(position.size, persistedClampedSize); _temporaryClampedWindowSize = persistedClampIsActive ? persistedClampedSize : default; if (!persistedClampIsActive) { @@ -2066,12 +1754,8 @@ no EnteredEditMode callback will unsuspend it. Resetting keeps the shared index CloseActivePopover(); CancelDrag(); _themeSelection.Apply(null, null); - _namespaceColumnElement?.UnregisterCallback( - HandleSplitterPaneGeometryChanged - ); - _objectColumnElement?.UnregisterCallback( - HandleSplitterPaneGeometryChanged - ); + _namespaceColumnElement?.UnregisterCallback(HandleSplitterPaneGeometryChanged); + _objectColumnElement?.UnregisterCallback(HandleSplitterPaneGeometryChanged); if (!Settings.persistStateInSettingsAsset && _userStateDirty) { SaveUserStateToFile(); @@ -2120,9 +1804,7 @@ private void PopulateSearchCacheAsync() if (EnableAsyncLoadDebugLog) { - Debug.Log( - $"[DataVisualizer] PopulateSearchCacheAsync START at {System.DateTime.Now:HH:mm:ss.fff}" - ); + Debug.Log($"[DataVisualizer] PopulateSearchCacheAsync START at {System.DateTime.Now:HH:mm:ss.fff}"); } HashSet uniqueGuids = new(StringComparer.OrdinalIgnoreCase); @@ -2240,9 +1922,7 @@ so no per-batch de-duplication is needed here. // Continue with next batch if (0 < _pendingSearchCacheGuids.Count) { - _searchCacheLoadTask = rootVisualElement.schedule.Execute(() => - ContinuePopulatingSearchCache(generation) - ); + _searchCacheLoadTask = rootVisualElement.schedule.Execute(() => ContinuePopulatingSearchCache(generation)); _searchCacheLoadTask.ExecuteLater(10); } else @@ -2253,13 +1933,7 @@ so no per-batch de-duplication is needed here. static (a, b) => { int nameComp = string.Compare(a.name, b.name, StringComparison.Ordinal); - return nameComp != 0 - ? nameComp - : string.Compare( - a.GetType().FullName, - b.GetType().FullName, - StringComparison.Ordinal - ); + return nameComp != 0 ? nameComp : string.Compare(a.GetType().FullName, b.GetType().FullName, StringComparison.Ordinal); } ); _isSearchCachePopulated = true; @@ -2322,25 +1996,17 @@ private void ResumeAfterPlayMode() _suspendedForPlayMode = false; AssetGuidTypeIndex.Shared.Resume(); SetPackageEditingPaused(false); - if ( - _isLoadingObjectsAsync - && _asyncLoadTargetType != null - && 0 < _pendingObjectGuids.Count - ) + if (_isLoadingObjectsAsync && _asyncLoadTargetType != null && 0 < _pendingObjectGuids.Count) { _asyncLoadTask?.Pause(); - _asyncLoadTask = rootVisualElement.schedule.Execute(() => - ContinueLoadingObjects(_asyncLoadTargetType, _asyncLoadGeneration) - ); + _asyncLoadTask = rootVisualElement.schedule.Execute(() => ContinueLoadingObjects(_asyncLoadTargetType, _asyncLoadGeneration)); _asyncLoadTask.ExecuteLater(10); } if (_isLoadingSearchCacheAsync && 0 < _pendingSearchCacheGuids.Count) { _searchCacheLoadTask?.Pause(); - _searchCacheLoadTask = rootVisualElement.schedule.Execute(() => - ContinuePopulatingSearchCache(_searchCacheGeneration) - ); + _searchCacheLoadTask = rootVisualElement.schedule.Execute(() => ContinuePopulatingSearchCache(_searchCacheGeneration)); _searchCacheLoadTask.ExecuteLater(10); } @@ -2391,9 +2057,7 @@ private void LoadInitialContent() { if (EnableAsyncLoadDebugLog) { - Debug.Log( - $"[DataVisualizer] Initial content load - loading types and building views at {System.DateTime.Now:HH:mm:ss.fff}" - ); + Debug.Log($"[DataVisualizer] Initial content load - loading types and building views at {System.DateTime.Now:HH:mm:ss.fff}"); } // Load types (fast now without CreateInstance) @@ -2411,9 +2075,7 @@ private void LoadInitialContent() { if (EnableAsyncLoadDebugLog) { - Debug.Log( - $"[DataVisualizer] Initial content load - starting async initialization at {System.DateTime.Now:HH:mm:ss.fff}" - ); + Debug.Log($"[DataVisualizer] Initial content load - starting async initialization at {System.DateTime.Now:HH:mm:ss.fff}"); } // Start async search cache population in background (low priority) PopulateSearchCacheAsync(); @@ -2458,9 +2120,7 @@ private void SyncNamespaceAndTypeOrders() typeNames.Add(type.FullName); } - typeOrder.Add( - new NamespaceTypeOrder { namespaceKey = namespaceKey, typeNames = typeNames } - ); + typeOrder.Add(new NamespaceTypeOrder { namespaceKey = namespaceKey, typeNames = typeNames }); } PersistSettings( @@ -2493,10 +2153,7 @@ resume refresh or deferred initial load covers it. Type selectedType = _namespaceController.SelectedType; - string previousNamespaceKey = - selectedType != null - ? NamespaceController.GetNamespaceKey(selectedType) - : string.Empty; + string previousNamespaceKey = selectedType != null ? NamespaceController.GetNamespaceKey(selectedType) : string.Empty; string previousTypeFullName = selectedType?.FullName; string previousObjectGuid = null; if (_selectedObject != null) @@ -2510,12 +2167,7 @@ resume refresh or deferred initial load covers it. LoadScriptableObjectTypes(); - selectedType = ResolveSelectedTypeByFullName( - _scriptableObjectTypes, - _namespaceOrder, - previousNamespaceKey, - previousTypeFullName - ); + selectedType = ResolveSelectedTypeByFullName(_scriptableObjectTypes, _namespaceOrder, previousNamespaceKey, previousTypeFullName); /* Load once. For an unchanged type the SelectType call near the end no-ops its own load, @@ -2544,11 +2196,7 @@ column doesn't show the previous type's assets until that async load's view rebu } ScriptableObject selectedObject = _selectedObject; - if ( - selectedType != null - && !string.IsNullOrWhiteSpace(previousObjectGuid) - && 0 < _selectedObjects.Count - ) + if (selectedType != null && !string.IsNullOrWhiteSpace(previousObjectGuid) && 0 < _selectedObjects.Count) { selectedObject = _selectedObjects.Find(obj => { @@ -2559,12 +2207,7 @@ column doesn't show the previous type's assets until that async load's view rebu string path = AssetDatabase.GetAssetPath(obj); - return !string.IsNullOrWhiteSpace(path) - && string.Equals( - AssetDatabase.AssetPathToGUID(path), - previousObjectGuid, - StringComparison.OrdinalIgnoreCase - ); + return !string.IsNullOrWhiteSpace(path) && string.Equals(AssetDatabase.AssetPathToGUID(path), previousObjectGuid, StringComparison.OrdinalIgnoreCase); }); } @@ -2610,15 +2253,9 @@ private void ExpandNamespaceGroupIfNeeded(VisualElement namespaceGroupItem, bool Label indicator = namespaceGroupItem.Q