diff --git a/src/StructuredLogViewer/themes/Generic.xaml b/src/StructuredLogViewer/themes/Generic.xaml index 311347d9..d97d8add 100644 --- a/src/StructuredLogViewer/themes/Generic.xaml +++ b/src/StructuredLogViewer/themes/Generic.xaml @@ -439,6 +439,28 @@ + + + + + + + + + + + + + + @@ -571,11 +593,26 @@ + + + + + + + + + + + + + + + diff --git a/src/StructuredLogger/Construction/MessageProcessor.cs b/src/StructuredLogger/Construction/MessageProcessor.cs index da32fb96..9932d1dd 100644 --- a/src/StructuredLogger/Construction/MessageProcessor.cs +++ b/src/StructuredLogger/Construction/MessageProcessor.cs @@ -198,11 +198,9 @@ private void ProcessTaskParameter(TaskParameterEventArgs args) parent = task.GetOrCreateNodeWithName(folderName); parent.DisableChildrenCache = true; - string itemName = isOutput && parameterName is not null - ? $"{propertyName ?? itemType} from parameter {parameterName}" - : propertyName ?? itemType; + string itemName = propertyName ?? itemType; - node = CreateParameterNode(itemName, items, isOutput); + node = CreateParameterNode(itemName, items, isOutput, parameterName); } else if ( kind == TaskParameterMessageKind.AddItem || @@ -254,26 +252,53 @@ private void ProcessTaskParameter(TaskParameterEventArgs args) } } - private BaseNode CreateParameterNode(string itemName, IEnumerable items, bool isOutput = false) + private BaseNode CreateParameterNode(string itemName, IEnumerable items, bool isOutput = false, string parameterName = null) { if (items is IList list && list.Count == 1 && list[0] is ITaskItem scalar && scalar.MetadataCount == 0) { - var property = new Property + BaseNode property; + if (parameterName != null && parameterName != itemName) { - Name = itemName, - Value = scalar.ItemSpec - }; + property = new TaskParameterProperty + { + Name = itemName, + Value = scalar.ItemSpec, + ParameterName = parameterName + }; + } + else + { + property = new Property + { + Name = itemName, + Value = scalar.ItemSpec + }; + } + return property; } TreeNode parent; if (isOutput) { - parent = new AddItem { Name = itemName }; + if (!string.IsNullOrEmpty(parameterName) && parameterName != itemName) + { + parent = new TaskParameterItem { Name = itemName, ParameterName = parameterName }; + } + else + { + parent = new AddItem { Name = itemName }; + } } else { - parent = new Parameter { Name = itemName }; + // no need to display the same string twice + if (parameterName == itemName) + { + parameterName = null; + } + + parent = new Parameter { Name = itemName, ParameterName = parameterName }; parent.DisableChildrenCache = true; } diff --git a/src/StructuredLogger/ObjectModel/AddItem.cs b/src/StructuredLogger/ObjectModel/AddItem.cs index 199b9b24..da874aee 100644 --- a/src/StructuredLogger/ObjectModel/AddItem.cs +++ b/src/StructuredLogger/ObjectModel/AddItem.cs @@ -11,4 +11,9 @@ public AddItem() public int? LineNumber { get; set; } } + + public class TaskParameterItem : AddItem + { + public string ParameterName { get; set; } + } } diff --git a/src/StructuredLogger/ObjectModel/Parameter.cs b/src/StructuredLogger/ObjectModel/Parameter.cs index b99c16a5..b4fb6b6d 100644 --- a/src/StructuredLogger/ObjectModel/Parameter.cs +++ b/src/StructuredLogger/ObjectModel/Parameter.cs @@ -3,5 +3,7 @@ public class Parameter : NamedNode { public override string TypeName => nameof(Parameter); + + public string ParameterName { get; set; } } } diff --git a/src/StructuredLogger/ObjectModel/Property.cs b/src/StructuredLogger/ObjectModel/Property.cs index 03c1601e..2fe31752 100644 --- a/src/StructuredLogger/ObjectModel/Property.cs +++ b/src/StructuredLogger/ObjectModel/Property.cs @@ -4,4 +4,9 @@ public class Property : NameValueNode { public override string TypeName => nameof(Property); } + + public class TaskParameterProperty : Property + { + public string ParameterName { get; set; } + } }