【问题标题】:vscode extension quickpick activeItems doesn't workvscode 扩展 quickpick activeItems 不起作用
【发布时间】:2023-02-24 05:18:48
【问题描述】:
const q = vscode.window.createQuickPick();
q.items = [{ label: "1" }, { label: "2" }];
q.activeItems = [{ label: "2" }];
q.show();

根据我对 vscode 扩展 api 文档的理解。

/**
  * Active items. This can be read and updated by the extension.
  */
activeItems: readonly T[];

当显示快速选择时,它应该激活“2”项。 但是我发现 activeItems 会在 show() 方法之后重置; 我不知道为什么,也无法在互联网上找到任何相同的问题,

【问题讨论】:

    标签: javascript vscode-extensions


    【解决方案1】:

    好像是bug is impacting behavior here

    我的解决方案是设置活动项目调用显示方法。此外,代码似乎确实进行了引用比较。

    所以

    const q = vscode.window.createQuickPick();
    const selectedItem = { label: "2" };
    q.items = [{ label: "1" }, selectedItem];
    q.show();
    q.activeItems = [selectedItem];
    

    【讨论】:

      猜你喜欢
      • 2018-06-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-18
      • 2014-11-30
      • 2014-02-20
      • 2019-03-21
      • 2011-08-18
      相关资源
      最近更新 更多