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

@@ -4,9 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import AdsTelemetryReporter from '@microsoft/ads-extension-telemetry';
import * as path from 'path';
import * as utils from './utils';
import * as vscode from 'vscode';
const packageJson = require('../../package.json');
@@ -14,28 +12,6 @@ let packageInfo = utils.getPackageInfo(packageJson)!;
export const TelemetryReporter = new AdsTelemetryReporter(packageInfo.name, packageInfo.version, packageInfo.aiKey);
export function calculateRelativity(projectPath: string, workspacePath?: string): string {
workspacePath = workspacePath ?? vscode.workspace.workspaceFile?.fsPath;
if (!workspacePath) {
return 'noWorkspace';
}
const relativePath = path.relative(path.dirname(projectPath), path.dirname(workspacePath));
if (relativePath.length === 0) { // no path difference
return 'sameFolder';
}
const pathParts = relativePath.split(path.sep);
if (pathParts.every(x => x === '..')) {
return 'directAncestor';
}
return 'other'; // sibling, cousin, descendant, etc.
}
export enum TelemetryViews {
WorkspaceTreePane = 'WorkspaceTreePane',