简体   繁体   English

使用特定搜索查询从扩展程序打开 VS Code 设置窗口

[英]Opening VS Code settings window from extension with specific search query

I am writing a VS Code extension where I want to open the settings window programmatically from my extension.我正在编写一个 VS Code 扩展,我想从我的扩展中以编程方式打开设置窗口。 I want the window to already have the search filled out to only show the settings my extension provides, and also a way to select workspace settings vs user settings when opening the window.我希望窗口已经填写了搜索以仅显示我的扩展程序提供的设置,以及一种在打开窗口时选择工作区设置与用户设置的方法。 I know how to run vscode commands from my extension, but I cannot figure out which commands open that window.我知道如何从我的扩展程序运行 vscode 命令,但我不知道哪些命令打开了那个窗口。

You can now pass an argument to the search, eg您现在可以将参数传递给搜索,例如

vscode.commands.executeCommand( 'workbench.action.openSettings', 'editor.formatOnSaveTimeout' );

or或者

vscode.commands.executeCommand( 'workbench.action.openSettings', '<your extension>' );

You can open the Settings page using:您可以使用以下方法打开“设置”页面:

vscode.commands.executeCommand('workbench.action.openSettings');

And to focus on the search input:并专注于搜索输入:

vscode.commands.executeCommand('settings.action.search');

However, I do not believe it's possible to specify a search value, filter by an extension, or choose the scope (user or workspace).但是,我认为无法指定搜索值、按扩展名过滤或选择范围(用户或工作区)。 You may open a feature request in the GitHub repo .您可以在GitHub 存储库中打开功能请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM