Merge pull request #3647 from d10c/d10c/bigint-quick-eval

This commit is contained in:
Nora Dimitrijević
2024-10-14 16:32:16 +02:00
committed by GitHub
6 changed files with 40 additions and 3 deletions

View File

@@ -2,6 +2,8 @@
## [UNRELEASED] ## [UNRELEASED]
- Support result columns of type `QlBuiltins::BigInt` in quick evaluations. [#3647](https://github.com/github/vscode-codeql/pull/3647)
## 1.16.0 - 10 October 2024 ## 1.16.0 - 10 October 2024
- Increase the required version of VS Code to 1.90.0. [#3737](https://github.com/github/vscode-codeql/pull/3737) - Increase the required version of VS Code to 1.90.0. [#3737](https://github.com/github/vscode-codeql/pull/3737)

View File

@@ -11,6 +11,7 @@ export namespace BqrsColumnKindCode {
export const BOOLEAN = "b"; export const BOOLEAN = "b";
export const DATE = "d"; export const DATE = "d";
export const ENTITY = "e"; export const ENTITY = "e";
export const BIGINT = "z";
} }
export type BqrsColumnKind = export type BqrsColumnKind =
@@ -19,7 +20,8 @@ export type BqrsColumnKind =
| typeof BqrsColumnKindCode.STRING | typeof BqrsColumnKindCode.STRING
| typeof BqrsColumnKindCode.BOOLEAN | typeof BqrsColumnKindCode.BOOLEAN
| typeof BqrsColumnKindCode.DATE | typeof BqrsColumnKindCode.DATE
| typeof BqrsColumnKindCode.ENTITY; | typeof BqrsColumnKindCode.ENTITY
| typeof BqrsColumnKindCode.BIGINT;
export interface BqrsSchemaColumn { export interface BqrsSchemaColumn {
name?: string; name?: string;
@@ -79,7 +81,8 @@ export type BqrsKind =
| "Integer" | "Integer"
| "Boolean" | "Boolean"
| "Date" | "Date"
| "Entity"; | "Entity"
| "BigInt";
interface BqrsColumn { interface BqrsColumn {
name?: string; name?: string;

View File

@@ -76,6 +76,8 @@ function mapColumnKind(kind: BqrsColumnKind): ColumnKind {
return ColumnKind.Date; return ColumnKind.Date;
case BqrsColumnKindCode.ENTITY: case BqrsColumnKindCode.ENTITY:
return ColumnKind.Entity; return ColumnKind.Entity;
case BqrsColumnKindCode.BIGINT:
return ColumnKind.BigInt;
default: default:
assertNever(kind); assertNever(kind);
} }

View File

@@ -5,6 +5,7 @@ export enum ColumnKind {
Boolean = "boolean", Boolean = "boolean",
Date = "date", Date = "date",
Entity = "entity", Entity = "entity",
BigInt = "bigint",
} }
export type Column = { export type Column = {
@@ -61,6 +62,11 @@ type CellValueNumber = {
value: number; value: number;
}; };
type CellValueBigInt = {
type: "number";
value: number;
};
type CellValueString = { type CellValueString = {
type: "string"; type: "string";
value: string; value: string;
@@ -75,7 +81,8 @@ export type CellValue =
| CellValueEntity | CellValueEntity
| CellValueNumber | CellValueNumber
| CellValueString | CellValueString
| CellValueBoolean; | CellValueBoolean
| CellValueBigInt;
export type Row = CellValue[]; export type Row = CellValue[];

View File

@@ -17,4 +17,8 @@ abstract class InterestingNumber extends TNumber
final int getValue() { final int getValue() {
result = value result = value
} }
QlBuiltins::BigInt getBigIntValue() {
result = value.toBigInt()
}
} }

View File

@@ -144,6 +144,25 @@ describeWithCodeQL()("Debugger", () => {
}); });
}); });
it("should run a quick evaluation with a bigint-valued result column", async () => {
await withDebugController(appCommands, async (controller) => {
await selectForQuickEval(quickEvalLibPath, 20, 23, 20, 37);
await controller.startDebuggingSelection({
query: quickEvalQueryPath, // The query context. This query extends the abstract class.
});
await controller.expectLaunched();
const result = await controller.expectSucceeded();
expect(result.started.quickEvalContext).toBeDefined();
expect(result.started.quickEvalContext!.quickEvalText).toBe(
"getBigIntValue",
);
expect(result.results.queryTarget.quickEvalPosition).toBeDefined();
expect(await getResultCount(result.results.outputDir, cli)).toBe(8);
await controller.expectStopped();
});
});
it("should save dirty documents before launching a debug session", async () => { it("should save dirty documents before launching a debug session", async () => {
await withDebugController(appCommands, async (controller) => { await withDebugController(appCommands, async (controller) => {
const editor = await selectForQuickEval(quickEvalLibPath, 4, 15, 4, 32); const editor = await selectForQuickEval(quickEvalLibPath, 4, 15, 4, 32);