Skip to content

Commit cfda423

Browse files
committed
Change VariableObject to property from field since it is now derived
1 parent 7824c51 commit cfda423

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/PowerShellEditorServices/Services/DebugAdapter/Debugging/VariableDetails.cs

+7-8
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ internal class VariableDetails : VariableDetailsBase
2626
/// Provides a constant for the dollar sign variable prefix string.
2727
/// </summary>
2828
public const string DollarPrefix = "$";
29-
30-
protected object valueObject;
29+
protected object ValueObject { get; }
3130
private VariableDetails[] cachedChildren;
3231

3332
#endregion
@@ -81,7 +80,7 @@ public VariableDetails(PSPropertyInfo psProperty)
8180
/// <param name="value">The variable's value.</param>
8281
public VariableDetails(string name, object value)
8382
{
84-
this.valueObject = value;
83+
this.ValueObject = value;
8584

8685
this.Id = -1; // Not been assigned a variable reference id yet
8786
this.Name = name;
@@ -109,7 +108,7 @@ public override VariableDetailsBase[] GetChildren(ILogger logger)
109108
{
110109
if (this.cachedChildren == null)
111110
{
112-
this.cachedChildren = GetChildren(this.valueObject, logger);
111+
this.cachedChildren = GetChildren(this.ValueObject, logger);
113112
}
114113

115114
return this.cachedChildren;
@@ -175,13 +174,13 @@ private static string GetValueStringAndType(object value, bool isExpandable, out
175174
if (value is bool)
176175
{
177176
// Set to identifier recognized by PowerShell to make setVariable from the debug UI more natural.
178-
valueString = (bool) value ? "$true" : "$false";
177+
valueString = (bool)value ? "$true" : "$false";
179178

180179
// We need to use this "magic value" to highlight in vscode properly
181180
// These "magic values" are analagous to TypeScript and are visible in VSCode here:
182181
// https://github.com/microsoft/vscode/blob/57ca9b99d5b6a59f2d2e0f082ae186559f45f1d8/src/vs/workbench/contrib/debug/browser/baseDebugView.ts#L68-L78
183-
// NOTE: we don't do numbers and strings since they (so far) seem to get detected properly by
184-
//serialization, and the original .NET type can be preserved so it shows up in the variable name
182+
// NOTE: we don't do numbers and strings since they (so far) seem to get detected properly by
183+
//serialization, and the original .NET type can be preserved so it shows up in the variable name
185184
//type hover as the original .NET type.
186185
typeName = "boolean";
187186
}
@@ -452,7 +451,7 @@ public VariableDetailsRawView(object value) : base(RawViewName, value)
452451
public override VariableDetailsBase[] GetChildren(ILogger logger)
453452
{
454453
List<VariableDetails> childVariables = new();
455-
AddDotNetProperties(valueObject, childVariables, noRawView: true);
454+
AddDotNetProperties(ValueObject, childVariables, noRawView: true);
456455
return childVariables.ToArray();
457456
}
458457
}

0 commit comments

Comments
 (0)