Skip to content

Commit d0c405a

Browse files
author
Dave Bartolomeo
committed
QuickEval and other debug commands
1 parent d489d0e commit d0c405a

5 files changed

Lines changed: 274 additions & 45 deletions

File tree

extensions/ql-vscode/package.json

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,30 @@
351351
"command": "codeQL.runQueryContextEditor",
352352
"title": "CodeQL: Run Query on Selected Database"
353353
},
354+
{
355+
"command": "codeQL.debugQuery",
356+
"title": "CodeQL: Debug Query"
357+
},
358+
{
359+
"command": "codeQL.debugQueryContextEditor",
360+
"title": "CodeQL: Debug Query"
361+
},
362+
{
363+
"command": "codeQL.startDebuggingSelection",
364+
"title": "CodeQL: Debug Selection"
365+
},
366+
{
367+
"command": "codeQL.startDebuggingSelectionContextEditor",
368+
"title": "CodeQL: Debug Selection"
369+
},
370+
{
371+
"command": "codeQL.continueDebuggingSelection",
372+
"title": "CodeQL: Debug Selection"
373+
},
374+
{
375+
"command": "codeQL.continueDebuggingSelectionContextEditor",
376+
"title": "CodeQL: Debug Selection"
377+
},
354378
{
355379
"command": "codeQL.runQueryOnMultipleDatabases",
356380
"title": "CodeQL: Run Query on Multiple Databases"
@@ -1072,6 +1096,30 @@
10721096
"command": "codeQL.runQueryContextEditor",
10731097
"when": "false"
10741098
},
1099+
{
1100+
"command": "codeQL.debugQuery",
1101+
"when": "config.codeQL.canary && editorLangId == ql && resourceExtname == .ql && !inDebugMode"
1102+
},
1103+
{
1104+
"command": "codeQL.debugQueryContextEditor",
1105+
"when": "false"
1106+
},
1107+
{
1108+
"command": "codeQL.startDebuggingSelection",
1109+
"when": "config.codeQL.canary && editorLangId == ql && debugState == inactive && debugConfigurationType == codeql"
1110+
},
1111+
{
1112+
"command": "codeQL.startDebuggingSelectionContextEditor",
1113+
"when": "false"
1114+
},
1115+
{
1116+
"command": "codeQL.continueDebuggingSelection",
1117+
"when": "config.codeQL.canary && editorLangId == ql && debugState == stopped && debugType == codeql"
1118+
},
1119+
{
1120+
"command": "codeQL.continueDebuggingSelectionContextEditor",
1121+
"when": "false"
1122+
},
10751123
{
10761124
"command": "codeQL.runQueryOnMultipleDatabases",
10771125
"when": "resourceLangId == ql && resourceExtname == .ql"
@@ -1388,7 +1436,7 @@
13881436
"editor/context": [
13891437
{
13901438
"command": "codeQL.runQueryContextEditor",
1391-
"when": "editorLangId == ql && resourceExtname == .ql"
1439+
"when": "editorLangId == ql && resourceExtname == .ql && !inDebugMode"
13921440
},
13931441
{
13941442
"command": "codeQL.runQueryOnMultipleDatabasesContextEditor",
@@ -1408,11 +1456,19 @@
14081456
},
14091457
{
14101458
"command": "codeQL.quickEvalContextEditor",
1411-
"when": "editorLangId == ql"
1459+
"when": "editorLangId == ql && debugState == inactive"
14121460
},
14131461
{
1414-
"command": "codeQL.debug.quickEvalContextEditor",
1415-
"when": "config.codeQL.canary && editorLangId == ql"
1462+
"command": "codeQL.debugQueryContextEditor",
1463+
"when": "config.codeQL.canary && editorLangId == ql && resourceExtname == .ql && !inDebugMode"
1464+
},
1465+
{
1466+
"command": "codeQL.startDebuggingSelectionContextEditor",
1467+
"when": "config.codeQL.canary && editorLangId == ql && debugState == inactive && debugConfigurationType == codeql"
1468+
},
1469+
{
1470+
"command": "codeQL.continueDebuggingSelectionContextEditor",
1471+
"when": "config.codeQL.canary && editorLangId == ql && debugState == stopped && debugType == codeql"
14161472
},
14171473
{
14181474
"command": "codeQL.openReferencedFileContextEditor",

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,12 @@ export type LocalQueryCommands = {
101101

102102
// Debugger commands
103103
export type DebuggerCommands = {
104-
"codeQL.debug.quickEval": (uri: Uri) => Promise<void>;
105-
"codeQL.debug.quickEvalContextEditor": (uri: Uri) => Promise<void>;
104+
"codeQL.debugQuery": (uri: Uri) => Promise<void>;
105+
"codeQL.debugQueryContextEditor": (uri: Uri) => Promise<void>;
106+
"codeQL.startDebuggingSelection": () => Promise<void>;
107+
"codeQL.startDebuggingSelectionContextEditor": () => Promise<void>;
108+
"codeQL.continueDebuggingSelection": () => Promise<void>;
109+
"codeQL.continueDebuggingSelectionContextEditor": () => Promise<void>;
106110
};
107111

108112
export type ResultsViewCommands = {

extensions/ql-vscode/src/debugger/debug-protocol.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export type OutputEvent = DebugProtocol.OutputEvent &
1515
export interface EvaluationStartedEventBody {
1616
id: string;
1717
outputDir: string;
18+
quickEvalPosition: Position | undefined;
1819
}
1920

2021
/**
@@ -48,6 +49,13 @@ export type AnyEvent =
4849

4950
export type Request = DebugProtocol.Request & { type: "request" };
5051

52+
export interface QuickEvalRequest extends Request {
53+
command: "codeql-quickeval";
54+
arguments: {
55+
quickEvalPosition: Position;
56+
};
57+
}
58+
5159
export interface DebugResultRequest extends Request {
5260
command: "codeql-debug-result";
5361
arguments: undefined;
@@ -56,13 +64,19 @@ export interface DebugResultRequest extends Request {
5664
export type InitializeRequest = DebugProtocol.InitializeRequest &
5765
Request & { command: "initialize" };
5866

59-
export type AnyRequest = InitializeRequest | DebugResultRequest;
67+
export type AnyRequest =
68+
| InitializeRequest
69+
| DebugResultRequest
70+
| QuickEvalRequest;
6071

6172
export type Response = DebugProtocol.Response & { type: "response" };
6273

6374
export type InitializeResponse = DebugProtocol.InitializeResponse &
6475
Response & { command: "initialize" };
6576

77+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
78+
export interface QuickEvalResponse extends Response {}
79+
6680
export type AnyResponse = InitializeResponse;
6781

6882
export type AnyProtocolMessage = AnyEvent | AnyRequest | AnyResponse;

0 commit comments

Comments
 (0)