Skip to content

Rename file via rename on import paths #24501

Closed

Description

I want to be able to rename a file based on an import or export specifier:

import "./foo";

import * as foo from "./foo.ts";

export * from './bar';

In other words, F2 in VS Code on "./foo", "./foo.ts, and './bar' should allow me to rename the file if it originates from the appropriate workspace. Ideally this doesn't mess with .d.ts files that aren't considered hand-authored, but that's tough to differentiate.

My expectations:

  • we should maintain the extension for the new file if unspecified in the import/export specifier (i.e. keep it as .js, .jsx, .ts, .tsx if not mentioned in the resulting string)
  • we should change the extension if explicitly specified in the new specifier
  • for affected import/export specifiers, we should maintain whether or not an extension was ever specified.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issueSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions