什么是 Visual Studio 代码实验?
What are Visual Studio Code experiments?
今天我惊讶地发现VSCode的Workbench设置下有一个"Enable Experiments"选项,默认开启。
设置的描述是 "Fetches experiments to run from a Microsoft online service",这对我来说似乎很模糊。我试着用谷歌搜索这个但没有找到任何明确的答案。
那么,有人知道 "experiments" 是什么吗?关闭它是否更好?
这是使用开源软件是个好主意的案例之一。因为visual studio代码的源代码发布在https://github.com/Microsoft/vscode。我们可以尝试搜索代码的使用位置。
首先,我们可以尝试搜索字符串 Enable Experiments
。并查看该选项与哪个操作相关联。从那里,我看到文件 src/vs/workbench/contrib/experiments/node/experimentService.ts
正在使用它。具体来说,当尝试在行 173
中加载实验时
if (!product.experimentsUrl || this.configurationService.getValue('workbench.enableExperiments') === false) {
我们看到,代码会检查 "experiment URL"。这可以在@Joey 在评论中提到的 product.json
中看到。在我的例子中,文本看起来像这样。
"experimentsUrl": "https://az764295.vo.msecnd.net/experiments/vscode-experiments.json",
从那里,我们可以通过向 URL 发出 GET 请求来查看 JSON 文件的内容。而且,它 returns 这个(至少,在我提出请求的时候)
{
"experiments": [
{
"id": "cdias.searchForAzure",
"enabled": true,
"action": {
"type": "ExtensionSearchResults",
"properties": {
"searchText": "azure",
"preferredResults": [
"ms-vscode.vscode-node-azure-pack",
"ms-azuretools.vscode-azureappservice",
"ms-azuretools.vscode-azurestorage",
"ms-azuretools.vscode-cosmosdb"
]
}
}
}
]
}
根据响应,我可以看到,如果我使用 "azure" 关键字进行搜索,它会尝试更改我的搜索结果。我试过了,搜索结果显示了结果搜索顶部的 4 个项目。
至于要不要关闭。为了安全起见(如果您不希望它改变您使用 vscode 的体验),我认为您会想要禁用它。但是,我不认为微软会做一些疯狂的事情。
我刚注意到这个,也很好奇。在 VS Code 发行说明中进行搜索,在 2018 年 7 月找到了对它的引用。workbench.enableExperiments
被列为 VS Code "Offline mode" 的设置之一:https://code.visualstudio.com/updates/v1_26#_offline-mode
离线模式的描述表明此设置适用于 "A/B experiments":
To support this offline mode, we have added new settings to turn off features such as automatic extension update checking, querying settings for A/B experiments, and fetching of online data for auto-completions.
如其他人所述,VS Code 的源代码显示 experimentService.ts
中使用了此设置:https://github.com/microsoft/vscode/blob/93bb67d7efb669b4d1a7e40cd299bfefe5e85574/src/vs/workbench/contrib/experiments/common/experimentService.ts
如果您查看 experimentService.ts
的代码,它正在获取的内容似乎与扩展推荐、新功能通知和类似内容有关。因此,实验服务似乎是用于获取数据以进行 A/B 功能测试和向用户推荐扩展程序。
今天我惊讶地发现VSCode的Workbench设置下有一个"Enable Experiments"选项,默认开启。
设置的描述是 "Fetches experiments to run from a Microsoft online service",这对我来说似乎很模糊。我试着用谷歌搜索这个但没有找到任何明确的答案。
那么,有人知道 "experiments" 是什么吗?关闭它是否更好?
这是使用开源软件是个好主意的案例之一。因为visual studio代码的源代码发布在https://github.com/Microsoft/vscode。我们可以尝试搜索代码的使用位置。
首先,我们可以尝试搜索字符串 Enable Experiments
。并查看该选项与哪个操作相关联。从那里,我看到文件 src/vs/workbench/contrib/experiments/node/experimentService.ts
正在使用它。具体来说,当尝试在行 173
if (!product.experimentsUrl || this.configurationService.getValue('workbench.enableExperiments') === false) {
我们看到,代码会检查 "experiment URL"。这可以在@Joey 在评论中提到的 product.json
中看到。在我的例子中,文本看起来像这样。
"experimentsUrl": "https://az764295.vo.msecnd.net/experiments/vscode-experiments.json",
从那里,我们可以通过向 URL 发出 GET 请求来查看 JSON 文件的内容。而且,它 returns 这个(至少,在我提出请求的时候)
{
"experiments": [
{
"id": "cdias.searchForAzure",
"enabled": true,
"action": {
"type": "ExtensionSearchResults",
"properties": {
"searchText": "azure",
"preferredResults": [
"ms-vscode.vscode-node-azure-pack",
"ms-azuretools.vscode-azureappservice",
"ms-azuretools.vscode-azurestorage",
"ms-azuretools.vscode-cosmosdb"
]
}
}
}
]
}
根据响应,我可以看到,如果我使用 "azure" 关键字进行搜索,它会尝试更改我的搜索结果。我试过了,搜索结果显示了结果搜索顶部的 4 个项目。
至于要不要关闭。为了安全起见(如果您不希望它改变您使用 vscode 的体验),我认为您会想要禁用它。但是,我不认为微软会做一些疯狂的事情。
我刚注意到这个,也很好奇。在 VS Code 发行说明中进行搜索,在 2018 年 7 月找到了对它的引用。workbench.enableExperiments
被列为 VS Code "Offline mode" 的设置之一:https://code.visualstudio.com/updates/v1_26#_offline-mode
离线模式的描述表明此设置适用于 "A/B experiments":
To support this offline mode, we have added new settings to turn off features such as automatic extension update checking, querying settings for A/B experiments, and fetching of online data for auto-completions.
如其他人所述,VS Code 的源代码显示 experimentService.ts
中使用了此设置:https://github.com/microsoft/vscode/blob/93bb67d7efb669b4d1a7e40cd299bfefe5e85574/src/vs/workbench/contrib/experiments/common/experimentService.ts
如果您查看 experimentService.ts
的代码,它正在获取的内容似乎与扩展推荐、新功能通知和类似内容有关。因此,实验服务似乎是用于获取数据以进行 A/B 功能测试和向用户推荐扩展程序。