Changes to discover and perform azdata update (#11906)

* WIP

* first version with working tests

* fixes needed after merge from main

* Linux untest changes and merge from other changes from mac

* after testing getTextContent

* rename 2 methods

* linux discovery

* tested code on linux

* using release.json for update discovery on linux

* comment added

* dead code removed

* coomments

* revert unrelated change

* revert testing changes

* PR feedback

* remove SendOutputChannelToConsole

* cleanup

* pr feedback

* PR Feedback

* pr feedback

* pr feedback

* merge from main

* merge from main

* cleanup and pr feedback

* pr feedback

* pr feedback.

* pr feedback

Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
Arvind Ranasaria
2020-08-27 13:25:54 -07:00
committed by GitHub
parent b715e6ed82
commit 00c7600b05
10 changed files with 521 additions and 148 deletions

View File

@@ -4,13 +4,20 @@
*--------------------------------------------------------------------------------------------*/
import * as azdataExt from 'azdata-ext';
import { findAzdata, IAzdataTool } from './azdata';
import * as vscode from 'vscode';
import { checkAndUpgradeAzdata, findAzdata, IAzdataTool } from './azdata';
import * as loc from './localizedConstants';
let localAzdata: IAzdataTool | undefined = undefined;
export async function activate(): Promise<azdataExt.IExtension> {
localAzdata = await checkForAzdata();
// Don't block on this since we want the extension to finish activating without needing user input
checkAndUpgradeAzdata(localAzdata)
.then(async () => {
localAzdata = await findAzdata(); // now again find and return the currently installed azdata
})
.catch(err => vscode.window.showWarningMessage(loc.updateError(err))); //update if available and user wants it.
return {
azdata: {
arc: {
@@ -85,11 +92,11 @@ function throwIfNoAzdata(): void {
async function checkForAzdata(): Promise<IAzdataTool | undefined> {
try {
return await findAzdata();
return await findAzdata(); // find currently installed Azdata
} 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().catch(e => console.log(`Unexpected error prompting to install azdata ${e}`));
await promptToInstallAzdata().catch(e => console.log(`Unexpected error prompting to install azdata ${e}`));
}
return undefined;
}