From 41a771f14f865e39572c0f3407fe9be8f2b95d32 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Thu, 25 Feb 2016 10:42:18 -0700 Subject: [PATCH 1/2] Partial fix for issue 95 - set all scopes but Local as expensive. This makes the debug hover tips work better. But if you want to look at a variable in a higher scope, you have to select that scope in the callstack so the variable is a "local" variable in that scope. --- .../DebugAdapter/Scope.cs | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/Scope.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/Scope.cs index 3d8e04c31..8db65fa94 100644 --- a/src/PowerShellEditorServices.Protocol/DebugAdapter/Scope.cs +++ b/src/PowerShellEditorServices.Protocol/DebugAdapter/Scope.cs @@ -3,34 +3,33 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter { public class Scope { -// /** name of the scope (as such 'Arguments', 'Locals') */ -// name: string; + /// + /// Gets or sets the name of the scope (as such 'Arguments', 'Locals') + /// public string Name { get; set; } -// /** The variables of this scope can be retrieved by passing the value of variablesReference to the VariablesRequest. */ -// variablesReference: number; + /// + /// Gets or sets the variables of this scope can be retrieved by passing the + /// value of variablesReference to the VariablesRequest. + /// public int VariablesReference { get; set; } -// /** If true, the number of variables in this scope is large or expensive to retrieve. */ -// expensive: boolean; + /// + /// Gets or sets a boolean value indicating if number of variables in + /// this scope is large or expensive to retrieve. + /// public bool Expensive { get; set; } public static Scope Create(VariableScope scope) { - return new Scope - { + return new Scope { Name = scope.Name, - VariablesReference = scope.Id + VariablesReference = scope.Id, + Expensive = (scope.Name != VariableContainerDetails.LocalScopeName) }; } } From 84724a08997879cb3f1b56f475282d42a9f116a3 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Thu, 25 Feb 2016 12:13:17 -0700 Subject: [PATCH 2/2] Added comment for this hopefully temporary change. --- src/PowerShellEditorServices.Protocol/DebugAdapter/Scope.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/Scope.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/Scope.cs index 8db65fa94..90d20ec88 100644 --- a/src/PowerShellEditorServices.Protocol/DebugAdapter/Scope.cs +++ b/src/PowerShellEditorServices.Protocol/DebugAdapter/Scope.cs @@ -29,6 +29,7 @@ public static Scope Create(VariableScope scope) return new Scope { Name = scope.Name, VariablesReference = scope.Id, + // Temporary fix for #95 to get debug hover tips to work well at least for the local scope. Expensive = (scope.Name != VariableContainerDetails.LocalScopeName) }; }