Support rename in Svelte files
See original GitHub issueIs your feature request related to a problem? Please describe. Currently, I cannot do rename refactorings in svelte files.
Describe the solution you’d like Allow rename refactorings inside svelte files to work so that
- I can change prop names and all dependent files get updated
- I can change variables/functions inside svelte files
- I can change variables/functions outside in js/ts files and if they are used inside svelte files, those are updated aswell
Additional context I started prototyping this. Renames of variables/functions inside svelte files can be implemented quickly.
However implementing prop renames requires changes to svelte2tsx
. It seems that right now there is no mapping from export let X
to the generated jsx-prop.
Another problem is that when you do a rename inside ts/js, the language server does not pick that up because he is only registered to react to changes of svelte files. To fix that, it would need to register for js/ts files, too, which requires some work to differ between svelte and ts/js documents and not for example run diagnostics of the HTMLPlugin
on js/ts files. Maybe this could come as a second step, after renaming inside svelte files works.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5 (3 by maintainers)
I can confirm that everything works now in VS Code with the plugin and
svelte.enable-ts-plugin: true
Thank you @dummdidumm
There exists a TypeScript plugin now which comes packaged with the VS Code extension and which you need to enable through the settings. It also is available standalone as a npm package if you need to use it outside of VS Code. The plugin fixes the issue of renaming stuff inside TS/JS files and updating Svelte files, too.