问题
In WebStorm there's a really nice feature that you can right-click a file and choose "Find usages...", what would output all the files and all the line numbers in the project where that file is referenced (e.g. where path to it is specified as a string in JS require
).
I really love that feature, since it's very useful for refactoring - before I delete or edit smth I might want to find usages first to get clear understanding of what other things would be affected.
Is there a way I could do the same thing with VS Code?
Are there alternatives to Webstorm's "Safe delete" (when deleting a file it looks for usages first and shows a warning if there're some) and rename - so if I rename e.g. foo.js
to bar.js
all references to it in the project (e.g. paths within require
) would be automatically updated?
回答1:
Unfortunately there are no built in ways to do this in VS Code and I don't know of any extensions to do this, either.
回答2:
Actually you can open the helper console ( Cmd
+ Shift
+ P
in mac and the shortcut is Shift
+ F12
) and go to find all usages
来源:https://stackoverflow.com/questions/42888028/vs-code-alternative-to-webstorms-find-usages