Skip to content

Commit 1f8070c

Browse files
committed
Convert summary language commands to typed commands
1 parent e724577 commit 1f8070c

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
@@ -185,14 +185,19 @@ export type EvalLogViewerCommands = {
185185
"codeQLEvalLogViewer.clear": () => Promise<void>;
186186
};
187187

188+
export type SummaryLanguageSupportCommands = {
189+
"codeQL.gotoQL": () => Promise<void>;
190+
};
191+
188192
export type AllCommands = BaseCommands &
189193
QueryHistoryCommands &
190194
LocalDatabasesCommands &
191195
VariantAnalysisCommands &
192196
DatabasePanelCommands &
193197
AstCfgCommands &
194198
PackagingCommands &
195-
EvalLogViewerCommands;
199+
EvalLogViewerCommands &
200+
SummaryLanguageSupportCommands;
196201

197202
export type AppCommandManager = CommandManager<AllCommands>;
198203

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 = {
@@ -841,6 +844,7 @@ async function activateWithInstalledDistribution(
841844
cliServer,
842845
}),
843846
...evalLogViewer.getCommands(),
847+
...summaryLanguageSupport.getCommands(),
844848
};
845849

846850
for (const [commandName, command] of Object.entries(allCommands)) {
@@ -937,8 +941,6 @@ async function activateWithInstalledDistribution(
937941
}),
938942
);
939943

940-
ctx.subscriptions.push(new SummaryLanguageSupport());
941-
942944
void extLogger.log("Starting language server.");
943945
await client.start();
944946
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)