Skip to content

Commit 88a9ecb

Browse files
authored
Merge pull request #2204 from github/koesie10/summary-language-support-typed-commands
Convert summary language commands to typed commands
2 parents 9f7c7b2 + 1f8070c commit 88a9ecb

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ export type EvalLogViewerCommands = {
191191
"codeQLEvalLogViewer.clear": () => Promise<void>;
192192
};
193193

194+
export type SummaryLanguageSupportCommands = {
195+
"codeQL.gotoQL": () => Promise<void>;
196+
};
197+
194198
export type AllCommands = BaseCommands &
195199
QueryHistoryCommands &
196200
LocalDatabasesCommands &
@@ -199,7 +203,8 @@ export type AllCommands = BaseCommands &
199203
AstCfgCommands &
200204
AstViewerCommands &
201205
PackagingCommands &
202-
EvalLogViewerCommands;
206+
EvalLogViewerCommands &
207+
SummaryLanguageSupportCommands;
203208

204209
export type AppCommandManager = CommandManager<AllCommands>;
205210

extensions/ql-vscode/src/extension.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,9 @@ async function activateWithInstalledDistribution(
819819

820820
ctx.subscriptions.push(astViewer);
821821

822+
const summaryLanguageSupport = new SummaryLanguageSupport();
823+
ctx.subscriptions.push(summaryLanguageSupport);
824+
822825
void extLogger.log("Registering top-level command palette commands.");
823826

824827
const allCommands: AllCommands = {
@@ -842,6 +845,7 @@ async function activateWithInstalledDistribution(
842845
cliServer,
843846
}),
844847
...evalLogViewer.getCommands(),
848+
...summaryLanguageSupport.getCommands(),
845849
};
846850

847851
for (const [commandName, command] of Object.entries(allCommands)) {
@@ -938,8 +942,6 @@ async function activateWithInstalledDistribution(
938942
}),
939943
);
940944

941-
ctx.subscriptions.push(new SummaryLanguageSupport());
942-
943945
void extLogger.log("Starting language server.");
944946
await client.start();
945947
ctx.subscriptions.push({

extensions/ql-vscode/src/log-insights/summary-language-support.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import {
1313
workspace,
1414
} from "vscode";
1515
import { DisposableObject } from "../pure/disposable-object";
16-
import { commandRunner } from "../commandRunner";
1716
import { extLogger } from "../common";
1817
import { getErrorMessage } from "../pure/helpers-pure";
18+
import { SummaryLanguageSupportCommands } from "../common/commands";
1919

2020
/** A `Position` within a specified file on disk. */
2121
interface PositionInFile {
@@ -73,8 +73,12 @@ export class SummaryLanguageSupport extends DisposableObject {
7373
this.handleDidCloseTextDocument.bind(this),
7474
),
7575
);
76+
}
7677

77-
this.push(commandRunner("codeQL.gotoQL", this.handleGotoQL.bind(this)));
78+
public getCommands(): SummaryLanguageSupportCommands {
79+
return {
80+
"codeQL.gotoQL": this.handleGotoQL.bind(this),
81+
};
7882
}
7983

8084
/**

0 commit comments

Comments
 (0)