Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code and Angular: how do I rename folders and component class?

I am using Visual Studio Code for my huge Angular-4 project. From time to time I copy components entirely and then modify them. Components are organized in folders so i end up renaming multiple files and class names.

Is there an extension that does this all at once?

my-component-name\
my-component-name\my-component-name.component.cs
my-component-name\my-component-name.component.html
my-component-name\my-component-name.component.css
export class MyComponent

Would be handy to just give a new name and renaming would be done everywhere. Thanks

like image 398
PeterFromCologne Avatar asked Oct 19 '17 09:10

PeterFromCologne


2 Answers

As per my experience with VSCode, the only way is to reach out to the master Project folder and rename the files/ folders as per your requirement manually while the IDE is closed. Refresh the folder and CTRL+O the folder thereafter from VSCode. This has worked for me.

like image 87
Krishanu Chakraborty Avatar answered Sep 26 '22 01:09

Krishanu Chakraborty


Now there is a way to rename Angular Component classes and folders in one step from VS Code.

The Rename Angular Component extension on Visual Studio Marketplace.

Rename Angular Component in action

The current release also supports renaming Directives, Services and Route Guards

like image 37
tomwhite007 Avatar answered Sep 25 '22 01:09

tomwhite007