Allow max queries to be configurable

Max number of simultaneous queries launchable by runQueries command is
now configurable by codeQL.runningQueries.maxQueries.
This commit is contained in:
Andrew Eisenberg 2020-09-24 12:34:57 -07:00
Родитель db6fc5d7f0
Коммит 75b5c1d316
4 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -2,6 +2,8 @@
## [UNRELEASED]
- Max number of simultaneous queries launchable by runQueries command is now configurable by changing the codeQL.runningQueries.maxQueries setting.
## 1.3.3 - 16 September 2020
- Fix display of raw results entities with label but no url.

Просмотреть файл

@ -152,6 +152,11 @@
"default": false,
"description": "Enable automatically saving a modified query file when running a query."
},
"codeQL.runningQueries.maxQueries": {
"type": "integer",
"default": 20,
"description": "Max number of simultaneous queries to run using the 'CodeQL: Run Queries' command."
},
"codeQL.queryHistory.format": {
"type": "string",
"default": "[%t] %q on %d - %s",

Просмотреть файл

@ -67,6 +67,7 @@ const NUMBER_OF_THREADS_SETTING = new Setting('numberOfThreads', RUNNING_QUERIES
const TIMEOUT_SETTING = new Setting('timeout', RUNNING_QUERIES_SETTING);
const MEMORY_SETTING = new Setting('memory', RUNNING_QUERIES_SETTING);
const DEBUG_SETTING = new Setting('debug', RUNNING_QUERIES_SETTING);
export const MAX_QUERIES = new Setting('maxQueries', RUNNING_QUERIES_SETTING);
export const AUTOSAVE_SETTING = new Setting('autoSave', RUNNING_QUERIES_SETTING);
/** When these settings change, the running query server should be restarted. */

Просмотреть файл

@ -18,7 +18,7 @@ import { testExplorerExtensionId, TestHub } from 'vscode-test-adapter-api';
import { AstViewer } from './astViewer';
import * as archiveFilesystemProvider from './archive-filesystem-provider';
import { CodeQLCliServer } from './cli';
import { DistributionConfigListener, QueryHistoryConfigListener, QueryServerConfigListener } from './config';
import { DistributionConfigListener, MAX_QUERIES, QueryHistoryConfigListener, QueryServerConfigListener } from './config';
import * as languageSupport from './languageSupport';
import { DatabaseManager } from './databases';
import { DatabaseUI } from './databases-ui';
@ -466,11 +466,11 @@ async function activateWithInstalledDistribution(
commands.registerCommand(
'codeQL.runQueries',
async (_: Uri | undefined, multi: Uri[]) => {
const maxQueryCount = 20;
const maxQueryCount = MAX_QUERIES.getValue() as number;
try {
const [files, dirFound] = await gatherQlFiles(multi.map(uri => uri.fsPath));
if (files.length > maxQueryCount) {
throw new Error(`You tried to run ${files.length} queries, but the maximum is ${maxQueryCount}. Try selecting fewer queries.`);
throw new Error(`You tried to run ${files.length} queries, but the maximum is ${maxQueryCount}. Try selecting fewer queries or changing the 'codeQL.runningQueries.maxQueries' setting.`);
}
// warn user and display selected files when a directory is selected because some ql
// files may be hidden from the user.