运行具有扩展功能的vscode chrome调试器 [英] run vscode chrome debugger with its extensions

查看:90
本文介绍了运行具有扩展功能的vscode chrome调试器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以启动所有安装在chrome上的扩展程序的chrome窗口吗?

Is there any way we can launch the chrome window with all the extensions installed on chrome?

{
    "version": "0.2.0",
    "configurations": [{
        "type": "chrome",
        "request": "launch",
        "name": "Launch Chrome against localhost",
        "url": "http://site.example.com/",
        "webRoot": "${workspaceFolder}"
    }]
}

推荐答案

在启动配置中将userDataDir属性设置为false时,您可以使用用户个人资料启动Chrome,但我强烈建议不要这样做路线.您应该将调试环境保留在沙盒中,并与您的个人档案分开.您也可能也不想不必要地在常规浏览会话中启用远程调试.

While setting the userDataDir property in the launch config to false will allow you to launch Chrome using your user profile, I would highly suggest not going that route. You should want to keep your debugging environment sandboxed and separated from your personal profile. You also probably shouldn't want to enable remote debugging in your regular browsing sessions as well unnecessarily.

默认情况下,Chrome调试器会为您的调试会话创建一个新的配置文件,并在您重新启动计算机之前一直存在.这里的技巧是为您的工作空间创建一个配置文件.然后,您可以将此配置文件配置为具有所需的任何扩展名和其他设置.我们只需要使它永久保留就可以了,所以我们不必再次对其进行重新配置.

By default, Chrome debugger will create a new profile for your debugging session and will persist til you restart your computer. The trick here is to create a profile just for your workspace. You could then configure this profile to have whatever extensions and other settings that you need. We just need to make it persist permanently so we don't have to reconfigure it again.

相反,将userDataDir属性设置为.vscode目录中的路径(并在源代码控件中忽略).它将在您设置的目录中创建配置文件.我使用${workspaceFolder}/.vscode/vscode-chrome-debug-userdatadir.然后,当您运行调试器时,它将在该目录中创建一个配置文件,该配置文件应无限期存在.然后,您可以安装所需的所有扩展程序,而无需弄乱您的个人资料.

Instead, set the userDataDir property to a path in your .vscode directory (and ignore in your source control). It will create the profile in that directory you set. I use ${workspaceFolder}/.vscode/vscode-chrome-debug-userdatadir. Then when you run the debugger, it will create a profile in that directory that should persist indefinitely. You could then install all the extensions you want, all without muddying up your personal profile.

这篇关于运行具有扩展功能的vscode chrome调试器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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