Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9cc790e

Browse files
authored
Merge pull request #3647 from d10c/d10c/bigint-quick-eval
2 parents fb3c00b + c4eaf54 commit 9cc790e

File tree

6 files changed

+40
-3
lines changed

6 files changed

+40
-3
lines changed

extensions/ql-vscode/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## [UNRELEASED]
44

5+
- Support result columns of type `QlBuiltins::BigInt` in quick evaluations. [#3647](https://github.com/github/vscode-codeql/pull/3647)
6+
57
## 1.16.0 - 10 October 2024
68

79
- Increase the required version of VS Code to 1.90.0. [#3737](https://github.com/github/vscode-codeql/pull/3737)

extensions/ql-vscode/src/common/bqrs-cli-types.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export namespace BqrsColumnKindCode {
1111
export const BOOLEAN = "b";
1212
export const DATE = "d";
1313
export const ENTITY = "e";
14+
export const BIGINT = "z";
1415
}
1516

1617
export type BqrsColumnKind =
@@ -19,7 +20,8 @@ export type BqrsColumnKind =
1920
| typeof BqrsColumnKindCode.STRING
2021
| typeof BqrsColumnKindCode.BOOLEAN
2122
| typeof BqrsColumnKindCode.DATE
22-
| typeof BqrsColumnKindCode.ENTITY;
23+
| typeof BqrsColumnKindCode.ENTITY
24+
| typeof BqrsColumnKindCode.BIGINT;
2325

2426
export interface BqrsSchemaColumn {
2527
name?: string;
@@ -79,7 +81,8 @@ export type BqrsKind =
7981
| "Integer"
8082
| "Boolean"
8183
| "Date"
82-
| "Entity";
84+
| "Entity"
85+
| "BigInt";
8386

8487
interface BqrsColumn {
8588
name?: string;

extensions/ql-vscode/src/common/bqrs-raw-results-mapper.ts

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ function mapColumnKind(kind: BqrsColumnKind): ColumnKind {
7676
return ColumnKind.Date;
7777
case BqrsColumnKindCode.ENTITY:
7878
return ColumnKind.Entity;
79+
case BqrsColumnKindCode.BIGINT:
80+
return ColumnKind.BigInt;
7981
default:
8082
assertNever(kind);
8183
}

extensions/ql-vscode/src/common/raw-result-types.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export enum ColumnKind {
55
Boolean = "boolean",
66
Date = "date",
77
Entity = "entity",
8+
BigInt = "bigint",
89
}
910

1011
export type Column = {
@@ -61,6 +62,11 @@ type CellValueNumber = {
6162
value: number;
6263
};
6364

65+
type CellValueBigInt = {
66+
type: "number";
67+
value: number;
68+
};
69+
6470
type CellValueString = {
6571
type: "string";
6672
value: string;
@@ -75,7 +81,8 @@ export type CellValue =
7581
| CellValueEntity
7682
| CellValueNumber
7783
| CellValueString
78-
| CellValueBoolean;
84+
| CellValueBoolean
85+
| CellValueBigInt;
7986

8087
export type Row = CellValue[];
8188

extensions/ql-vscode/test/data/debugger/QuickEvalLib.qll

+4
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ abstract class InterestingNumber extends TNumber
1717
final int getValue() {
1818
result = value
1919
}
20+
21+
QlBuiltins::BigInt getBigIntValue() {
22+
result = value.toBigInt()
23+
}
2024
}

extensions/ql-vscode/test/vscode-tests/cli-integration/debugger/debugger.test.ts

+19
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,25 @@ describeWithCodeQL()("Debugger", () => {
144144
});
145145
});
146146

147+
it("should run a quick evaluation with a bigint-valued result column", async () => {
148+
await withDebugController(appCommands, async (controller) => {
149+
await selectForQuickEval(quickEvalLibPath, 20, 23, 20, 37);
150+
151+
await controller.startDebuggingSelection({
152+
query: quickEvalQueryPath, // The query context. This query extends the abstract class.
153+
});
154+
await controller.expectLaunched();
155+
const result = await controller.expectSucceeded();
156+
expect(result.started.quickEvalContext).toBeDefined();
157+
expect(result.started.quickEvalContext!.quickEvalText).toBe(
158+
"getBigIntValue",
159+
);
160+
expect(result.results.queryTarget.quickEvalPosition).toBeDefined();
161+
expect(await getResultCount(result.results.outputDir, cli)).toBe(8);
162+
await controller.expectStopped();
163+
});
164+
});
165+
147166
it("should save dirty documents before launching a debug session", async () => {
148167
await withDebugController(appCommands, async (controller) => {
149168
const editor = await selectForQuickEval(quickEvalLibPath, 4, 15, 4, 32);

0 commit comments

Comments
 (0)