'VSCode -- update import paths on file name change?

I keep reading that VSCode does this natively, but I can't figure out how to get it working for me in a React project with jsx files. It doesn't work with any file type... jsx, js, tsx, ts, scss, etc.

I would LOVE VSCode to search my entire project for file imports and automatically update import paths everywhere when I move a file into another directory or otherwise rename it in the explorer.

It seems like something the editor would / should do out of the box without the need to edit the settings.json or use an extension.



Solution 1:[1]

Unexpectedly, I found this worked after I updated the "Emmet: Include Languages" settings and added the item "javascript" with value "javascriptreact". (you can find this setting by searching for 'react' in the settings)

screenshot of the Emmet Include Languages setting

Ofc, remember to Save-All after the refactor since VSCode doesn't do that. And, bear in mind this doesn't fix refactoring for css imports.

Hopefully this works for you too!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1