-
-
Notifications
You must be signed in to change notification settings - Fork 209
F2/Renaming a .ts file to a .svelte.ts does not update imports in VS Code #2734
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
Comments
The update-import functions are split between the TypeScript and Svelte extensions to avoid duplicate edits. When there is a duplicated edit between TypeScript and the Svelte extension, it might cause a race condition and break the code. I think what happens in your case is that you haven't opened any Svelte files, so the Svelte extension hasn't started yet. That is why it is missing part of the functionality. Can you check if it works after you opened a svelte files? |
Interesting idea, so I've just tried:
Still the same, just that .ts file got renamed (I checked the git tab), no prompt no nothing. FWIW, tried the same in Cursor with the same outcome. If you have more ideas let me know, happy to try more! Edit: BTW, this has worked flawlessly on March 19, where a renaming affected 9 files. I would have reported it then already if it hadn't worked then. |
There is a separate config |
It's enabled:
Now, it is getting weird, I redid the entire process above but change another .ts file's (let's call it b.ts) name to .svelte.ts in the same folder. This time, while VS Code didn't prompt, at least it opened all affected files and changed their imports properly and left the file unsaved/dirty. Now, I did the same for the og file (let's call it a.ts) and it worked there too. Since, I couldn't believe my eyes, I tried close VS Code, redid everything and got the same result, I got unsaved files with all affected imports. Now, I tried this a third time but again with the og file a.ts first and it worked too. Totally confused... |
Update: It is definitely not about if a .svelte or .svelte.ts file is open, it feels rather erratically. I just had open 14 files, all kind of files, many .svelte and many .svelte.ts. I renamed one .ts file to a .svelte.ts file which affects imports in three more files. Nothing had happened. |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Updating myImport.ts to myImport.svelte.ts, should update all imports of myImport.ts in other files (either by prompting or automatically depending on your VS Code settings).
Reproduction
Rename any .ts file to a .svelte.ts file and watch how imports get ignored.
If you uninstall the VS Code Svelte plugin you get at least the imports of your renamed file in the .ts files but not in the .svelte files updated.
Expected behaviour
Updating all imports.
System Info
VS Code 1.98.2 on Ubuntu
Plugins installed:
(TS-plugin is enabled)
Which package is the issue about?
Svelte for VS Code extension
Additional Information, eg. Screenshots
No response
The text was updated successfully, but these errors were encountered: