Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Display IEnumerables and IDictionaries in debugger prettily (with "Raw View" available) #1634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
andyleejordan merged 14 commits into master from JustinGrote/issue1633
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
0edeed4
Feature: Add "Raw View" to IEnumerables and IDictionaries
JustinGrote Nov 23, 2021
1447e94
Update src/PowerShellEditorServices/Services/DebugAdapter/Debugging/V...
JustinGrote Nov 24, 2021
f9612ce
Update src/PowerShellEditorServices/Services/DebugAdapter/Debugging/V...
JustinGrote Nov 24, 2021
2f8fee8
Update src/PowerShellEditorServices/Services/DebugAdapter/Debugging/V...
JustinGrote Nov 24, 2021
7824c51
Update src/PowerShellEditorServices/Services/DebugAdapter/Debugging/V...
JustinGrote Nov 24, 2021
cfda423
Change VariableObject to property from field since it is now derived
JustinGrote Nov 24, 2021
a92d9d7
Implement Suggestion https://github.com/PowerShell/PowerShellEditorSe...
JustinGrote Nov 24, 2021
7df4dd5
🧪 Initial Test Attempt
JustinGrote Jan 23, 2022
049cb97
fixup! 🧪 Initial Test Attempt
JustinGrote Jan 24, 2022
0a99905
fixup! 🧪 Initial Test Attempt
JustinGrote Jan 24, 2022
37518cb
Simplify Raw View Presentation and more tests
JustinGrote Jan 24, 2022
ee20562
Add Dictionary Test and Consolidate VariableTest File
JustinGrote Jan 24, 2022
7e02666
Add Derived Dictionary Test
JustinGrote Jan 24, 2022
719ad9a
Simplify tests and cleanup
andyleejordan Jan 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Dictionary Test and Consolidate VariableTest File
  • Loading branch information
JustinGrote committed Jan 24, 2022
commit ee205627efbcfd926ab260827af5efe69e2500fc
View file Open in desktop

This file was deleted.

View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,22 @@ function Test-Variables {
Test-Variables
# NOTE: If a line is added to the function above, the line numbers in the
# associated unit tests MUST be adjusted accordingly.

$SCRIPT:simpleDictionary = @{
item1 = 1
item2 = 2
item3 = 'red'
item4 = 'blue'
}
#This is a dummy function that the test will use to stop and evaluate the debug environment
function __BreakDebuggerEnumerableShowsRawView{}; __BreakDebuggerEnumerableShowsRawView

$SCRIPT:simpleArray = @(
1
2
'red'
'blue'
)

# This is a dummy function that the test will use to stop and evaluate the debug environment
function __BreakDebuggerDictionaryShowsRawView{}; __BreakDebuggerDictionaryShowsRawView
51 changes: 49 additions & 2 deletions test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,6 @@ await debugService.SetLineBreakpointsAsync(
[Fact]
public async Task DebuggerEnumerableShowsRawView()
{
var variableEnumerableScriptFile = GetDebugScript("VariableEnumerableTest.ps1");
CommandBreakpointDetails breakpoint = CommandBreakpointDetails.Create(
name: "__BreakDebuggerEnumerableShowsRawView"
);
Expand All @@ -809,7 +808,7 @@ await debugService.SetCommandBreakpointsAsync(
).ConfigureAwait(true);

// Execute the script and wait for the breakpoint to be hit
_ = ExecutePowerShellCommand(variableEnumerableScriptFile.FilePath);
Task _ = ExecuteVariableScriptFile();
AssertDebuggerStoppedCommand(breakpoint);

StackFrameDetails[] stackFrames = await debugService.GetStackFramesAsync().ConfigureAwait(true);
Expand Down Expand Up @@ -847,6 +846,54 @@ await debugService.SetCommandBreakpointsAsync(
Assert.Equal("$false", rawViewChildren[6].ValueString);
}

[Fact]
public async Task DebuggerDictionaryShowsRawView()
{
CommandBreakpointDetails breakpoint = CommandBreakpointDetails.Create(
name: "__BreakDebuggerDictionaryShowsRawView"
);
await debugService.SetCommandBreakpointsAsync(
new[] { breakpoint }
).ConfigureAwait(true);

// Execute the script and wait for the breakpoint to be hit
Task _ = ExecuteVariableScriptFile();
AssertDebuggerStoppedCommand(breakpoint);

StackFrameDetails[] stackFrames = await debugService.GetStackFramesAsync().ConfigureAwait(true);
VariableScope scriptScope = Array.Find(
debugService.GetVariableScopes(0),
scope => scope.Name == "Script"
);
Assert.NotNull(scriptScope);
VariableDetailsBase simpleDictionaryVariable = Array.Find(
debugService.GetVariables(scriptScope.Id),
variable => variable.Name == "$simpleDictionary"
);
Assert.NotNull(simpleDictionaryVariable);
VariableDetailsBase rawDetailsView = Array.Find(
simpleDictionaryVariable.GetChildren(NullLogger.Instance),
variable => variable.Name == "Raw View"
);
Assert.NotNull(rawDetailsView);
Assert.Empty(rawDetailsView.Type);
Assert.Empty(rawDetailsView.ValueString);
VariableDetailsBase[] rawViewChildren = rawDetailsView.GetChildren(NullLogger.Instance);
Assert.Equal(7, rawViewChildren.Length);
Assert.Equal("IsReadOnly", rawViewChildren[0].Name);
Assert.Equal("$false", rawViewChildren[0].ValueString);
Assert.Equal("IsFixedSize", rawViewChildren[1].Name);
Assert.Equal("$false", rawViewChildren[1].ValueString);
Assert.Equal("IsSynchronized", rawViewChildren[2].Name);
Assert.Equal("$false", rawViewChildren[2].ValueString);
Assert.Equal("Keys", rawViewChildren[3].Name);
Assert.Equal("Values", rawViewChildren[4].Name);
Assert.Equal("[ValueCollection: 4]", rawViewChildren[4].ValueString);
Assert.Equal("SyncRoot", rawViewChildren[5].Name);
Assert.Equal("Count", rawViewChildren[6].Name);
Assert.Equal("4", rawViewChildren[6].ValueString);
}

[Fact]
public async Task DebuggerVariablePSCustomObjectDisplaysCorrectly()
{
Expand Down

AltStyle によって変換されたページ (->オリジナル) /