Add debug config option to azdata extension (#11999)

This commit is contained in:
Charles Gagnon
2020-08-28 07:04:47 -07:00
committed by GitHub
parent e9c5a6dfbd
commit 4789f2165b
5 changed files with 29 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -19,6 +19,19 @@
"url": "https://github.com/Microsoft/azuredatastudio.git"
},
"main": "./out/extension",
"contributes": {
"configuration": {
"type": "object",
"title": "%azdata.config.title%",
"properties": {
"azdata.logDebugInfo": {
"type": "boolean",
"default": false,
"description": "%azdata.config.debug%"
}
}
}
},
"dependencies": {
"request": "^2.88.2",
"semver": "^7.3.2",

View File

@@ -1,4 +1,6 @@
{
"azdata.displayName": "azdata",
"azdata.description": "Support for Azure Data CLI. See https://docs.microsoft.com/cli/azure/?view=azure-cli-latest for more information."
"azdata.description": "Support for Azure Data CLI. See https://docs.microsoft.com/cli/azure/?view=azure-cli-latest for more information.",
"azdata.config.title": "azdata Configuration",
"azdata.config.debug": "Log debug info to the output channel for all executed azdata commands"
}

View File

@@ -12,6 +12,7 @@ import { HttpClient } from './common/httpClient';
import Logger from './common/logger';
import { getErrorMessage, searchForCmd } from './common/utils';
import * as loc from './localizedConstants';
import { azdataConfigSection, debugConfigKey } from './constants';
export const azdataHostname = 'https://aka.ms';
export const azdataUri = 'azdata-msi';
@@ -118,6 +119,10 @@ export class AzdataTool implements IAzdataTool {
}
public async executeCommand<R>(args: string[], additionalEnvVars?: { [key: string]: string }): Promise<azdataExt.AzdataOutput<R>> {
const debug = vscode.workspace.getConfiguration(azdataConfigSection).get(debugConfigKey);
if (debug) {
args.push('--debug');
}
try {
const output = JSON.parse((await executeCommand(`"${this.path}"`, args.concat(['--output', 'json']), additionalEnvVars)).stdout);
return {

View File

@@ -0,0 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export const azdataConfigSection = 'azdata';
export const debugConfigKey = 'logDebugInfo';