【问题标题】:Visual Studio Code - DebuggingVisual Studio 代码 - 调试
【发布时间】:2015-08-04 22:04:49
【问题描述】:

我下载了 Visual Studio Code,但不知道如何配置调试器。

我正在学习编程,但我不知道如何配置它?

有人帮我解决这个问题吗?

这是你需要配置的。


{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.  
// ONLY "node" and "mono" are supported, change "type" to switch.
"configurations": [
    {
        // Name of configuration; appears in the launch configuration drop down menu.
        "name": "Launch app.js",
        // Type of configuration. Possible values: "node", "mono".
        "type": "node",
        // Workspace relative or absolute path to the program.
        "program": "app.js",
        // Automatically stop program after launch.
        "stopOnEntry": true,
        // Command line arguments passed to the program.
        "args": [],
        // Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
        "cwd": ".",
        // Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
        "runtimeExecutable": null,
        // Environment variables passed to the program.
        "env": { }
    }, 
    {
        "name": "Attach",
        "type": "node",
        // TCP/IP address. Default is "localhost".
        "address": "localhost",
        // Port to attach to.
        "port": 5858
    }
]
}

【问题讨论】:

  • 你想调试什么?我以前不必在 Visual Studio 中配置调试器,它就可以工作。
  • 约翰爸爸在这里有一些关于调试的好信息johnpapa.net/debugging-with-visual-studio-code
  • 这是关于远程调试的吗?您需要更清楚地说明您的要求。
  • 查看这篇文章来配置Nodejs Express调试设置wiki.workassis.com/…
  • VSCode 有一个扩展 - 如this post 的答案中所列。

标签: debugging visual-studio-code


【解决方案1】:

您的问题需要更具体。

你在调试什么样的代码?

目前,Visual Studio Code 在所有平台上都提供对 Node.js(JavaScript 和 TypeScript)的调试支持,在 OS X 和 Linux 上对单声道(C# 和 F#)的实验性支持,以及即将推出的 ASP.NET 5。

如果您使用其中之一,您应该能够开始使用调试功能。

更多信息,这里是官方调试文档的直接链接:https://code.visualstudio.com/Docs/debugging

【讨论】:

  • 关于如何设置 Visual Studio Code 进行调试的文档非常差。大多数文档都没有提供任何关于如何设置 Web 服务器、如何在调试时自动启动它等信息......从习惯于常规 Visual Studio(和 ASP.NET + C#)或 Web Matrix + PHP正常工作(如果您的项目基于模板,您只需编写一些代码或什至没有代码后,只需按 F5 即可调试),这 100 更难设置 Visual Studio 代码以进行调试。
【解决方案2】:

如果您使用 php 进行编码,您可以按照以下步骤操作

你可以复制粘贴代码:

"version": "0.2.0",
"configurations": [
    {
        "name": "Listen for XDebug",
        "type": "php",
        "request": "launch",
        "port": 9000
    },
    {
        "name": "Launch currently open script",
        "type": "php",
        "request": "launch",
        "program": "${file}",
        "cwd": "${fileDirname}",
        "port": 9000
    }
]

【讨论】:

    猜你喜欢
    • 2019-08-20
    • 2017-09-27
    • 1970-01-01
    • 1970-01-01
    • 2013-05-01
    • 2012-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多