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 of prop should automatically expand abbreviated assignments #1863

Closed
wiwa opened this issue Feb 10, 2023 · 2 comments
Closed

Rename of prop should automatically expand abbreviated assignments #1863

wiwa opened this issue Feb 10, 2023 · 2 comments
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.

Comments

@wiwa
Copy link

wiwa commented Feb 10, 2023

Description

(New to Svelte, sorry if already answered)

In VSCode (v 1.75.0), using "Rename Symbol":
When a parent passes a prop, say {sameNameProp} to a child component (e.g. Child) with export let sameNameProp, and that child renames their symbol, to say otherNameProp, then VSCode will rename the prop reference in the parent as well.

Unfortunately, this currently results in:
<Child {otherNameProp}>, but the parent still only defines sameNameProp, causing a breakage.

Proposed solution

When renaming a prop whose references include abbreviations, automatically expand the abbreviations. In the example case, the parent's code should have become:

<Child otherNameProp={sameNameProp} />

Alternatives

On the other hand, this could be intended behavior which forces the developer to think about renaming props. Possible alternatives:

  1. Instead of changing "Rename Symbol" behavior, add an action to the Svelte extension so developers can choose to compatibly rename props or not.
  2. Add the action, but allow an option somewhere to set the default behavior of "Rename Symbol".
  3. (Assuming the current behavior is intended/desirable): Add documentation about it.

Additional Information, eg. Screenshots

svelte-rename-prop-vscode

@jasonlyu123
Copy link
Member

jasonlyu123 commented Feb 16, 2023

We already have this mechanism. This might be a bug in some edge cases. What is the version of the Svelte for VSCode you're using? Can you provide a more detailed reproduction and specify where did you trigger rename?

@jasonlyu123
Copy link
Member

Oh. Never mind. I misunderstood.

@dummdidumm dummdidumm added the bug Something isn't working label Feb 16, 2023
dummdidumm added a commit to dummdidumm/language-tools that referenced this issue Feb 16, 2023
...of component A props inside component A
sveltejs#1863
dummdidumm added a commit that referenced this issue Feb 16, 2023
...of component A props inside component A
#1863
@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

No branches or pull requests

3 participants