VSCode 以编程方式在扩展中搜索和替换 [英] VSCode programatically search and replace in an extension
问题描述
我想在我的扩展程序中执行一个命令来在工作区的所有文件中搜索某个词(工作区包含超过 15k 个文件),然后用其他东西替换那个词,但我没有找到任何 VSCode API那种东西.
I want to execute a command in my extension to search for some word in all files in the workspace (workspace contains more than 15k files) and then replace that word with something else, but I don't find any VSCode API for that kind of thing.
你们知道是否有一些命令吗?
Do you guys maybe know if there's some command for that?
推荐答案
您可以使用宏来做到这一点.您可以对其进行编码以依次打开每个文件,搜索并替换文本,然后保存文件.
You could do this with a Macro. You'd code it to open each file in turn, search + replace the text and then save the file.
类似于 VSCode 宏的东西:
Something like VSCode Macros:
https://marketplace.visualstudio.com/items?itemName=EXCEEDSYSTEM.vscode-宏
这篇关于VSCode 以编程方式在扩展中搜索和替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!