Load all data workspace projects directly from workspace (#15921)

* Load all projects directly from workspace

* fixes

* Remove relativity and fix tests

* fix compile

* PR comments

* remove unused

* distro
This commit is contained in:
Charles Gagnon
2021-06-30 10:58:34 -07:00
committed by GitHub
parent 66c1fdc457
commit 7ce791d826
30 changed files with 124 additions and 1113 deletions

View File

@@ -17,22 +17,12 @@ import { getAzdataApi } from './common/utils';
import { createNewProjectWithQuickpick } from './dialogs/newProjectQuickpick';
export async function activate(context: vscode.ExtensionContext): Promise<IExtension> {
const workspaceService = new WorkspaceService(context);
// 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 workspaceService = new WorkspaceService();
const workspaceTreeDataProvider = new WorkspaceTreeDataProvider(workspaceService);
context.subscriptions.push(vscode.workspace.onDidChangeWorkspaceFolders(() => {
workspaceTreeDataProvider.refresh();
}));
const dataWorkspaceExtension = new DataWorkspaceExtension(workspaceService);
context.subscriptions.push(vscode.window.registerTreeDataProvider('dataworkspace.views.main', workspaceTreeDataProvider));
context.subscriptions.push(vscode.extensions.onDidChange(() => {
@@ -51,7 +41,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<IExten
}));
context.subscriptions.push(vscode.commands.registerCommand('projects.openExisting', async () => {
const dialog = new OpenExistingDialog(workspaceService, context);
const dialog = new OpenExistingDialog(workspaceService);
await dialog.open();
}));
@@ -64,9 +54,6 @@ export async function activate(context: vscode.ExtensionContext): Promise<IExten
vscode.commands.executeCommand('workbench.action.closeFolder');
}));
context.subscriptions.push(vscode.commands.registerCommand('projects.removeProject', async (treeItem: WorkspaceTreeItem) => {
await workspaceService.removeProject(vscode.Uri.file(treeItem.element.project.projectFilePath));
}));
context.subscriptions.push(vscode.commands.registerCommand('projects.manageProject', async (treeItem: WorkspaceTreeItem) => {
const dashboard = new ProjectDashboard(workspaceService, treeItem);
await dashboard.showDashboard();