Remove awaits that were blocking data workspace extension from loading (#15904)

* remove awaits that were blocking data workspace extension from loading

* add comment

* remove await and use then

* use return instead of await

* add notification when there's an error
This commit is contained in:
Kim Santiago
2021-06-25 15:46:28 -07:00
committed by GitHub
parent ff1a642157
commit edc319a90c

View File

@@ -18,10 +18,18 @@ import { createNewProjectWithQuickpick } from './dialogs/newProjectQuickpick';
export async function activate(context: vscode.ExtensionContext): Promise<IExtension> {
const workspaceService = new WorkspaceService(context);
await workspaceService.loadTempProjects();
workspaceService.checkForProjectsNotAddedToWorkspace();
context.subscriptions.push(vscode.workspace.onDidChangeWorkspaceFolders(async () => {
await workspaceService.checkForProjectsNotAddedToWorkspace();
// this is not being awaited to not block the rest of activate function from running while loading any temp projects and
// checking for projects not added to the workspace yet
workspaceService.loadTempProjects().then(() => {
return workspaceService.checkForProjectsNotAddedToWorkspace();
}).catch(error => {
console.error(error);
vscode.window.showErrorMessage(error instanceof Error ? error.message : error);
});
context.subscriptions.push(vscode.workspace.onDidChangeWorkspaceFolders(() => {
workspaceService.checkForProjectsNotAddedToWorkspace();
}));
const workspaceTreeDataProvider = new WorkspaceTreeDataProvider(workspaceService);