Skip to content

Commit 8f716b4

Browse files
committed
Address review comments
1 parent 102bda2 commit 8f716b4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

extensions/ql-vscode/src/quick-query.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,18 @@ async function getQlPackFor(cliServer: CodeQLCliServer, dbschemePath: string): P
4545
}
4646

4747
/**
48-
* `getBaseText` heuristically returns an appropriate import
49-
* statement prelude based on the filename of the dbscheme file
50-
* given. This information might be more appropriately provided by
51-
* the qlpack itself.
48+
* `getBaseText` heuristically returns an appropriate import statement
49+
* prelude based on the filename of the dbscheme file given. TODO: add
50+
* a 'default import' field to the qlpack itself, and use that.
5251
*/
5352
function getBaseText(dbschemeBase: string) {
5453
if (dbschemeBase == 'semmlecode.javascript.dbscheme') return 'import javascript\n\nselect ""';
5554
if (dbschemeBase == 'semmlecode.cpp.dbscheme') return 'import cpp\n\nselect ""';
56-
if (dbschemeBase == 'semmlecode.java.dbscheme') return 'import java\n\nselect ""';
55+
if (dbschemeBase == 'semmlecode.dbscheme') return 'import java\n\nselect ""';
5756
if (dbschemeBase == 'semmlecode.python.dbscheme') return 'import python\n\nselect ""';
58-
return '';
57+
if (dbschemeBase == 'semmlecode.csharp.dbscheme') return 'import csharp\n\nselect ""';
58+
if (dbschemeBase == 'go.dbscheme') return 'import go\n\nselect ""';
59+
return 'select ""';
5960
}
6061

6162
async function getQuickQueriesDir(ctx: ExtensionContext): Promise<string> {
@@ -108,9 +109,10 @@ export async function displayQuickQuery(ctx: ExtensionContext, cliServer: CodeQL
108109
throw new Error(`Can't find dbscheme for current database in ${datasetFolder}`);
109110
}
110111

112+
dbschemes.sort();
111113
const dbscheme = dbschemes[0];
112114
if (dbschemes.length > 1) {
113-
logger.log(`Found multiple dbschemes in ${datasetFolder}; arbitrarily choosing the first, ${dbscheme}`);
115+
Window.showErrorMessage(`Found multiple dbschemes in ${datasetFolder} during quick query; arbitrarily choosing the first, ${dbscheme}, to decide what library to use.`);
114116
}
115117

116118
const qlpack = await getQlPackFor(cliServer, dbscheme);

0 commit comments

Comments
 (0)