我正在为 Visual Studio 代码编写一个扩展,我想在其中评估 javascript 调试会话的当前变量。当打开该部分下的调试窗格时,通常会显示这些变量VARIABLES。请参阅随附的屏幕截图。
我想在用户右键单击编辑器时访问这些变量,但我不知道如何操作。
我当前的扩展设置是这样的:在package.json我已经注册了一个菜单贡献和一个命令:
"contributes": {
"menus": {
"editor/context": [{
"command": "extension.showVariables",
"group": "navigation"
}]
}
}
Run Code Online (Sandbox Code Playgroud)
在我的 extension.ts 中,我注册了这样的命令:
export function activate(context: vscode.ExtensionContext) {
let disposable = vscode.commands.registerCommand('extension.showVariables', () => {
// TODO: let variables = vscode.debug.activeDebugSession.variables.toString();
vscode.window.showInformationMessage(variables);
});
}
Run Code Online (Sandbox Code Playgroud)
我试图让它们通过,vscode.debug.activeDebugSession但这里没有变量的 API。我还尝试注册一个事件处理程序,vscode.debug.onDidReceiveDebugSessionCustomEvent但我不知道在哪里搜索调试变量。
是否可以在 vs 扩展中访问这些变量,或者我是否需要实现自己的调试器?
我可以手动设置断点,并使用调试器运行,但我无法在 Rust 程序出现紧急情况时设置断点。如何在恐慌时设置断点,就像在 C++ 中设置异常一样?
我正在使用 Rust 1.29.0-nightly、VS Code 1.25.1 和 MSVC 2017 工具链。
debugging breakpoints rust visual-studio-code vscode-debugger
我想调试一个 python 文件,该文件有一些仅出现在runfilesfrom bazel 中的依赖项。如何使用 vscode 调试器调试 bazel 构建?
我在需要调试的 docker 容器内运行一个进程。该进程在 docker 的入口点 via 启动
dlv debug /go/src/path/to/package --headless --listen=:2345 --log,以便稍后在 VSCode 中启用调试。
docker 容器通过 启动
docker run --rm -it -p 2345:2345 my_image:tag。注意 delve 的端口是暴露的。
在VSCode中我定义launch.json如下:
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach remote",
"type": "go",
"request": "attach",
"mode": "remote",
"port": 2345,
"host": "127.0.0.1",
"apiVersion": 1
}
]
}
Run Code Online (Sandbox Code Playgroud)
虽然不是很清楚,但该 UI 让我相信我现在已连接到远程无头调试器并准备好进行调试。我定义了一个断点,我知道该断点会被我可以发送远程进程的请求击中。我发送该请求,得到结果,并且该断点从未命中,表明我尚未实现远程调试。
我的 VSCode“附加远程”配置有问题吗?我可以进行命令行调试,dlv connect :2345并且实际上可以很好地调试远程进程,这表明无头服务器功能正常。我宁愿在 VSCode 中使用源代码进行调试。
In a project there are a number of helper utilities. In the launch and tasks json files they are configured to allow the user to select the particular utility to build or debug. What I would like to do is have the selection from launch to be passed to the tasks and the task use that selection. The launch.json configuration file looks like:
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug: <Utility App>",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/apps/${input:utility}/${input:utility}", …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 vs code 中调试打字稿。据我研究,您需要在 vs code 的 launch.config 中设置 outfiles 属性,以映射您在已编译的 .js 文件中在 TypeScript 文件中设置的断点,如此处指定。
当我尝试设置我的时,出现以下错误:
我在谷歌中没有发现任何关于此错误的信息,因为打字稿调试器需要此设置才能工作,正如VS Code 文档中所示。
预先感谢您的任何帮助。
编辑:
启动.json:
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"preLaunchTask": "tsc",
"sourceMaps": true
}
]
Run Code Online (Sandbox Code Playgroud)
ts配置:
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' …Run Code Online (Sandbox Code Playgroud) 我正在开发一个 Node.js 应用程序,使用express.js 作为监听 PORT 3000 的 Web 框架。我使用的是 VS Code v1.46。
我的launch.json文件是
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\WebApi\\index.js",
"restart": true,
"protocol": "inspector"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我能够第一次启动调试会话,但第二次开始,我收到错误Error: Listen EADDRINUSE: 地址已在使用 :::3000
此错误是因为 VSCode 没有终止在第一个调试会话中创建的 node.exe 进程,因此在后续会话中,节点无法在端口 3000 上启动 Express 服务器,因为该服务器仍在使用中。
谁能帮我配置 VSCode 以在停止调试器后终止 node.exe 进程?
自从昨天更新到 以来1.47.0,当 VSCode 启动时,它会在终端中给出以下输出(没有随后的提示让我输入):
Debugger listening on ws://127.0.0.1:55430/f3f20387-0605-4a39-b807-77f02bea362f
For help, see: https://nodejs.org/en/docs/inspector
Run Code Online (Sandbox Code Playgroud)
我通常的程序是:
code .npm run serve然后,我将通过键入(package.json has )在 VSCode 终端 (bash) 中启动我的服务器"serve": "vue-cli-service serve"。但是,现在有一些调试器和检查器持续运行,我显然不能这样做?launch.json这是显示我的空白和终端的屏幕截图:
有人可以告诉我如何解决这个问题吗?我不知道出了什么问题,但它似乎只发生在我打开的这个特定项目中code .
所以我尝试了更多的事情。
cp -rf testsite testfrontend我在 WSL 内跑步package-lock.json中node_modulesnpm installcode .然后,我通过在 WSL 中复制的项目的目录中运行来启动 VSCode当 vscode 出现时,终端没有显示。当我展示它时(ctrl+`),以下几行会自动运行:
我应该提到,当我直接从 WSL 运行时,我没有遇到此错误或任何其他上述问题npm run serve。WSL: Ubuntu如果我单击左下角的绿色按钮,然后选择Remote-WSL: …
I try to edit a vscode extension, update and add some customization, but when I debug it by pressing F5, my changes seem like not being executed. Even when I try to remove a piece of code that I am sure will break the extension, but unfotunately it still run like there are no changes at all. Am I wrong debugging it or there's caches that we should remove?
Btw I am using VSCode 1.52.1 on Ubuntu 18.04.
My …
我写了一个shell脚本,它会在启动python程序之前先做一些配置。(例如,下载数据,pip安装一些包,设置环境变量等。然后在python程序内部完成繁重的工作(例如,深度学习训练任务)。现在我想调试python程序,(我'如果我必须同时调试 shell 和 python,我可以接受)。我应该如何修改文件launch.json来完成此操作?我应该添加一些 task.json 项吗?我还不熟悉该任务主题。
目前,我正在以一种丑陋的解决方法来做这件事。我把shell脚本中的语句注释掉python train.py,先运行shell脚本。python train.py然后在调试模式下单独运行 python scipt 。我认为这目前适用于我的简单情况,但如果在 shell 脚本内部,我们正在做一些诸如临时修改环境变量之类的事情,我无法将这两个步骤分开。所以我想知道是否有更直接、更体面的方法。非常感激。
vscode-debugger ×10
bazel ×1
breakpoints ×1
debugging ×1
delve ×1
go ×1
node.js ×1
python ×1
rust ×1
typescript ×1
vscode-tasks ×1
vue.js ×1
webpack ×1