-
Notifications
You must be signed in to change notification settings - Fork 746
fix(lambda): Updates for Lambda quick edit #7656
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
Conversation
|
| } | ||
|
|
||
| // Delete all files in the directory | ||
| await deleteFilesInFolder(workspacePath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this confirm deleted all data in folder but didn't download anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we want to clear the folder so that next time we try to open the code, editLambda knows it needs to redownload the freshest code.
This PR contains updates for miscellaneous features related to the new Lambda quick edit.
Handling of empty directories
Problem
Previously, having an empty directory in the Lambda quick edit flow led to errors when trying to view the function code in the explorer or in a workspace. An empty folder could be the result of an error during download. The unintended bug in the code was related to how we were checking for existence of a function saved locally.
Solution
Check if there are any files in the directory before determining if it exists locally. If the directory is empty, we must redownload the code (a Lambda function cannot be empty, so we know it is unintended)
README updates
Problem
Solution
markdown.showPreviewToSideQuick Edit Flow updates
Problem
Solution
All of this is fixed by moving things around so that there is never any code downloaded during activation. This is beneficial because it keeps us from doing a lot of our main functionality on activation.
Previously, opening a function in a workspace, which could be done through a URI handler or from the explorer, would cause the extension to restart. Once the extension restarted, at that point we would download the code and start the watchers. These changes download the code first, and only start the watchers on activation. Because the user doesn't need to be authenticated to start the watchers (only to deploy), this is not an issue for being authenticated. If it's a workspace folder, we're assuming the function exists locally, so that's why we know we've downloaded the code already.
The only edge case is if the local code is out of sync with what's in the cloud; in this case, we prompt the user to overwrite their code, but they need to go to the explorer to manually download it to avoid the activation race conditions.
feature/xbranches will not be squash-merged at release time.