Fixes issues with SQL Bindings vscode dev (#18695)

* fixes issues with vscode development
This commit is contained in:
Vasu Bhog
2022-03-10 15:37:23 -08:00
committed by GitHub
parent 364684c79e
commit f424bea0de
3 changed files with 17 additions and 4 deletions

View File

@@ -2,14 +2,13 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import AdsTelemetryReporter from '@microsoft/ads-extension-telemetry';
import { getPackageInfo } from './utils';
const packageInfo = vscode.extensions.getExtension('Microsoft.sql-bindings')?.packageJSON;
const packageInfo = getPackageInfo()!;
export const TelemetryReporter = new AdsTelemetryReporter(packageInfo.name, packageInfo.version, packageInfo.aiKey);
export enum TelemetryViews {
SqlBindingsQuickPick = 'SqlBindingsQuickPick'
}

View File

@@ -108,3 +108,17 @@ export async function getAllProjectsInFolder(folder: vscode.Uri, projectExtensio
// glob will return an array of file paths with forward slashes, so they need to be converted back if on windows
return (await glob(projFilter)).map(p => vscode.Uri.file(path.resolve(p)));
}
/**
* Gets the package info for the extension based on where the extension is installed
* @returns the package info object
*/
export function getPackageInfo(): IPackageInfo {
const packageJson = require('../../package.json');
return {
name: packageJson.name,
fullName: `${packageJson.publisher}.${packageJson.name}`,
version: packageJson.version,
aiKey: packageJson.aiKey
};
}

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { getAzdataApi } from './common/utils';
import { launchAddSqlBindingQuickpick } from '../src/dialogs/addSqlBindingQuickpick';
import { launchAddSqlBindingQuickpick } from './dialogs/addSqlBindingQuickpick';
export function activate(context: vscode.ExtensionContext): void {
void vscode.commands.executeCommand('setContext', 'azdataAvailable', !!getAzdataApi());