如何配置Visual Studio Code调试器以使用Chrome Canary? [英] How to configure Visual Studio Code debugger to use Chrome Canary?

查看:77
本文介绍了如何配置Visual Studio Code调试器以使用Chrome Canary?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在同时处理多个项目,对于其中一个项目,我想使用Chrome Canary在Visual Studio Code中调试应用程序.

I'm working on multiple projects simultaneously, and for one of them I want to use Chrome Canary to debug my application in Visual Studio Code.

对于稳定的Chrome,我拥有

so for Stable Chrome i have

{
        "name": "Launch Chrome",
        "type": "chrome",
        "request": "launch",
        "url": "http://localhost:7246/",
        "runtimeArgs": [
            "--new-window",
            "--remote-debugging-port=9222"
        ],
        "webRoot": "${workspaceRoot}/app/"
}

是否有任何简便的方法可以在launch.json中配置为在单独的调试端口(例如9223)上使用Chrome Canary,所以我可以将Chrome Stable与调试端口9222一起用于所有其他用途?

Is there any easy way to configure in launch.json to use Chrome Canary on a separate debugging port (9223 for example), so I would be able to use Chrome Stable with debugging port 9222 for all the other things?

推荐答案

您应该能够结合使用 runtimeExecutable 属性来指定要测试的Chrome版本的路径 runtimeArgs ,为该配置指定其他调试端口. launch.json 中的 configurations 属性允许您指定配置数组.

You should be able to use the runtimeExecutable property to specify the path to the Chrome version you want to test with, in combination with runtimeArgs, specifying a different debugging port for that configuration. The configurations property in launch.json allows you to specify an array of configurations.

我本人还没有看过VS Code,所以无法验证这一点,但是这里有一些有用的信息:

I haven't looked at VS Code myself, so cannot verify this, but there is some useful information here: https://github.com/Microsoft/vscode-chrome-debug

更新您可以使用环境变量路径代替绝对路径.

Update You can use an environment variable path instead of an absolute path.

在命令提示符下,尝试执行以下操作来创建环境变量:

In Command Prompt, try something like this to create the environment variable:

set CHROME_PATH=C:/Users/[USER]/AppData/Local/Google/Chrome SxS/Application

在配置文件中,可以这样引用路径:

In the config file, the path can be referenced like this:

${env.CHROME_PATH}/chrome.exe

查看 https://code.visualstudio.com/Docs/editor/任务#_variable-substitution 了解更多详情.

这篇关于如何配置Visual Studio Code调试器以使用Chrome Canary?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆