-
Notifications
You must be signed in to change notification settings - Fork 57
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
Rename happens in wrong location when build has failed #417
Comments
Good point. I think rename should not happen when the file is unsaved. The server already keeps track of the current content of the file. Perhaps the server should also keep track of whether the file is saved. |
Yeah, maybe we should prompt the user that the file isn't saved, and then ask them to save it and try again? |
Shouldn't the extension be using the code that's in the editor's memory and not what's on disk? Or is there something that prevents that? There may be reasons why the user does not want to save. |
Renaming with unsaved files is asking for trouble. |
Looks like the server can receive notifications when a file is saved, but a way to "un-save" a file is to use undo, and there's no special notification that helps figuring out the file is not unsaved anymore as far as I can see. So one might have to take the current file content and compare it with the one on disk. Unclear whether this is best done on the server TS code or on the binary commands. |
I guess we'll need to check every file that might be affected by rename, and bail the rename if either of those is unsaved. I think we'll need to mull on this a bit more before going forward. |
It looks like the rename happens based on the last known location for a token. This means that if you create a syntax error in your script and try to rename something, the location of the tokens may be outdated and the new name is inserted in the wrong position.
Video is attached that shows this happening. The syntax error in this case is an unbalanced piece of JSX.
Screen.Recording.2022-05-12.at.11.43.31.mov
The text was updated successfully, but these errors were encountered: