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

JS object destructuring: allow to shorten expression when assignment is renamed back to original property value #58447

Open
undeletable opened this issue May 3, 2024 · 2 comments
Labels
Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Milestone

Comments

@undeletable
Copy link

Current behavior
In a restructuring assignment expression, when alias is renamed back to original property's name, it has the full form (const { property: property } = testObject; in the following example):
vscode-destructuring

Proposed behavior
Shorten form of assignment (const { property } = testObject; in this example) - either automatically, or enabled with configuration.

@psnet

This comment has been minimized.

@andrewbranch
Copy link
Member

This is not possible with TS Server’s current rename API, but it would be possible in LSP by implementing both textDocument/prepareRename and textDocument/rename.

@andrewbranch andrewbranch removed the Help Wanted You can do this label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Projects
None yet
6 participants