Skip to content
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

Fix variable's 'add to watch' feature. #504

Merged
merged 2 commits into from
Jun 10, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ public class Variable
// /** The variable's value. For structured objects this can be a multi line text, e.g. for a function the body of a function. */
public string Value { get; set; }

/// <summary>
/// Gets or sets the evaluatable name for the variable that will be evaluated by the debugger.
/// </summary>
public string EvaluateName { get; set; }

// /** If variablesReference is > 0, the variable is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. */
public int VariablesReference { get; set; }

Expand All @@ -21,6 +26,7 @@ public static Variable Create(VariableDetailsBase variable)
{
Name = variable.Name,
Value = variable.ValueString ?? string.Empty,
EvaluateName = variable.Name,
VariablesReference =
variable.IsExpandable ?
variable.Id : 0
Expand Down
2 changes: 1 addition & 1 deletion src/PowerShellEditorServices/Debugging/DebugService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ await this.powerShellContext.ExecuteScriptString(
// of command executions into string output. However, if null is returned
// then return null so that no output gets displayed.
string outputString =
results != null ?
results != null && results.Count() > 0 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly more efficient to use results.Any() here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um ... yeah, good call! Much quicker than to count a 10000 element sequence.

string.Join(Environment.NewLine, results) :
null;

Expand Down