Visual studio code 如何在vscode中选择多个文件?
我想写一个扩展来实现如下功能:Visual studio code 如何在vscode中选择多个文件?,visual-studio-code,vscode-extensions,Visual Studio Code,Vscode Extensions,我想写一个扩展来实现如下功能: 选择两个或多个文件 右键单击并在explore/context 打开一个对话框以保存结果 我发现vscode似乎没有API来选择explore中的文件那么如何选择多个文件?? 而且根据,我发现所有的RawContextKey,我没有发现一个条件满足我的要求。VSCode 1.20介绍。在文档中,我没有找到您可以使用的when子句来确定是选择了2个文件还是只选择了一个文件,但在源代码中,我找到了这些上下文: const RawWorkbenchListFocusCo
explore/context
vscode
似乎没有API来选择explore
中的文件那么如何选择多个文件??
而且根据,我发现所有的RawContextKey
,我没有发现一个条件满足我的要求。VSCode 1.20介绍。在文档中,我没有找到您可以使用的when
子句来确定是选择了2个文件还是只选择了一个文件,但在源代码中,我找到了这些上下文:
const RawWorkbenchListFocusContextKey = new RawContextKey<boolean>('listFocus', true);
export const WorkbenchListSupportsMultiSelectContextKey = new RawContextKey<boolean>('listSupportsMultiselect', true);
export const WorkbenchListFocusContextKey = ContextKeyExpr.and(RawWorkbenchListFocusContextKey, ContextKeyExpr.not(InputFocusedContextKey));
export const WorkbenchListDoubleSelection = new RawContextKey<boolean>('listDoubleSelection', false);
export const WorkbenchListMultiSelection = new RawContextKey<boolean>('listMultiSelection', false);
const RawWorkbenchListFocusContextKey=new RawContextKey('listFocus',true);
export const WorkbenchListSupportsMultiSelectContextKey=new RawContextKey('listSupportsMultiselect',true);
导出常量WorkbenchListFocusContextKey=ContextKeyExpr.and(RawWorkbenchListFocusContextKey,ContextKeyExpr.not(InputFocusedContextKey));
export const WorkbenchListDoubleSelection=新建RawContextKey('listDoubleSelection',false);
export const WorkbenchListMultiSelection=新建RawContextKey('listMultiSelection',false);
具体来说,WorkbenchListDoubleSelection
用于选择2个文件时上下文菜单中的Compare selected
命令
VSCode最近增加了允许在自定义视图中进行多重选择的功能。要在自定义视图中允许多选,应在
窗口中指定第二个参数TreeViewOptions
。创建treeview
函数调用并将其属性canSelectMany
设置为true。示例用法如下所示:
window.createTreeView(/*YOUR_VIEW_NAME*/, {
treeDataProvider: /*YOUR_TREE_DATA_PROVIDER*/,
canSelectMany: true // enables multi selection
});