Skip to content

fix(57022): Rename of string literal property name doesn't rename all occurences #57201

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

Merged

Conversation

Zzzen
Copy link
Contributor

@Zzzen Zzzen commented Jan 28, 2024

… occurences

Fixes #57022

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Jan 28, 2024
@Zzzen Zzzen force-pushed the fix-rename-of-string-literal-propery-name branch from e46dacc to 9bbe239 Compare January 28, 2024 08:23
@sandersn sandersn changed the title fix(57022): Rename of string literal property name doesn't rename all… fix(57022): Rename of string literal property name doesn't rename all occurences Feb 15, 2024
@iisaduan
Copy link
Member

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 24, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
pack this ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 24, 2024

Hey @iisaduan, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/161937/artifacts?artifactName=tgz&fileId=A85DC03F46FFD993606A4365BA384A6E1C5542D66F5366C8399E730013E6019902&fileName=/typescript-5.5.0-insiders.20240524.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@iisaduan
Copy link
Member

iisaduan commented May 24, 2024

This PR doesn't quite do what the original bug report was asking for, however, I think it is the correct behavior that is in line with other renames that we offer. The foo immediately following the destructuring assignment is a separate variable than the one referred to by the string literal property.

Before this PR: rename only works when the property being renamed is not a string literal.

After this PR: foo is now properly assigned after renaming the property

Renaming the foo that doesn't change: the renamed variable is assigned properly

@iisaduan iisaduan merged commit af3a61f into microsoft:main May 24, 2024
@iisaduan
Copy link
Member

iisaduan commented May 24, 2024

@gabritto pointed out that you can make the vscode behavior match the playground behavior by setting providePrefixAndSuffixTextForRename (or "Use Aliases For Renames" in vscode) to false. #49568 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename of string literal property name doesn't rename all occurences
4 participants