Skip to content

Commit f486ccf

Browse files
authored
Merge pull request #1418 from github/aeisenberg/resolve-ml-libs
Resolve ml-queries from directory
2 parents ebad184 + 70f74d3 commit f486ccf

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

extensions/ql-vscode/src/cli.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,8 @@ export class CodeQLCliServer implements Disposable {
606606
/** Resolves the ML models that should be available when evaluating a query. */
607607
async resolveMlModels(additionalPacks: string[], queryPath: string): Promise<MlModelsInfo> {
608608
const args = await this.cliConstraints.supportsPreciseResolveMlModels()
609-
? [...this.getAdditionalPacksArg(additionalPacks), queryPath]
609+
// use the dirname of the path so that we can handle query libraries
610+
? [...this.getAdditionalPacksArg(additionalPacks), path.dirname(queryPath)]
610611
: this.getAdditionalPacksArg(additionalPacks);
611612
return await this.runJsonCodeQlCliCommand<MlModelsInfo>(
612613
['resolve', 'ml-models'],

extensions/ql-vscode/src/run-queries.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,7 @@ export async function compileAndRunQueryAgainstDatabase(
789789
const metadata = await tryGetQueryMetadata(cliServer, qlProgram.queryPath);
790790

791791
let availableMlModels: cli.MlModelInfo[] = [];
792-
if (!initialInfo.queryPath.endsWith('.ql')) {
793-
void logger.log('Quick evaluation within a query library does not currently support using ML models. Continuing without any ML models.');
794-
} else if (!await cliServer.cliConstraints.supportsResolveMlModels()) {
792+
if (!await cliServer.cliConstraints.supportsResolveMlModels()) {
795793
void logger.log('Resolving ML models is unsupported by this version of the CLI. Running the query without any ML models.');
796794
} else {
797795
try {

0 commit comments

Comments
 (0)