Verbose output for autorest, displaying output pane on error (#17308)

This commit is contained in:
Benjin Dubishar
2021-10-14 15:22:53 -07:00
committed by GitHub
parent 49b5630b54
commit 69128c0689
4 changed files with 4 additions and 3 deletions

View File

@@ -425,7 +425,7 @@ export const autorestPostDeploymentScriptName = 'PostDeploymentScript.sql';
export const nodeButNotAutorestFound = localize('nodeButNotAutorestFound', "Autorest tool not found in system path, but found Node.js. Running via npx. Please execute 'npm install autorest -g' to install permanently.");
export const nodeNotFound = localize('nodeNotFound', "Neither autorest nor Node.js (npx) found in system path. Please install Node.js for autorest generation to work.");
export const selectSpecFile = localize('selectSpecFile', "Select OpenAPI/Swagger spec file");
export function generatingProjectFailed(errorMessage: string) { return localize('generatingProjectFailed', "Generating project via AutoRest failed: {0}", errorMessage); }
export function generatingProjectFailed(errorMessage: string) { return localize('generatingProjectFailed', "Generating project via AutoRest failed. Check output pane for more details. Error: {0}", errorMessage); }
export function multipleMostDeploymentScripts(count: number) { return localize('multipleMostDeploymentScripts', "Unexpected number of {0} files: {1}", autorestPostDeploymentScriptName, count); }
export const specSelectionText = localize('specSelectionText', "OpenAPI/Swagger spec");

View File

@@ -967,6 +967,7 @@ export class ProjectsController {
return project;
} catch (err) {
void vscode.window.showErrorMessage(constants.generatingProjectFailed(utils.getErrorMessage(err)));
this._outputChannel.show();
return;
}
}

View File

@@ -47,7 +47,7 @@ describe('Autorest tests', function (): void {
});
it('Should construct a correct autorest command for project generation', async function (): Promise<void> {
const expectedOutput = 'autorest --use:autorest-sql-testing@latest --input-file="/some/path/test.yaml" --output-folder="/some/output/path" --clear-output-folder';
const expectedOutput = 'autorest --use:autorest-sql-testing@latest --input-file="/some/path/test.yaml" --output-folder="/some/output/path" --clear-output-folder --verbose';
const autorestHelper = new AutorestHelper(testContext.outputChannel);
const constructedCommand = autorestHelper.constructAutorestCommand((await autorestHelper.detectInstallation())!, '/some/path/test.yaml', '/some/output/path');

View File

@@ -101,6 +101,6 @@ export class AutorestHelper extends ShellExecutionHelper {
*/
public constructAutorestCommand(executable: string, specPath: string, outputFolder: string): string {
// TODO: should --clear-output-folder be included? We should always be writing to a folder created just for this, but potentially risky
return `${executable} --use:${autorestPackageName}@${this.autorestSqlPackageVersion} --input-file="${specPath}" --output-folder="${outputFolder}" --clear-output-folder`;
return `${executable} --use:${autorestPackageName}@${this.autorestSqlPackageVersion} --input-file="${specPath}" --output-folder="${outputFolder}" --clear-output-folder --verbose`;
}
}