gpt4 book ai didi

visual-studio-code - 如何禁用 VS 代码 "Extension Development Host"中的所有无关扩展而不覆盖我的正常用户配置?

转载 作者:行者123 更新时间:2023-12-05 05:44:34 26 4
gpt4 key购买 nike

我正在尝试调试/开发 VSCode 扩展。为此,我需要在调试“扩展开发主机”中禁用所有(许多)其他扩展。

然而,这样做会保存到我的用户首选项,然后导致……我所有其他 VScode 实例……停止任何扩展。

如何在“扩展开发主机”中禁用我的其他日常扩展而不破坏我的正常用户配置?有没有办法说服 EDH 反复可靠地使用不同的设置文件或配置路径或其他东西?

最佳答案

参见 Support extension debugging in a clean environment .和 v1.72 Release Notes Extension debugging in a clean environment

您必须启用此设置才能在稳定版 v1.71+ 中使用以下技术:

Workbench > Experimental > Settings Profile: Enabled

With the "settings profile" feature and the new command line supportfor profiles it is now possible to specify profiles in the extension'sdebug configuration.

There are basically two possible approaches:

"debugging in a clean environment" by using an unnamed "empty" profilethat gets automatically deleted when debugging has stopped.

"debugging in a controlled environment" by using a named profile thathas been created specifically for extension debugging and containsspecific settings and extensions.

This debug configuration shows how to "debug in a clean environment":

{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--profile-temp",
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceFolder}/sampleWorkspace"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "npm: watch"
}

Please note: the configuration from above passes a workspace folder${workspaceFolder}/sampleWorkspace which is currently mandatory forthe --profile-temp option. If the workspace folder argument ismissing, the --profile-temp option is silently ignored. We will try toremove this requirement soon (see issue #159577).

  • 上述要求已在 Insiders Build 中删除

因此,例如,我在启动配置中有以下 args:

    "args": [
"--profile-temp",

// some folder is necessary for now in Stable (but not Insiders), using the `${workspaceFolder}` variable
"${workspaceFolder}/../OneDrive/Test Bed",

"--extensionDevelopmentPath=${workspaceFolder}"
]

而且效果很好。 ExtensionHost 没有安装任何扩展,但我的其他 vscode 窗口不受影响。

下面来自 v1.72 Release Notes Extension debugging in a clean environment

请注意:在远程位置调试扩展时(通过“远程开发”扩展“Containers”、“SSL”或“WSL”),使用--profile-temp标志将导致此状态消息:

temporary profile in a remote situation error message

这是预料之中的,因为临时配置文件不包含任何扩展,这意味着“远程开发”扩展也丢失了。对于远程方案,建议创建一个空的命名配置文件,向其添加“远程开发”扩展,然后使用 --profile=.... 命令行选项。

关于visual-studio-code - 如何禁用 VS 代码 "Extension Development Host"中的所有无关扩展而不覆盖我的正常用户配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71572862/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com