-
Notifications
You must be signed in to change notification settings - Fork 513
Add Debug Runspace command #1782
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
Changes from 4 commits
be326b5
e7d72b5
e72d1fe
35deb7a
64bb51c
0a31064
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -32,6 +32,7 @@ | |||||||
"onCommand:PowerShell.NewProjectFromTemplate", | ||||||||
"onCommand:PowerShell.OpenExamplesFolder", | ||||||||
"onCommand:PowerShell.PickPSHostProcess", | ||||||||
"onCommand:PowerShell.PickRunspace", | ||||||||
"onCommand:PowerShell.SpecifyScriptArgs", | ||||||||
"onCommand:PowerShell.ShowSessionConsole", | ||||||||
"onCommand:PowerShell.ShowSessionMenu", | ||||||||
|
@@ -318,6 +319,7 @@ | |||||||
"runtime": "node", | ||||||||
"variables": { | ||||||||
"PickPSHostProcess": "PowerShell.PickPSHostProcess", | ||||||||
"PickRunspace": "PowerShell.PickRunspace", | ||||||||
"SpecifyScriptArgs": "PowerShell.SpecifyScriptArgs" | ||||||||
}, | ||||||||
"languages": [ | ||||||||
|
@@ -406,6 +408,17 @@ | |||||||
"request": "launch", | ||||||||
"cwd": "" | ||||||||
} | ||||||||
}, | ||||||||
{ | ||||||||
"label": "PowerShell: Attach Interactive Session Runspace", | ||||||||
"description": "Open runspace picker to select runspace to attach debugger to", | ||||||||
"body": { | ||||||||
"name": "PowerShell Attach Interactive Session Runspace", | ||||||||
"type": "PowerShell", | ||||||||
"request": "attach", | ||||||||
"processId": "current", | ||||||||
"runspaceId": "^\"\\${command:PickRunspace}\"" | ||||||||
} | ||||||||
} | ||||||||
], | ||||||||
"configurationAttributes": { | ||||||||
|
@@ -447,9 +460,9 @@ | |||||||
"default": null | ||||||||
}, | ||||||||
"runspaceId": { | ||||||||
"type": "number", | ||||||||
"type": "string", | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really wish it were possible to do like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually... it looks like you can do:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @adamdriscoll I think you maybe missed this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep. In there now. |
||||||||
"description": "Optional: The ID of the runspace to debug in the attached process. Defaults to 1. Works only on PowerShell 5 and above.", | ||||||||
"default": 1 | ||||||||
"default": "1" | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One of the things I did in #1775 was made the default for vscode-powershell/src/features/DebugSession.ts Lines 81 to 83 in 1db2283
@rkeithhill @rjmholt if we want to make prompting for PickRunspace to be the default, it should probably be implemented in a similar fashion. |
||||||||
}, | ||||||||
"customPipeName": { | ||||||||
"type": "string", | ||||||||
|
@@ -491,13 +504,20 @@ | |||||||
"name": "PowerShell Attach to Host Process", | ||||||||
"type": "PowerShell", | ||||||||
"request": "attach", | ||||||||
"runspaceId": 1 | ||||||||
"runspaceId": "1" | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should go ahead and make this thoughts @rkeithhill @rjmholt? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So would the workflow be 1) query PSES for host processes 2) user picks host process, 3) query PSES for runspaces in the selected host process and 4) user picks runspace? If so, that sounds pretty good to me. Although I have a feeling the vast majority of time the user will pick runspace 1. If they get tired of the prompt, I guess then could then hard-code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly! Ok. Lets do that. @adamdriscoll can you follow #1775 and implement it in a similar fashion? Ideally, the user should not have to put anything for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After starting to implement this I realized I needed to update the request to pass in a process ID for the request runspace command. I kinda got that working but am seeing weird stuff where its complaining about null values and stating the "Attach to Host Process" debugger is already running when I cancel out of the pickers. I will revisit tomorrow but it's not as simple as I thought at first. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me know if there's anything you need from us :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got this working. Updated this PR and the PSES PR to support process ID and to pop up the picker in the same place as the process picker. |
||||||||
}, | ||||||||
{ | ||||||||
"name": "PowerShell Interactive Session", | ||||||||
"type": "PowerShell", | ||||||||
"request": "launch", | ||||||||
"cwd": "" | ||||||||
}, | ||||||||
{ | ||||||||
"name": "PowerShell Attach Interactive Session Runspace", | ||||||||
"type": "PowerShell", | ||||||||
"request": "attach", | ||||||||
"processId": "current", | ||||||||
"runspaceId": "${command:PickRunspace}" | ||||||||
} | ||||||||
] | ||||||||
} | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍