Skip to content

Commit 5f608b0

Browse files
authored
Show build preparing status immediately (#1327)
* Show build preparing status immediately Previously we were waiting for output from the build, which could be several seconds. Issue: #1323 * Fixup test
1 parent d88a5c8 commit 5f608b0

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/ui/SwiftBuildStatus.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,17 @@ export class SwiftBuildStatus implements vscode.Disposable {
136136
return false;
137137
}
138138
}
139-
// If we've found nothing that matches a known state then put up a temporary
140-
// message that we're preparing the build, as there is sometimes a delay before
141-
// building starts while the build system is preparing, especially in large projects.
142-
// The status bar has a message immediately, so only show this when using a
143-
// notification to show progress.
144-
if (
145-
!started &&
146-
(showBuildStatus === "notification" || showBuildStatus === "progress")
147-
) {
148-
update(`${name}: Preparing...`);
149-
}
150139
return false;
151140
};
152141

142+
// Begin by showing a message that the build is preparing, as there is sometimes
143+
// a delay before building starts, especially in large projects.
144+
// The status bar has a message immediately, so only show this when using a
145+
// notification to show progress.
146+
if (!started && (showBuildStatus === "notification" || showBuildStatus === "progress")) {
147+
update(`${name}: Preparing...`);
148+
}
149+
153150
return execution.onDidWrite(data => {
154151
if (parseEvents(data)) {
155152
done();

test/unit-tests/ui/SwiftBuildStatus.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,7 @@ suite("SwiftBuildStatus Unit Test Suite", async function () {
215215
"Build complete!"
216216
);
217217

218-
// Report nothing
219-
expect(mockedProgress.report).to.not.have.been.called;
220-
expect(mockedStatusItem.update).to.not.have.been.called;
218+
// Report only the preparing message
219+
expect(mockedProgress.report).to.have.been.calledWith({ message: "My Task: Preparing..." });
221220
});
222221
});

0 commit comments

Comments
 (0)