Fix sql database projects vscode telemetry (#19645) (#19661)

* fix the wrong extension name getting sent for sql database projects vscode extension

* bump version

* remove print statements

* clean up comment
This commit is contained in:
Kim Santiago
2022-06-07 18:26:26 -07:00
committed by GitHub
parent d314ea393e
commit 7eac18f7a0
2 changed files with 18 additions and 9 deletions

View File

@@ -2,7 +2,7 @@
"name": "sql-database-projects", "name": "sql-database-projects",
"displayName": "SQL Database Projects", "displayName": "SQL Database Projects",
"description": "Enables users to develop and publish database schemas for MSSQL Databases", "description": "Enables users to develop and publish database schemas for MSSQL Databases",
"version": "0.17.0", "version": "0.17.1",
"publisher": "Microsoft", "publisher": "Microsoft",
"preview": true, "preview": true,
"engines": { "engines": {

View File

@@ -352,16 +352,25 @@ export function getPackageInfo(packageJson?: any): IPackageInfo | undefined {
packageJson = require('../../package.json'); packageJson = require('../../package.json');
} }
if (packageJson) { const vscodePackageJson = require('../../package.vscode.json');
return { const azdataApi = getAzdataApi();
name: packageJson.name,
fullName: `${packageJson.publisher}.${packageJson.name}`, if (!packageJson || !azdataApi && !vscodePackageJson) {
version: packageJson.version, return undefined;
aiKey: packageJson.aiKey
};
} }
return undefined; // When the extension is compiled and packaged, the content of package.json get copied here in the extension.js. This happens before the
// package.vscode.json values replace the corresponding values in the package.json for the sql-database-projects-vscode extension
// so we need to read these values directly from the package.vscode.json to get the correct extension and publisher names
const extensionName = azdataApi ? packageJson.name : vscodePackageJson.name;
const publisher = azdataApi ? packageJson.publisher : vscodePackageJson.publisher;
return {
name: extensionName,
fullName: `${publisher}.${extensionName}`,
version: packageJson.version,
aiKey: packageJson.aiKey
};
} }
/** /**