-
-
Notifications
You must be signed in to change notification settings - Fork 204
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/move of Svelte files #111
Comments
I found vscode's typescript features is using workspace API which doesn't seem to be accessible in the language server. So we can't just copy their solution. And with the structure of this repo, it will be quite difficult to done it on the client. There is some issue in language-server-protocol about proposals of rename file. I think we could have some workaround and update later to fit the protocol if it has been added. There are two additional solutions:
|
Thanks for finding those things out! I tried out the |
* (feat) update imports for renames/moves files closes #111 * (fix) bump ts version, refresh files - Bumping ts version speeds up rename files - Not refreshing the files will result in the ts service not noticing some updates which would create a bug where if you rename a file and rename it again, the ts service would have old files and rename would not update all locations. * (fix) cleanup, tests * (fix) add tsconfig to testfiles folder to speed up tests Now that tsconfig is used, the ts service is many times faster because it only knows the files inside the test folder * (feat) add updating imports indicator * (fix) rewire imports changes of moved file The language service might want to do edits to the old path, not the new path -> rewire it. If there is a better solution for this, please file a PR :)
Is your feature request related to a problem? Please describe.
Right now renaming/moving svelte files does not update the imports in other svelte files.
Describe the solution you'd like
Renaming/moving svelte files should update the imports in other svelte files.
Additional context
I dug around the language server protocol a little but found no event that says "file X moved from A to B" or "file X was renamed to Y". Instead,
onDidCloseTextDocument
andonDidOpenTextDocument
events fire, and also theonCodeAction
event is invoked with the new file path and a range with start/end of 0. One could infer a file rename/move from these events, if they appear shortly after each other, but I'm not sure if this is a hack or the only possible solution. If someone knows more about this, please comment.The text was updated successfully, but these errors were encountered: