Skip to content

Commit 000587c

Browse files
committed
Hardcode --format=markdown option
1 parent df45d81 commit 000587c

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

extensions/ql-vscode/src/cli.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,13 +620,12 @@ export class CodeQLCliServer implements Disposable {
620620
* @param format The format in which the query help should be generated {@link https://codeql.github.com/docs/codeql-cli/manual/generate-query-help/#cmdoption-codeql-generate-query-help-format}
621621
* @param outputDirectory The output directory for the generated file
622622
*/
623-
async generateQueryHelp(pathToQhelp:string, format: string, outputDirectory?: string): Promise<string> {
624-
const subcommandArgs = [];
625-
subcommandArgs.push('--format', format);
623+
async generateQueryHelp(pathToQhelp:string, outputDirectory?: string): Promise<string> {
624+
const subcommandArgs = ['--format=markdown'];
626625
if(outputDirectory) subcommandArgs.push('--output', outputDirectory);
627626
subcommandArgs.push(pathToQhelp);
628627

629-
return await this.runCodeQlCliCommand(['generate', 'query-help'], subcommandArgs, `Generating qhelp in ${format} format at ${outputDirectory}`);
628+
return await this.runCodeQlCliCommand(['generate', 'query-help'], subcommandArgs, `Generating qhelp in markdown format at ${outputDirectory}`);
630629
}
631630

632631
/**

extensions/ql-vscode/src/extension.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -497,19 +497,19 @@ async function activateWithInstalledDistribution(
497497
async function previewQueryHelp(
498498
selectedQuery: Uri
499499
): Promise<void> {
500-
const path = selectedQuery ? selectedQuery.path : window.activeTextEditor!.document.uri.fsPath;
501-
if(path) {
500+
const pathToQhelp = selectedQuery ? selectedQuery.path : window.activeTextEditor!.document.uri.fsPath;
501+
if(pathToQhelp) {
502502
// Create temporary directory
503503
const tmpDir = tmp.dirSync();
504-
const relativePathToMd = path.basename(path, '.qhelp') + '.md'
505-
const absolutePathToMd = path.join(tmpDir.name, relativePathToMd)`;
504+
const relativePathToMd = path.basename(pathToQhelp, '.qhelp') + '.md';
505+
const absolutePathToMd = path.join(tmpDir.name, relativePathToMd);
506506
const uri = Uri.file(absolutePathToMd);
507507
try {
508-
await cliServer.generateQueryHelp(path , 'markdown', absolutePathToMd);
508+
await cliServer.generateQueryHelp(pathToQhelp , absolutePathToMd);
509509
await commands.executeCommand('markdown.showPreviewToSide', uri);
510510
} catch (err) {
511511
const errorMessage = err.message.includes('Generating qhelp in markdown') ? (
512-
`Could not generate markdown from ${path}: Bad formatting in .qhelp file.`
512+
`Could not generate markdown from ${pathToQhelp}: Bad formatting in .qhelp file.`
513513
) : `Could not open a preview of the generated file (${absolutePathToMd}).`;
514514
void helpers.showAndLogErrorMessage(errorMessage);
515515
}

0 commit comments

Comments
 (0)