diff --git a/Editor/Scripts/AbstractTreeView.cs b/Editor/Scripts/AbstractTreeView.cs index cec199a..242a581 100644 --- a/Editor/Scripts/AbstractTreeView.cs +++ b/Editor/Scripts/AbstractTreeView.cs @@ -243,7 +243,12 @@ protected override bool DoesItemMatchSearch(TreeViewItem item, string search) if (i != null) { int searchCount; - i.GetItemSearchString(m_SearchCache, out searchCount); + string type; + string label; + i.GetItemSearchString(m_SearchCache, out searchCount, out type, out label); + + if (!m_Search.IsTypeMatch(type) || !m_Search.IsLabelMatch(label)) + return false; m_SearchBuilder.Length = 0; for (var n=0; n < searchCount; ++n) @@ -253,10 +258,7 @@ protected override bool DoesItemMatchSearch(TreeViewItem item, string search) } m_SearchBuilder.Append("\0"); - if (m_Search.IsNameMatch(m_SearchBuilder.ToString())) - return true; - - return false; + return m_Search.IsNameMatch(m_SearchBuilder.ToString()); } return base.DoesItemMatchSearch(item, search); @@ -388,9 +390,11 @@ public abstract class AbstractTreeViewItem : TreeViewItem public bool enabled = true; public bool isExpanded; - public virtual void GetItemSearchString(string[] target, out int count) + public virtual void GetItemSearchString(string[] target, out int count, out string type, out string label) { count = 0; + type = null; + label = null; } public abstract void OnGUI(Rect position, int column); diff --git a/Editor/Scripts/CompareSnapshotsView/CompareSnapshotsControl.cs b/Editor/Scripts/CompareSnapshotsView/CompareSnapshotsControl.cs index 2983bee..6860fe6 100644 --- a/Editor/Scripts/CompareSnapshotsView/CompareSnapshotsControl.cs +++ b/Editor/Scripts/CompareSnapshotsView/CompareSnapshotsControl.cs @@ -322,10 +322,12 @@ public void Swap() count[1] = c; } - public override void GetItemSearchString(string[] target, out int count) + public override void GetItemSearchString(string[] target, out int count, out string type, out string label) { - count = 0; - target[count++] = displayName ?? k_UnknownTypeString; + base.GetItemSearchString(target, out count, out type, out label); + + type = displayName ?? k_UnknownTypeString; + target[count++] = type; } public override void OnGUI(Rect position, int column) diff --git a/Editor/Scripts/ConnectionsView/ConnectionsControl.cs b/Editor/Scripts/ConnectionsView/ConnectionsControl.cs index ff13c90..ab16dd5 100644 --- a/Editor/Scripts/ConnectionsView/ConnectionsControl.cs +++ b/Editor/Scripts/ConnectionsView/ConnectionsControl.cs @@ -305,9 +305,11 @@ class Item : AbstractTreeViewItem protected string m_Value = ""; protected string m_Tooltip = ""; - public override void GetItemSearchString(string[] target, out int count) + public override void GetItemSearchString(string[] target, out int count, out string type, out string label) { - count = 0; + base.GetItemSearchString(target, out count, out type, out label); + + type = displayName; target[count++] = displayName; target[count++] = m_Value; target[count++] = string.Format(StringFormat.Address, address); diff --git a/Editor/Scripts/GCHandlesView/GCHandlesControl.cs b/Editor/Scripts/GCHandlesView/GCHandlesControl.cs index 31db3a6..306f9de 100644 --- a/Editor/Scripts/GCHandlesView/GCHandlesControl.cs +++ b/Editor/Scripts/GCHandlesView/GCHandlesControl.cs @@ -261,9 +261,11 @@ public void Initialize(GCHandlesControl owner, PackedMemorySnapshot snapshot, in m_GCHandle = new RichGCHandle(snapshot, gcHandlesArrayIndex); } - public override void GetItemSearchString(string[] target, out int count) + public override void GetItemSearchString(string[] target, out int count, out string type, out string label) { - count = 0; + base.GetItemSearchString(target, out count, out type, out label); + + type = typeName; target[count++] = typeName; target[count++] = string.Format(StringFormat.Address, address); } diff --git a/Editor/Scripts/ManagedHeapSectionsView/ManagedHeapSectionsControl.cs b/Editor/Scripts/ManagedHeapSectionsView/ManagedHeapSectionsControl.cs index a55a9b8..8dbc291 100644 --- a/Editor/Scripts/ManagedHeapSectionsView/ManagedHeapSectionsControl.cs +++ b/Editor/Scripts/ManagedHeapSectionsView/ManagedHeapSectionsControl.cs @@ -148,9 +148,10 @@ class AbstractItem : AbstractTreeViewItem #endif protected ManagedHeapSectionsControl m_Owner; - public override void GetItemSearchString(string[] target, out int count) + public override void GetItemSearchString(string[] target, out int count, out string type, out string label) { - count = 0; + base.GetItemSearchString(target, out count, out type, out label); + target[count++] = displayName; target[count++] = string.Format(StringFormat.Address, address); } diff --git a/Editor/Scripts/ManagedObjectsView/ManagedObjectsControl.cs b/Editor/Scripts/ManagedObjectsView/ManagedObjectsControl.cs index c33abc2..1044efb 100644 --- a/Editor/Scripts/ManagedObjectsView/ManagedObjectsControl.cs +++ b/Editor/Scripts/ManagedObjectsView/ManagedObjectsControl.cs @@ -347,13 +347,16 @@ public void Initialize(AbstractManagedObjectsControl owner, PackedMemorySnapshot m_Object = new RichManagedObject(snapshot, managedObject.managedObjectsArrayIndex); } - public override void GetItemSearchString(string[] target, out int count) + public override void GetItemSearchString(string[] target, out int count, out string type, out string label) { - count = 0; + base.GetItemSearchString(target, out count, out type, out label); + + type = typeName; target[count++] = typeName; target[count++] = string.Format(StringFormat.Address, m_Object.address); target[count++] = cppName; target[count++] = assembly; + } public override void OnGUI(Rect position, int column) diff --git a/Editor/Scripts/ManagedTypesView/ManagedTypesControl.cs b/Editor/Scripts/ManagedTypesView/ManagedTypesControl.cs index b53d5d2..b701881 100644 --- a/Editor/Scripts/ManagedTypesView/ManagedTypesControl.cs +++ b/Editor/Scripts/ManagedTypesView/ManagedTypesControl.cs @@ -235,9 +235,11 @@ public void Initialize(ManagedTypesControl owner, PackedMemorySnapshot snapshot, m_Type = new RichManagedType(snapshot, arrayIndex); } - public override void GetItemSearchString(string[] target, out int count) + public override void GetItemSearchString(string[] target, out int count, out string type, out string label) { - count = 0; + base.GetItemSearchString(target, out count, out type, out label); + + type = typeName; target[count++] = typeName; } diff --git a/Editor/Scripts/NativeObjectsView/NativeObjectsControl.cs b/Editor/Scripts/NativeObjectsView/NativeObjectsControl.cs index 7bbf714..75b4de9 100644 --- a/Editor/Scripts/NativeObjectsView/NativeObjectsControl.cs +++ b/Editor/Scripts/NativeObjectsView/NativeObjectsControl.cs @@ -537,9 +537,11 @@ public void Initialize(NativeObjectsControl owner, PackedNativeUnityEngineObject #endif } - public override void GetItemSearchString(string[] target, out int count) + public override void GetItemSearchString(string[] target, out int count, out string type, out string label) { - count = 0; + base.GetItemSearchString(target, out count, out type, out label); + + type = m_Object.type.name; target[count++] = m_Object.name; target[count++] = m_Object.type.name; target[count++] = string.Format(StringFormat.Address, address); diff --git a/Editor/Scripts/RootPathView/RootPathControl.cs b/Editor/Scripts/RootPathView/RootPathControl.cs index 0ce4b77..8db3eb7 100644 --- a/Editor/Scripts/RootPathView/RootPathControl.cs +++ b/Editor/Scripts/RootPathView/RootPathControl.cs @@ -607,9 +607,11 @@ class Item : AbstractTreeViewItem protected string m_Value; protected System.UInt64 m_Address; - public override void GetItemSearchString(string[] target, out int count) + public override void GetItemSearchString(string[] target, out int count, out string type, out string label) { - count = 0; + base.GetItemSearchString(target, out count, out type, out label); + + type = displayName; target[count++] = displayName; target[count++] = m_Value; target[count++] = string.Format(StringFormat.Address, m_Address); diff --git a/Editor/Scripts/SearchTextParser.cs b/Editor/Scripts/SearchTextParser.cs index a1f36bb..9540913 100644 --- a/Editor/Scripts/SearchTextParser.cs +++ b/Editor/Scripts/SearchTextParser.cs @@ -35,6 +35,28 @@ public class Result public List types = new List(); public List labels = new List(); + public bool IsTypeMatch(string type) + { + if (types.Count == 0) + return true; // no type filter, always pass + + if (string.IsNullOrWhiteSpace(type)) + return false; + + return types.Contains(type); + } + + public bool IsLabelMatch(string label) + { + if (labels.Count == 0) + return true; // no label filter, always pass + + if (string.IsNullOrWhiteSpace(label)) + return false; + + return labels.Contains(label); + } + public bool IsNameMatch(string text) { if (m_NamesExpr.Count == 0) diff --git a/Editor/Scripts/StaticFieldsView/StaticFieldsControl.cs b/Editor/Scripts/StaticFieldsView/StaticFieldsControl.cs index 645d7ab..8c8ca9c 100644 --- a/Editor/Scripts/StaticFieldsView/StaticFieldsControl.cs +++ b/Editor/Scripts/StaticFieldsView/StaticFieldsControl.cs @@ -211,9 +211,11 @@ public void Initialize(StaticFieldsControl owner, PackedMemorySnapshot snapshot, m_TypeDescription = typeDescription; } - public override void GetItemSearchString(string[] target, out int count) + public override void GetItemSearchString(string[] target, out int count, out string type, out string label) { - count = 0; + base.GetItemSearchString(target, out count, out type, out label); + + type = typeName; target[count++] = typeName; target[count++] = assemblyName; }