Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename file when renaming default export #29294

Open
jabacchetta opened this issue Jan 5, 2019 · 0 comments
Open

Rename file when renaming default export #29294

jabacchetta opened this issue Jan 5, 2019 · 0 comments
Labels
Domain: Refactorings e.g. extract to constant or function, rename symbol Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. Suggestion An idea for TypeScript

Comments

@jabacchetta
Copy link

Currently we can use the rename symbol command and that will rename the symbol and its usages (exports, imports, usages in other files, etc.). That's a great start, but I'd love to see this feature expanded to do the following:

  • Many times a file name will coincide with the symbol being refactored. The refactor option should be available when renaming the file, so everything can be done at once.

  • In addition to the refactor changing symbol references across all files, it'd be nice to have the ability to also update comments, strings, etc. that refer to that symbol.

Code Example:

Shape.js

class Shape {}
export default Shape;

Circle.js - We reference Shape as an import, extends, inside a comment, and inside a string. They should all be refactored.

import Shape from "./Shape";

// Shape subclass
class Circle extends Shape {
  constructor() {
    super();
    console.log('A circle is a Shape.');
  }
}

export default Circle;

WebStorm Examples

screen shot 2019-01-04 at 8 36 22 pm

screen shot 2019-01-04 at 8 37 02 pm

@vscodebot vscodebot bot assigned mjbvz Jan 5, 2019
@mjbvz mjbvz transferred this issue from microsoft/vscode Jan 7, 2019
@mjbvz mjbvz removed their assignment Jan 7, 2019
@mjbvz mjbvz changed the title File rename and refactor Rename file when renaming default export Jan 7, 2019
@weswigham weswigham added Suggestion An idea for TypeScript Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. Domain: Refactorings e.g. extract to constant or function, rename symbol labels Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Refactorings e.g. extract to constant or function, rename symbol Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants