Skip to content

Commit 8e5754b

Browse files
authored
refactor: [LCAP-2593] display a progress notification while selecting task view opened (#177)
1 parent f6d1296 commit 8e5754b

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

‎packages/tasks_panel/src/commands/create-task.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { window } from "vscode";
1+
import { ProgressLocation, window } from "vscode";
22
import { ITasksProvider } from "../services/definitions";
33
import { messages } from "../i18n/messages";
44
import {
@@ -35,7 +35,14 @@ export async function createTask(
3535

3636
await disposeTaskSelectionPanel();
3737

38-
return openViewForAutoDetectedTaskSelection(tasksProvider, readResource);
38+
// display progress, it might take a while
39+
return window.withProgress(
40+
{
41+
location: ProgressLocation.Notification,
42+
title: messages.OPENING_SELECTION_VIEW,
43+
},
44+
() => openViewForAutoDetectedTaskSelection(tasksProvider, readResource)
45+
);
3946
}
4047

4148
async function openViewForAutoDetectedTaskSelection(

‎packages/tasks_panel/src/i18n/messages.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ export const messages = {
4040
SWA_EDIT_TASK_EVENT: (): string => `Edit`,
4141
SWA_TASK_EXPLORER_PARAM: (): string => `Explorer`,
4242
SWA_TASK_EDITOR_PARAM: (): string => `Editor`,
43+
OPENING_SELECTION_VIEW: `Collecting the tasks...`,
4344
};

‎packages/tasks_panel/test/utils/mockVSCode.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,20 @@ export const testVscode: any = {
136136
showErrorMessage: async (msg: string): Promise<void> => {
137137
MockVSCodeInfo.errorMsg = msg;
138138
},
139+
withProgress: (
140+
options: {
141+
location: number;
142+
title: string;
143+
},
144+
task: (progress: any, token: any) => Promise<any>
145+
) => Promise.resolve(task({}, {})),
139146
},
140147
ViewColumn: {
141148
One: 1,
142149
},
150+
ProgressLocation: {
151+
Notification: 15,
152+
},
143153
ExtensionContext: { extensionPath: "path" },
144154
TreeItem: class {},
145155
EventEmitter: class {

0 commit comments

Comments
 (0)