使用VS Code扩展名查找文件

时间:2017-06-24 19:49:16

标签: visual-studio-code vscode-extensions

我正在实施使用http://matthiaseisen.com/articles/graphviz/的vs代码扩展。

每当用户点击该项目时,我都希望执行"在文件中找到"命令。

t know much about the Windows registry, so I don

如您所见,我将public getTreeItem(element: Item): TreeItem { return { label: element.name, collapsibleState: element.isGroup ? TreeItemCollapsibleState.Collapsed : TreeItemCollapsibleState.None, command: element.isGroup ? void 0 : { command: 'workbench.action.findInFiles', arguments: [element.name], title: 'Find references' } ... } } 作为element.name命令的参数传递。 不起作用 - 它只是打开搜索侧栏。

我在Tree View中寻找了一些参考,但没有运气。

提前谢谢!

1 个答案:

答案 0 :(得分:0)

As of the April 2019 release (1.34),现在可以通过指定query参数来实现。您还可以使用triggerSearch立即开始搜索:

{
    command: 'workbench.action.findInFiles',
    arguments: {
        query: element.name,
        triggerSearch: true
    },
    title: 'Find references'
}

选项的完整列表如下:

export interface IFindInFilesArgs {
    query?: string;
    replace?: string;
    triggerSearch?: boolean;
    filesToInclude?: string;
    filesToExclude?: string;
    isRegex?: boolean;
    isCaseSensitive?: boolean;
    matchWholeWord?: boolean;
}

请注意,必须将query设置为要遵守的任何其他值。

相关问题