mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 09:35:37 -05:00
Correcting log messages during autorest execution selection (#17434)
* Correcting log messages during autorest execution choice * Combining redundant strings * Correcting icon + loc * Fixing typo
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { DoNotAskAgain, Install, nodeButNotAutorestFound, nodeNotFound, nodeButNotAutorestFoundPrompt, runViaNpx, installGlobally } from '../common/constants';
|
||||
import * as constants from '../common/constants';
|
||||
import * as utils from '../common/utils';
|
||||
import * as semver from 'semver';
|
||||
import { DBProjectConfigurationKey } from './netcoreTool';
|
||||
@@ -45,19 +45,24 @@ export class AutorestHelper extends ShellExecutionHelper {
|
||||
if (await utils.detectCommandInstallation(autorestCommand)) {
|
||||
return autorestCommand;
|
||||
}
|
||||
else if (await utils.detectCommandInstallation(npxCommand)) {
|
||||
this._outputChannel.appendLine(constants.nodeButNotAutorestFound);
|
||||
const response = await vscode.window.showInformationMessage(constants.nodeButNotAutorestFoundPrompt, constants.installGlobally, constants.runViaNpx);
|
||||
|
||||
if (await utils.detectCommandInstallation(npxCommand)) {
|
||||
this._outputChannel.appendLine(nodeButNotAutorestFound);
|
||||
|
||||
const response = await vscode.window.showInformationMessage(nodeButNotAutorestFoundPrompt, installGlobally, runViaNpx);
|
||||
|
||||
if (response === installGlobally) {
|
||||
if (response === constants.installGlobally) {
|
||||
this._outputChannel.appendLine(constants.userSelectionInstallGlobally);
|
||||
await this.runStreamedCommand('npm install autorest -g', this._outputChannel);
|
||||
return autorestCommand;
|
||||
} else if (response === runViaNpx) {
|
||||
} else if (response === constants.runViaNpx) {
|
||||
this._outputChannel.appendLine(constants.userSelectionRunNpx);
|
||||
return `${npxCommand} ${autorestCommand}`;
|
||||
} else {
|
||||
this._outputChannel.appendLine(constants.userSelectionCancelled);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this._outputChannel.appendLine(constants.nodeNotFound);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
@@ -75,18 +80,17 @@ export class AutorestHelper extends ShellExecutionHelper {
|
||||
// unable to find autorest or npx
|
||||
|
||||
if (vscode.workspace.getConfiguration(DBProjectConfigurationKey)[nodejsDoNotAskAgainKey] !== true) {
|
||||
this._outputChannel.appendLine(nodeNotFound);
|
||||
return; // user doesn't want to be prompted about installing it
|
||||
}
|
||||
|
||||
// prompt user to install Node.js
|
||||
const result = await vscode.window.showErrorMessage(nodeNotFound, DoNotAskAgain, Install);
|
||||
const result = await vscode.window.showErrorMessage(constants.nodeNotFound, constants.DoNotAskAgain, constants.Install);
|
||||
|
||||
if (result === Install) {
|
||||
if (result === constants.Install) {
|
||||
//open install link
|
||||
const nodejsInstallationUrl = 'https://nodejs.dev/download';
|
||||
await vscode.env.openExternal(vscode.Uri.parse(nodejsInstallationUrl));
|
||||
} else if (result === DoNotAskAgain) {
|
||||
} else if (result === constants.DoNotAskAgain) {
|
||||
const config = vscode.workspace.getConfiguration(DBProjectConfigurationKey);
|
||||
await config.update(nodejsDoNotAskAgainKey, true, vscode.ConfigurationTarget.Global);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user