-
Notifications
You must be signed in to change notification settings - Fork 235
Add support for "justMyCode" debugger option #618
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
Comments
Can you elaborate on this one some more? |
var userInput = System.Console.ReadKey();
return userInput; If the debugger was stopped on line one, and you "step into" (F11) you would continue to line 2 instead of stepping into the code for |
+1 yes it's indeed very frustrating to keep jumping into Pester's It.ps1, Should.ps1, etc when trying to debug / step into a test. @tylerl0706 here is more on the "Just My Code" https://docs.microsoft.com/en-us/visualstudio/debugger/just-my-code which is available in Visual Studio and it' super useful Imagine a largish powershell module with a bunch of tests where you would want to debug a failing test to better see what went wrong. While step into the code, you will end up in the Pester functions which is not at all what you would want to debug. Node has a skipFiles setting in launch.json and the reason is that they don't want to step into the 3rd party node modules either while debugging. We would need something like that for PowerShell, so you can configure what files / modules do you want to step into or step over. skipFiles might not be the best in this case, we would rather want a flag for "debug only files in this folders" I suppose. Perhaps something like this ? "includeFiles": [
"**/*.ps*1", // by default add this. so we only debug files in the current folder. i.e.: Just My Code
"../myOtherModuleIWantToDebug/**/*.ps*1" // if there are other modules to debug add their paths as well with globbing
] |
This looks like added impetus for the ask in PowerShell/vscode-powershell#1039. I'd imagine this would be useful for codeLens and the debugger alike, with the default being only files in the current workspace. |
Is this something we can implement in the extension? Seems like support for this should be wired into the PowerShell debugger within the PowerShell engine. Of course, it would need input in terms of what is "my code". |
Ah good point! Perhaps we should open an issue with PowerShell. Then we would just need to route a VSCode configuration through (if that is the best design...) |
Or maybe provide a callback where PSES could say whether or not the "file location" is considered "my code" (or not). |
Another consideration is that we'll probably have to implement this feature ourselves at least somewhat, since it will never find its way back into PowerShell v5. |
It probably wouldn't be too difficult to implement in PSES. Because we use a custom host, we have to implement a lot of the debugger stop logic anyway. We just hook into the Even if PowerShell supports it, we'd probably have to write our own logic anyway. |
Please have a look at Issue #10530 in PowerShell/PowerShell for some thoughts I've been developing related to Just-My-Code debugging. This should be added to PowerShell itself, in such a way that tooling can leverage and support it. |
Debugging a test and stepping in and out of Pester can be frustrating. It'd be nice if we could have an option to automatically step through to the next in-workspace stop.
The text was updated successfully, but these errors were encountered: