Skip to content

Support different moveToNewFile file name conventionsΒ #46514

@bobbyg603

Description

@bobbyg603

Suggestion

Support additional file naming conventions when refactoring.

πŸ” Search Terms

moveToNewFile move to file "move to a new file"

βœ… Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

Specify project file naming conventions in tsconfig.json and use the rule here.

πŸ“ƒ Motivating Example

Angular projects use the file name convention some-example.component.ts. The refactor action "Move to a new file" uses the convention SomeNewFile.ts. Ideally, there would be a way to specify the naming convention of the new file. In this case, some-new-file.ts would be the desirable outcome.

πŸ’» Use Cases

  1. Create a TS interface in the same file where it's being used called SomeExampleInterface
  2. Extract the interface using "Move to a new file" in VS Code
  3. Notice the created file is SomeExampleInterface.ts, which needs to be renamed to some-example-interface.ts to follow project naming conventions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureDomain: LS: Refactoringse.g. extract to constant or function, rename symbolIn DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions