Skip to content

Commit 5ca5593

Browse files
committed
Merge branch 'main' into shati-patel/sorting-config
2 parents db29deb + 70a9ee6 commit 5ca5593

25 files changed

Lines changed: 225 additions & 71 deletions

File tree

docs/releasing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* New telemetry events are added.
1111
* Deprecation or removal of commands.
1212
* Accumulation of many changes, none of which are individually big enough to warrant a minor bump, but which together are. This does not include changes which are purely internal to the extension, such as refactoring, or which are only available behind a feature flag.
13-
1. Double-check that the node version we're using matches the one used for VS Code. If it doesn't, you will then need to update the node version in the following files:
13+
1. Double-check that the node version we're using matches the one used for VS Code. You can find this info by seleting "About Visual Studio Code" from the top menu. If it doesn't match, you will then need to update the node version in the following files:
1414
* `.nvmrc` - this will enable `nvm` to automatically switch to the correct node version when you're in the project folder
1515
* `.github/workflows/main.yml` - all the "node-version: '[VERSION]'" settings
1616
* `.github/workflows/release.yml` - the "node-version: '[VERSION]'" setting

extensions/ql-vscode/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
## [UNRELEASED]
44

55
- Add settings `codeQL.variantAnalysis.defaultResultsFilter` and `codeQL.variantAnalysis.defaultResultsSort` for configuring how variant analysis results are filtered and sorted in the results view. The default is to show only repositories with results, and to sort by the number of results. [#2392](https://github.com/github/vscode-codeql/pull/2392)
6+
## 1.8.4 - 3 May 2023
7+
8+
- Avoid repeated error messages when unable to monitor a variant analysis. [#2396](https://github.com/github/vscode-codeql/pull/2396)
9+
- Fix bug where a variant analysis didn't display the `#select` results set correctly when the [query metadata](https://codeql.github.com/docs/writing-codeql-queries/about-codeql-queries/#query-metadata) didn't exactly match the query results. [#2395](https://github.com/github/vscode-codeql/pull/2395)
610
- On the variant analysis results page, show the count of successful analyses instead of completed analyses, and indicate the reason why analyses were not successful. [#2349](https://github.com/github/vscode-codeql/pull/2349)
711
- Fix bug where the "CodeQL: Set Current Database" command didn't always select the database. [#2384](https://github.com/github/vscode-codeql/pull/2384)
812

extensions/ql-vscode/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "CodeQL for Visual Studio Code",
55
"author": "GitHub",
66
"private": true,
7-
"version": "1.8.4",
7+
"version": "1.8.5",
88
"publisher": "GitHub",
99
"license": "MIT",
1010
"icon": "media/VS-marketplace-CodeQL-icon.png",

extensions/ql-vscode/src/common/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { DbTreeViewItem } from "../databases/ui/db-tree-view-item";
55
import type { DatabaseItem } from "../databases/local-databases";
66
import type { QueryHistoryInfo } from "../query-history/query-history-info";
77
import type { RepositoriesFilterSortStateWithIds } from "../pure/variant-analysis-filter-sort";
8-
import type { TestTreeNode } from "../test-tree-node";
8+
import type { TestTreeNode } from "../query-testing/test-tree-node";
99
import type {
1010
VariantAnalysis,
1111
VariantAnalysisScannedRepository,

extensions/ql-vscode/src/config.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ const ROOT_SETTING = new Setting("codeQL");
7474
// Global configuration
7575
const TELEMETRY_SETTING = new Setting("telemetry", ROOT_SETTING);
7676
const AST_VIEWER_SETTING = new Setting("astViewer", ROOT_SETTING);
77+
const CONTEXTUAL_QUERIES_SETTINGS = new Setting(
78+
"contextualQueries",
79+
ROOT_SETTING,
80+
);
7781
const GLOBAL_TELEMETRY_SETTING = new Setting("telemetry");
7882
const LOG_INSIGHTS_SETTING = new Setting("logInsights", ROOT_SETTING);
7983

@@ -484,13 +488,21 @@ export function joinOrderWarningThreshold(): number {
484488
}
485489

486490
/**
487-
* Avoids caching in the AST viewer if the user is also a canary user.
491+
* Hidden setting: Avoids caching in the AST viewer if the user is also a canary user.
488492
*/
489493
export const NO_CACHE_AST_VIEWER = new Setting(
490494
"disableCache",
491495
AST_VIEWER_SETTING,
492496
);
493497

498+
/**
499+
* Hidden setting: Avoids caching in jump to def and find refs contextual queries if the user is also a canary user.
500+
*/
501+
export const NO_CACHE_CONTEXTUAL_QUERIES = new Setting(
502+
"disableCache",
503+
CONTEXTUAL_QUERIES_SETTINGS,
504+
);
505+
494506
// Settings for variant analysis
495507
const VARIANT_ANALYSIS_SETTING = new Setting("variantAnalysis", ROOT_SETTING);
496508

extensions/ql-vscode/src/extension.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ import {
8686
LegacyQueryRunner,
8787
QueryServerClient as LegacyQueryServerClient,
8888
} from "./query-server/legacy";
89-
import { QLTestAdapterFactory } from "./test-adapter";
90-
import { TestUIService } from "./test-ui";
89+
import { QLTestAdapterFactory } from "./query-testing/test-adapter";
90+
import { TestUIService } from "./query-testing/test-ui";
9191
import { CompareView } from "./compare/compare-view";
9292
import { initializeTelemetry } from "./telemetry";
9393
import { ProgressCallback, withProgress } from "./common/vscode/progress";
@@ -121,9 +121,9 @@ import { App } from "./common/app";
121121
import { registerCommandWithErrorHandling } from "./common/vscode/commands";
122122
import { DebuggerUI } from "./debugger/debugger-ui";
123123
import { DataExtensionsEditorModule } from "./data-extensions-editor/data-extensions-editor-module";
124-
import { TestManager } from "./test-manager";
125-
import { TestRunner } from "./test-runner";
126-
import { TestManagerBase } from "./test-manager-base";
124+
import { TestManager } from "./query-testing/test-manager";
125+
import { TestRunner } from "./query-testing/test-runner";
126+
import { TestManagerBase } from "./query-testing/test-manager-base";
127127
import { NewQueryRunner, QueryRunner, QueryServerClient } from "./query-server";
128128

129129
/**

extensions/ql-vscode/src/language-support/ast-viewer/ast-cfg-commands.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ export function getAstCfgCommands({
5252
progress,
5353
token,
5454
undefined,
55+
undefined,
56+
res[1],
5557
);
5658
}
5759
},

extensions/ql-vscode/src/language-support/contextual/template-provider.ts

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ import {
3030
resolveQueries,
3131
runContextualQuery,
3232
} from "./query-resolver";
33-
import { isCanary, NO_CACHE_AST_VIEWER } from "../../config";
33+
import {
34+
isCanary,
35+
NO_CACHE_AST_VIEWER,
36+
NO_CACHE_CONTEXTUAL_QUERIES,
37+
} from "../../config";
3438
import { CoreCompletedQuery, QueryRunner } from "../../query-server";
3539
import { AstBuilder } from "../ast-viewer/ast-builder";
3640

@@ -59,7 +63,10 @@ export class TemplateQueryDefinitionProvider implements DefinitionProvider {
5963
position: Position,
6064
_token: CancellationToken,
6165
): Promise<LocationLink[]> {
62-
const fileLinks = await this.cache.get(document.uri.toString());
66+
const fileLinks = this.shouldUseCache()
67+
? await this.cache.get(document.uri.toString())
68+
: await this.getDefinitions(document.uri.toString());
69+
6370
const locLinks: LocationLink[] = [];
6471
for (const link of fileLinks) {
6572
if (link.originSelectionRange!.contains(position)) {
@@ -69,6 +76,10 @@ export class TemplateQueryDefinitionProvider implements DefinitionProvider {
6976
return locLinks;
7077
}
7178

79+
private shouldUseCache() {
80+
return !(isCanary() && NO_CACHE_CONTEXTUAL_QUERIES.getValue<boolean>());
81+
}
82+
7283
private async getDefinitions(uriString: string): Promise<LocationLink[]> {
7384
return withProgress(
7485
async (progress, token) => {
@@ -118,7 +129,10 @@ export class TemplateQueryReferenceProvider implements ReferenceProvider {
118129
_context: ReferenceContext,
119130
_token: CancellationToken,
120131
): Promise<Location[]> {
121-
const fileLinks = await this.cache.get(document.uri.toString());
132+
const fileLinks = this.shouldUseCache()
133+
? await this.cache.get(document.uri.toString())
134+
: await this.getReferences(document.uri.toString());
135+
122136
const locLinks: Location[] = [];
123137
for (const link of fileLinks) {
124138
if (link.targetRange!.contains(position)) {
@@ -131,6 +145,10 @@ export class TemplateQueryReferenceProvider implements ReferenceProvider {
131145
return locLinks;
132146
}
133147

148+
private shouldUseCache() {
149+
return !(isCanary() && NO_CACHE_CONTEXTUAL_QUERIES.getValue<boolean>());
150+
}
151+
134152
private async getReferences(uriString: string): Promise<FullLocationLink[]> {
135153
return withProgress(
136154
async (progress, token) => {
@@ -182,7 +200,7 @@ export class TemplatePrintAstProvider {
182200
"Cannot view the AST. Please select a valid source file inside a CodeQL database.",
183201
);
184202
}
185-
const completedQuery = this.shouldCache()
203+
const completedQuery = this.shouldUseCache()
186204
? await this.cache.get(fileUri.toString(), progress, token)
187205
: await this.getAst(fileUri.toString(), progress, token);
188206

@@ -194,7 +212,7 @@ export class TemplatePrintAstProvider {
194212
);
195213
}
196214

197-
private shouldCache() {
215+
private shouldUseCache() {
198216
return !(isCanary() && NO_CACHE_AST_VIEWER.getValue<boolean>());
199217
}
200218

@@ -271,7 +289,14 @@ export class TemplatePrintCfgProvider {
271289
if (!document) {
272290
return;
273291
}
274-
return await this.cache.get(document.uri.toString());
292+
293+
return this.shouldUseCache()
294+
? await this.cache.get(document.uri.toString())
295+
: await this.getCfgUri(document.uri.toString());
296+
}
297+
298+
private shouldUseCache() {
299+
return !(isCanary() && NO_CACHE_AST_VIEWER.getValue<boolean>());
275300
}
276301

277302
private async getCfgUri(

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ export class LocalQueries extends DisposableObject {
337337
token: CancellationToken,
338338
databaseItem: DatabaseItem | undefined,
339339
range?: Range,
340+
templates?: Record<string, string>,
340341
): Promise<void> {
341342
await this.compileAndRunQueryInternal(
342343
quickEval,
@@ -345,6 +346,7 @@ export class LocalQueries extends DisposableObject {
345346
token,
346347
databaseItem,
347348
range,
349+
templates,
348350
);
349351
}
350352

@@ -356,6 +358,7 @@ export class LocalQueries extends DisposableObject {
356358
token: CancellationToken,
357359
databaseItem: DatabaseItem | undefined,
358360
range?: Range,
361+
templates?: Record<string, string>,
359362
): Promise<CoreCompletedQuery> {
360363
let queryPath: string;
361364
if (queryUri !== undefined) {
@@ -395,7 +398,7 @@ export class LocalQueries extends DisposableObject {
395398
extensionPacks,
396399
this.queryStorageDir,
397400
undefined,
398-
undefined,
401+
templates,
399402
);
400403

401404
// handle cancellation from the history view.

0 commit comments

Comments
 (0)