question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support rename in Svelte files

See original GitHub issue

Is 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:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
imekachicommented, May 5, 2021

I can confirm that everything works now in VS Code with the plugin and svelte.enable-ts-plugin: true

  • renaming from other file types
  • finding references from other file types

Thank you @dummdidumm

1reaction
dummdidummcommented, May 5, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docs • Svelte
Complete documentation for Svelte.
Read more >
How can I rename index.html file in Svelte? - Stack Overflow
So I have two components in one svelte app that I run separately using separate rollup.config files. But the problem is they both...
Read more >
TypeScript support in Svelte - Learn web development
You can rename most of your .js files to .ts files and they will just work. Our TypeScript code will be able to...
Read more >
How do I import 2 x svelte components that have the same ...
Component folders: lib/folder1->component.svelte ... Barch rename files - replacing file name up to a certain character.
Read more >
Getting Started with Svelte - Snowpack
You now have your Snowpack environment set up to build .svelte files for ... Snowpack is flexible enough to support whatever project layout...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found