简体   繁体   English

Vscode api - select 文件就像下拉

[英]Vscode api - select file like dropdown

I am currently working on a vscode extension.我目前正在开发一个 vscode 扩展。

Currently, I am retrieving all the.h from the workspace folder.目前,我正在从工作区文件夹中检索所有 the.h。 And I would like the user to be able to select the.h he wants and he can select it like in the picture below, but with the.h retrieved before.:我希望用户能够 select the.h 他想要并且他可以 select 如下图所示,但之前检索到.h。:

示例照片

Do you have an idea of how to do it?你知道怎么做吗? Or the name of this feature so that I can refer to the documentation because I can not find its name.或此功能的名称,以便我可以参考文档,因为我找不到它的名称。

I found the answer I'm posting it here, if anyone has the same question as me.我找到了我在这里发布的答案,如果有人和我有同样的问题。

let items: vscode.QuickPickItem[] = [
      {
        label: "Test1 Label",
        description: "Test1 Description",
        detail: "$(files) Test1 Detail with icon",
      },
      {
        label: "Test2 Label",
        description: "Test2 Description",
        detail: "$(files) Test2 Detail with icon",
      },
    ];

For the display.对于显示器。

vscode.window.showQuickPick(items);

Exemple示例

And thanks to rioV8 for the help感谢 rioV8 的帮助

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

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