Skip to content

Commit 43d8927

Browse files
authored
Don't block waiting for debug configurations (#1914)
When a folder is added to the workspace context we were awaiting the `makeDebugConfigurations` method. This method generates launch configurations in the launch.json. If the method finds it needs to update existing launch configurations, it puts of a warning message dialog prompting the user for action. Because we were awaiting this method, the dialog blocks folder addition and in turn prevents sourcekit-lsp and other extension features from activating for the folder until the dialog is dismissed. Because nothing relies on the result of `makeDebugConfigurations`, simply kick off the work but don't await it. Issue: #1912
1 parent 1231fa8 commit 43d8927

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/extension.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,17 +217,19 @@ function handleFolderEvent(logger: SwiftLogger): (event: FolderEvent) => Promise
217217

218218
switch (operation) {
219219
case FolderOperation.add:
220-
// Create launch.json files based on package description.
221-
await debug.makeDebugConfigurations(folder);
220+
// Create launch.json files based on package description, don't block execution.
221+
void debug.makeDebugConfigurations(folder);
222+
222223
if (await folder.swiftPackage.foundPackage) {
223224
// do not await for this, let packages resolve in parallel
224225
void folderAdded(folder, workspace);
225226
}
226227
break;
227228

228229
case FolderOperation.packageUpdated:
229-
// Create launch.json files based on package description.
230-
await debug.makeDebugConfigurations(folder);
230+
// Create launch.json files based on package description, don't block execution.
231+
void debug.makeDebugConfigurations(folder);
232+
231233
if (
232234
(await folder.swiftPackage.foundPackage) &&
233235
!configuration.folder(folder.workspaceFolder).disableAutoResolve

0 commit comments

Comments
 (0)