Skip to content

Commit 65e0f18

Browse files
committed
Add magic value formatting for booleans
1 parent 6986cf4 commit 65e0f18

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,21 @@ private static string GetValueStringAndType(object value, bool isExpandable, out
168168
}
169169

170170
Type objType = value.GetType();
171-
typeName = $"[{objType.FullName}]";
171+
172+
// This is the type format PowerShell users expect and will appear when you hover a variable name
173+
typeName = '[' + value.GetType().FullName + ']';
172174

173175
if (value is bool)
174176
{
175177
// Set to identifier recognized by PowerShell to make setVariable from the debug UI more natural.
176178
valueString = (bool) value ? "$true" : "$false";
179+
180+
// We need to use this "magic value" to highlight in vscode properly
181+
// These "magic values" are analagous to TypeScript and are visible in VSCode here:
182+
// https://github.com/microsoft/vscode/blob/57ca9b99d5b6a59f2d2e0f082ae186559f45f1d8/src/vs/workbench/contrib/debug/browser/baseDebugView.ts#L68-L78
183+
// numbers and strings so far seem to get detected properly be serialization and the original .NET type
184+
// is preserved
185+
typeName = "boolean";
177186
}
178187
else if (isExpandable)
179188
{

0 commit comments

Comments
 (0)