How to ReFactor JS code in a scripted way?

there is a project in the company that uses a lot of React and Redux, background interfaces, uses swagger api framework, and then uses handlebar at the front end to automatically generate action creator according to swagger"s json.
the problem now is that there is something wrong with the original action creator naming convention, and now I want to change it, but the old action creator is heavily referenced in the code.
I tried the F2 rename symbol, of vscode. After setting the paths of jsconfig, I can change the method name correctly globally, but there are too many methods that I can"t change by hand, so I wonder if there is an api of vscode that allows me to write a js script to call its rename symbol method?
or do you have any other ideas? thank you for your advice!


I don't know, I can only provide ideas. Vscode itself can install plug-ins, that is, you can look in vscode's official plug-in documentation to see if there is a dedicated api. If not, look at the source code of vscode and see which function is bound to its rename symbol option, just like analyzing the behavior of a web page-vscode is a web page. Not really, just implement the function of rename symbol by yourself, or simply use regular expressions to replace, within the scope of the file. It should not replace what should not be replaced.

Menu