diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/Source.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/Source.cs index 5a71ea1e0..29f21bdf9 100644 --- a/src/PowerShellEditorServices.Protocol/DebugAdapter/Source.cs +++ b/src/PowerShellEditorServices.Protocol/DebugAdapter/Source.cs @@ -12,6 +12,33 @@ public class Source public string Path { get; set; } public int? SourceReference { get; set; } + + /// + /// Gets an optional hint for how to present the source in the UI. A value of 'deemphasize' + /// can be used to indicate that the source is not available or that it is skipped on stepping. + /// + public string PresentationHint { get; set; } + } + + /// + /// An optional hint for how to present source in the UI. + /// + public enum SourcePresentationHint + { + /// + /// Dispays the source normally. + /// + Normal, + + /// + /// Display the source emphasized. + /// + Emphasize, + + /// + /// Display the source deemphasized. + /// + Deemphasize } } diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/StackFrame.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/StackFrame.cs index d0b60bd5f..0ea38ff8e 100644 --- a/src/PowerShellEditorServices.Protocol/DebugAdapter/StackFrame.cs +++ b/src/PowerShellEditorServices.Protocol/DebugAdapter/StackFrame.cs @@ -58,6 +58,9 @@ public static StackFrame Create( StackFrameDetails stackFrame, int id) { + var sourcePresentationHint = + stackFrame.IsExternalCode ? SourcePresentationHint.Deemphasize : SourcePresentationHint.Normal; + return new StackFrame { Id = id, @@ -66,13 +69,35 @@ public static StackFrame Create( EndLine = stackFrame.EndLineNumber, Column = stackFrame.StartColumnNumber, EndColumn = stackFrame.EndColumnNumber, - PresentationHint = stackFrame.PresentationHint.ToString().ToLower(), Source = new Source { - Path = stackFrame.ScriptPath + Path = stackFrame.ScriptPath, + PresentationHint = sourcePresentationHint.ToString().ToLower() } }; } } + + /// + /// An optional hint for how to present a stack frame in the UI. + /// + public enum StackFramePresentationHint + { + /// + /// Dispays the stack frame as a normal stack frame. + /// + Normal, + + /// + /// Used to label an entry in the call stack that doesn't actually correspond to a stack frame. + /// This is typically used to label transitions to/from "external" code. + /// + Label, + + /// + /// Displays the stack frame in a subtle way, typically used from loctaions outside of the current project or workspace. + /// + Subtle + } } diff --git a/src/PowerShellEditorServices/Debugging/StackFrameDetails.cs b/src/PowerShellEditorServices/Debugging/StackFrameDetails.cs index 09e1a117c..4f68f02ad 100644 --- a/src/PowerShellEditorServices/Debugging/StackFrameDetails.cs +++ b/src/PowerShellEditorServices/Debugging/StackFrameDetails.cs @@ -8,28 +8,6 @@ namespace Microsoft.PowerShell.EditorServices { - /// - /// An optional hint for how to present a stack frame in the UI. - /// - public enum StackFramePresentationHint - { - /// - /// Dispays the stack frame as a normal stack frame. - /// - Normal, - - /// - /// Used to label an entry in the call stack that doesn't actually correspond to a stack frame. - /// This is typically used to label transitions to/from "external" code. - /// - Label, - - /// - /// Displays the stack frame in a subtle way, typically used from loctaions outside of the current project or workspace. - /// - Subtle - } - /// /// Contains details pertaining to a single stack frame in /// the current debugging session. @@ -79,9 +57,10 @@ public class StackFrameDetails public int? EndColumnNumber { get; internal set; } /// - /// Gets a hint value that determines how the stack frame should be displayed. + /// Gets a boolean value indicating whether or not the stack frame is executing + /// in script external to the current workspace root. /// - public StackFramePresentationHint PresentationHint { get; internal set; } + public bool IsExternalCode { get; internal set; } /// /// Gets or sets the VariableContainerDetails that contains the auto variables. @@ -122,7 +101,7 @@ static internal StackFrameDetails Create( string workspaceRootPath = null) { string moduleId = string.Empty; - var presentationHint = StackFramePresentationHint.Normal; + var isExternal = false; var invocationInfo = callStackFrameObject.Properties["InvocationInfo"]?.Value as InvocationInfo; string scriptPath = (callStackFrameObject.Properties["ScriptName"].Value as string) ?? NoFileScriptPath; @@ -132,7 +111,7 @@ static internal StackFrameDetails Create( invocationInfo != null && !scriptPath.StartsWith(workspaceRootPath, StringComparison.OrdinalIgnoreCase)) { - presentationHint = StackFramePresentationHint.Subtle; + isExternal = true; } return new StackFrameDetails @@ -145,7 +124,7 @@ static internal StackFrameDetails Create( EndColumnNumber = 0, AutoVariables = autoVariables, LocalVariables = localVariables, - PresentationHint = presentationHint + IsExternalCode = isExternal }; }