@@ -42,7 +42,6 @@ import {
4242 ParsedResultSets ,
4343} from "./pure/interface-types" ;
4444import { Logger } from "./common" ;
45- import { commandRunner } from "./commandRunner" ;
4645import {
4746 CompletedQueryInfo ,
4847 interpretResultsSarif ,
@@ -72,6 +71,7 @@ import { isCanary, PAGE_SIZE } from "./config";
7271import { HistoryItemLabelProvider } from "./query-history/history-item-label-provider" ;
7372import { telemetryListener } from "./telemetry" ;
7473import { redactableError } from "./pure/errors" ;
74+ import { ResultsViewCommands } from "./common/commands" ;
7575
7676/**
7777 * interface.ts
@@ -179,21 +179,6 @@ export class ResultsView extends AbstractWebview<
179179 this . handleSelectionChange . bind ( this ) ,
180180 ) ,
181181 ) ;
182- const navigationCommands = {
183- "codeQLQueryResults.up" : NavigationDirection . up ,
184- "codeQLQueryResults.down" : NavigationDirection . down ,
185- "codeQLQueryResults.left" : NavigationDirection . left ,
186- "codeQLQueryResults.right" : NavigationDirection . right ,
187- // For backwards compatibility with keybindings set using an earlier version of the extension.
188- "codeQLQueryResults.nextPathStep" : NavigationDirection . down ,
189- "codeQLQueryResults.previousPathStep" : NavigationDirection . up ,
190- } ;
191- void logger . log ( "Registering result view navigation commands." ) ;
192- for ( const [ commandId , direction ] of Object . entries ( navigationCommands ) ) {
193- this . push (
194- commandRunner ( commandId , this . navigateResultView . bind ( this , direction ) ) ,
195- ) ;
196- }
197182
198183 this . push (
199184 this . databaseManager . onDidChangeDatabaseItem ( ( { kind } ) => {
@@ -209,6 +194,36 @@ export class ResultsView extends AbstractWebview<
209194 ) ;
210195 }
211196
197+ public getCommands ( ) : ResultsViewCommands {
198+ return {
199+ "codeQLQueryResults.up" : this . navigateResultView . bind (
200+ this ,
201+ NavigationDirection . up ,
202+ ) ,
203+ "codeQLQueryResults.down" : this . navigateResultView . bind (
204+ this ,
205+ NavigationDirection . down ,
206+ ) ,
207+ "codeQLQueryResults.left" : this . navigateResultView . bind (
208+ this ,
209+ NavigationDirection . left ,
210+ ) ,
211+ "codeQLQueryResults.right" : this . navigateResultView . bind (
212+ this ,
213+ NavigationDirection . right ,
214+ ) ,
215+ // For backwards compatibility with keybindings set using an earlier version of the extension.
216+ "codeQLQueryResults.nextPathStep" : this . navigateResultView . bind (
217+ this ,
218+ NavigationDirection . down ,
219+ ) ,
220+ "codeQLQueryResults.previousPathStep" : this . navigateResultView . bind (
221+ this ,
222+ NavigationDirection . up ,
223+ ) ,
224+ } ;
225+ }
226+
212227 async navigateResultView ( direction : NavigationDirection ) : Promise < void > {
213228 if ( ! this . panel ?. visible ) {
214229 return ;
0 commit comments