PowerShell / PowerShell/PowerShellEditorServices

Don't stop debugging after script execution in TemporaryIntegratedConsole

未关闭
#2,180 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Area-Debugging Issue-Enhancement
主要语言
C#
星标
767
派生
266
平均合并
3 天 16 小时
30 天内合并 PR
1

描述

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been requested.
Summary

I use VSCode for developing PowerShell modules. For debugging, I create a PowerShell configuration in the launch.json file with createTemporaryIntegratedConsole option enabled. This allows for a dedicated PowerShell session for debugging that is easy to restart.

In launch.json configuration, if the script option is not provided, the debugger still waits after the [TEMP] PowerShell Extension console opens: the debugger works in interactive mode, and if a command executed in the console hits a breakpoint, the debugger pauses. This mode allows you to efficiently debug a module, rather than having to update a temporary script.

If commands are entered in the script property in launch.json, for example to load the module and set the environment, the script is executed by PES and then the debugging session is stopped, although the temporary console remains open. This makes it impossible to debug in interactive mode. This requires not filling in the script property and manually entering the initialization commands each time the debugging session is (re)started, which is not practical for daily use when you frequently need to start from scratch.

Proposed Design

It would be useful if the debug session did not close until the temporary console is closed (since the primary purpose of running a script this way is to debug). While this cannot be enabled by default for reasons I do not know, an option to enforce this behavior would be welcome and very useful for developers.

I haven't found a similar request here, but I did find one in the vscode-powershell repository: https://github.com/PowerShell/vscode-powershell/issues/1168

For my part, I have implemented a workaround that meets this need, while waiting for an official solution, by modifying a line in the ConfigurationDoneHandler.cs file: https://github.com/jul-m/PowerShellEditorServices/commit/d864c898600b82dd9b33f5abf7d7327c8af7224b

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 ConfigurationDoneHandler.cs 开始,检查所引用的 workaround commit,然后对比相关的 vscode-powershell issue。验证已配置的脚本如何在保持临时控制台打开的同时结束调试会话。完成的标准是:脚本执行后,会话仍可保持活动状态以进行交互式断点调试,并在临时控制台关闭时结束,最好通过一个选项控制。

由索引模型根据 Issue 内容生成。

评估

技术栈
csharp, powershell
领域
devtools
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。