Add static logger class for azdata extension (#11939)

* Add static logger class for arc extension

* Fix compile errors

* Fix test
This commit is contained in:
Charles Gagnon
2020-08-24 12:32:45 -07:00
committed by GitHub
parent d96e83c3f0
commit 0e4e8c304c
8 changed files with 109 additions and 109 deletions

View File

@@ -4,15 +4,13 @@
*--------------------------------------------------------------------------------------------*/
import * as azdataExt from 'azdata-ext';
import * as vscode from 'vscode';
import { findAzdata, IAzdataTool } from './azdata';
import * as loc from './localizedConstants';
let localAzdata: IAzdataTool | undefined = undefined;
export async function activate(): Promise<azdataExt.IExtension> {
const outputChannel = vscode.window.createOutputChannel('azdata');
localAzdata = await checkForAzdata(outputChannel);
localAzdata = await checkForAzdata();
return {
azdata: {
arc: {
@@ -85,24 +83,24 @@ function throwIfNoAzdata(): void {
}
}
async function checkForAzdata(outputChannel: vscode.OutputChannel): Promise<IAzdataTool | undefined> {
async function checkForAzdata(): Promise<IAzdataTool | undefined> {
try {
return await findAzdata(outputChannel);
return await findAzdata();
} catch (err) {
// Don't block on this since we want the extension to finish activating without needing user input.
// Calls will be made to handle azdata not being installed
promptToInstallAzdata(outputChannel).catch(e => console.log(`Unexpected error prompting to install azdata ${e}`));
promptToInstallAzdata().catch(e => console.log(`Unexpected error prompting to install azdata ${e}`));
}
return undefined;
}
async function promptToInstallAzdata(_outputChannel: vscode.OutputChannel): Promise<void> {
async function promptToInstallAzdata(): Promise<void> {
//TODO: Figure out better way to display/prompt
/*
const response = await vscode.window.showErrorMessage(loc.couldNotFindAzdataWithPrompt, loc.install, loc.cancel);
if (response === loc.install) {
try {
await downloadAndInstallAzdata(outputChannel);
await downloadAndInstallAzdata();
vscode.window.showInformationMessage(loc.azdataInstalled);
} catch (err) {
// Windows: 1602 is User Cancelling installation - not unexpected so don't display