Skip to content

Commit 30ce5ad

Browse files
committed
fix: Make quickEditActivation non-blocking
1 parent a30b10a commit 30ce5ad

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

packages/core/src/lambda/activation.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,23 @@ async function quickEditActivation() {
112112
// Delete all files in the directory
113113
await deleteFilesInFolder(workspacePath)
114114

115-
// Remove workspace folder
116-
const workspaceIndex = vscode.workspace.workspaceFolders?.findIndex(
117-
(folder) => folder.uri.fsPath.toLowerCase() === workspacePath
118-
)
119-
if (workspaceIndex !== undefined && workspaceIndex >= 0) {
120-
vscode.workspace.updateWorkspaceFolders(workspaceIndex, 1)
121-
}
122-
123-
await setFunctionInfo(lambda, { undeployed: false })
124-
125115
// Show message to user about next steps
126116
void vscode.window.showInformationMessage(
127117
localize(
128118
'AWS.lambda.refresh.complete',
129119
'Local workspace cleared. Navigate to the Toolkit explorer to get fresh code from the cloud.'
130120
)
131121
)
122+
123+
await setFunctionInfo(lambda, { undeployed: false })
124+
125+
// Remove workspace folder
126+
const workspaceIndex = vscode.workspace.workspaceFolders?.findIndex(
127+
(folder) => folder.uri.fsPath.toLowerCase() === workspacePath
128+
)
129+
if (workspaceIndex !== undefined && workspaceIndex >= 0) {
130+
vscode.workspace.updateWorkspaceFolders(workspaceIndex, 1)
131+
}
132132
}
133133
} catch (e) {
134134
void vscode.window.showWarningMessage(
@@ -147,7 +147,7 @@ async function quickEditActivation() {
147147
* Activates Lambda components.
148148
*/
149149
export async function activate(context: ExtContext): Promise<void> {
150-
await quickEditActivation()
150+
void quickEditActivation()
151151

152152
context.extensionContext.subscriptions.push(
153153
Commands.register('aws.deleteLambda', async (node: LambdaFunctionNode | TreeNode) => {

packages/core/src/lambda/commands/editLambda.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,17 @@ export function watchForUpdates(lambda: LambdaFunction, projectUri: vscode.Uri):
4747
})
4848

4949
watcher.onDidDelete(async (fileUri) => {
50-
// We don't want to sync if the whole directory has been deleted
50+
// We don't want to sync if the whole directory has been deleted or emptied
5151
if (fileUri.fsPath !== projectUri.fsPath) {
52-
await promptForSync(lambda, projectUri, fileUri)
52+
// Check if directory is empty before prompting for sync
53+
try {
54+
const entries = await fs.readdir(projectUri.fsPath)
55+
if (entries.length > 0) {
56+
await promptForSync(lambda, projectUri, fileUri)
57+
}
58+
} catch (err) {
59+
getLogger().debug(`Failed to check Lambda directory contents: ${err}`)
60+
}
5361
}
5462
})
5563
}

0 commit comments

Comments
 (0)