IssueRaiser

Rename files support

**Is your feature request related to a problem? Please describe.** There are a few problems to consider: * Angular components consist of four files. These should typically have consistent names, but renaming any one requires a user to manually rename all four. * foo.component.ts * foo.component.spec.ts * foo.component.html * foo.component.css * Renaming a CSS or template HTML file breaks `templateUrl` and `styleUrls` references. * Renaming a file from `foo.component.ts` to `bar.component.ts` will still export a `FooComponent` definition, which can be confusing. **Describe the solution you'd like** The Angular language service could plug in to the "rename file" operation to handle all three use cases. * Renaming a single file could rename all four to match. * Renaming a template or style file could update relevant `templateUrl` and `styleUrls` properties. * Renaming a `*.component.ts` file could also rename the actual component symbol being exported (I'm not 100% convinced this is a good idea, but worth considering at least). **Describe alternatives you've considered** Alternative is to basically do this all manually. There are some scripts and custom schematics suggested in https://github.com/angular/angular-cli/issues/900, but the language service can be a lot smarter than the CLI here. **Additional context** Spin off from https://github.com/angular/angular-cli/issues/900.

Posted by dgp1130 on Jun 11, 2020, 7:28 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

support (Software)

Rename files support

dgp1130Jun 11, 2020, 7:28 PM

**Is your feature request related to a problem? Please describe.** There are a few problems to consider: * Angular components consist of four files. These should typically have consistent names, but renaming any one requires a user to manually rename all four. * foo.component.ts * foo.component.spec.ts * foo.component.html * foo.component.css * Renaming a CSS or template HTML file breaks `templateUrl` and `styleUrls` references. * Renaming a file from `foo.component.ts` to `bar.component.ts` will still export a `FooComponent` definition, which can be confusing. **Describe the solution you'd like** The Angular language service could plug in to the "rename file" operation to handle all three use cases. * Renaming a single file could rename all four to match. * Renaming a template or style file could update relevant `templateUrl` and `styleUrls` properties. * Renaming a `*.component.ts` file could also rename the actual component symbol being exported (I'm not 100% convinced this is a good idea, but worth considering at least). **Describe alternatives you've considered** Alternative is to basically do this all manually. There are some scripts and custom schematics suggested in https://github.com/angular/angular-cli/issues/900, but the language service can be a lot smarter than the CLI here. **Additional context** Spin off from https://github.com/angular/angular-cli/issues/900.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue