-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
Support rename in Svelte files #110
Comments
* (feat) basic rename #110 * (feat) handle prop rename of component A inside component B * (feat) support for rename of prop of A in A * (fix) linting * (fix) fix range conversion, fix word retrival, tests * (fix) don't rename everything * (feat) add prepareRename support To show a message early that rename is not allowed in certain locations * (fix) use modified mapRangeToOriginal * (fix) don't rename in strings * (fix) don't allow rename of import path We cannot handle it at the moment * (fix) support prop rename without types For that svelte2tsx needs to write out the props as {prop: prop} * (fix) prevent renames in error state * (fix) use ts service for getting variable at position * (fix) convert bind so that source mapping is correct
Rename so far now works for:
It does not yet work for:
|
To support this we need to write a TypeScript plugin, which is tracked in #580 |
Initially support - rename (doesn't work properly for all kinds of renames yet; need to filter out references inside generated code) - diagnostics - find references (need to filter out references inside generated code) This makes all files TSX hardcoded for now, it seems the TS server is okay with importing tsx into js sveltejs#580 sveltejs#550 sveltejs#342 sveltejs#110
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. |
I can confirm that everything works now in VS Code with the plugin and
Thank you @dummdidumm |
Allow rename of component's A props in another component B. sveltejs#110
Allow rename of component's A props in another component B. #110
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
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 fromexport 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.The text was updated successfully, but these errors were encountered: