Skip to content

Rename files support #65524

Open
Open

Description

@dgp1130

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 angular/angular-cli#900, but the language service can be a lot smarter than the CLI here.

Additional context

Spin off from angular/angular-cli#900.

Activity

  1. added
    feature
    on Jun 11, 2020
  2. Danebrouwer97 commented on Mar 25, 2021

    @Danebrouwer97

    I see that the Angular CLI discussion has been closed as responsibility has shifted here.
    Just wanted to follow up and find out if there's been any movement on this feature request?

  3. varthc commented on Oct 8, 2021

    @varthc

    This would be a cool feature. I read the previous issue in the angular cli project and I agree, it is super annoying to rename the files manually.
    I hope this is considered in the near future!

  4. tomwhite007 commented on Jan 10, 2022

    @tomwhite007

    In the meantime, here is an alternative solution:

    I've created an Extension for VS Code to do all of these steps for you. It's called Rename Angular Component.

    I have hopes of porting it to WebStorm and a Schematic later.

    Previously, it took at least three semi-automated steps in VS Code as a minimum. This Extension does all of them.

    I realise this is promoting my own solution. But it is free, open source, and a complete answer. If it doesn't do everything you're looking for, you can post issues on the repo, and it will be improved.

  5. added
    area: vscode-extension
    on Nov 21, 2025
  6. added
    area: vscode-extension
    and removed
    area: vscode-extension
    on Nov 24, 2025
  7. added this to the Backlog milestone on Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: vscode-extensionfeature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions