Skip to content

Rename of prop should automatically expand abbreviated assignments #1863

@wiwa

Description

@wiwa

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions