Skip to content

Commit 5a69465

Browse files
committed
Rename command IDs.
We register a handler for the old command ID, but do not mention it in package.json. This seems to be backward compatible without polluting the command palette.
1 parent 0f6100c commit 5a69465

2 files changed

Lines changed: 20 additions & 27 deletions

File tree

extensions/ql-vscode/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,11 +594,11 @@
594594
"title": "Copy Repository List"
595595
},
596596
{
597-
"command": "codeQLQueryResults.nextPathStep",
597+
"command": "codeQLQueryResults.down",
598598
"title": "CodeQL: Navigate down in result viewer"
599599
},
600600
{
601-
"command": "codeQLQueryResults.previousPathStep",
601+
"command": "codeQLQueryResults.up",
602602
"title": "CodeQL: Navigate up in result viewer"
603603
},
604604
{

extensions/ql-vscode/src/interface.ts

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -142,31 +142,24 @@ export class ResultsView extends AbstractWebview<IntoResultsViewMsg, FromResults
142142
this.handleSelectionChange.bind(this)
143143
)
144144
);
145-
void logger.log('Registering path-step navigation commands.');
146-
this.push(
147-
commandRunner(
148-
'codeQLQueryResults.nextPathStep', // TODO: deprecate the old commands and make them forward to new commands named 'up/down'
149-
this.navigateResultView.bind(this, NavigationDirection.down)
150-
)
151-
);
152-
this.push(
153-
commandRunner(
154-
'codeQLQueryResults.previousPathStep',
155-
this.navigateResultView.bind(this, NavigationDirection.up)
156-
)
157-
);
158-
this.push(
159-
commandRunner(
160-
'codeQLQueryResults.right',
161-
this.navigateResultView.bind(this, NavigationDirection.right)
162-
)
163-
);
164-
this.push(
165-
commandRunner(
166-
'codeQLQueryResults.left',
167-
this.navigateResultView.bind(this, NavigationDirection.left)
168-
)
169-
);
145+
const navigationCommands = {
146+
'codeQLQueryResults.up': NavigationDirection.up,
147+
'codeQLQueryResults.down': NavigationDirection.down,
148+
'codeQLQueryResults.left': NavigationDirection.left,
149+
'codeQLQueryResults.right': NavigationDirection.right,
150+
// For backwards compatibility with keybindings set using an earlier version of the extension.
151+
'codeQLQueryResults.nextPathStep': NavigationDirection.down,
152+
'codeQLQueryResults.previousPathStep': NavigationDirection.up,
153+
};
154+
void logger.log('Registering result view navigation commands.');
155+
for (const [commandId, direction] of Object.entries(navigationCommands)) {
156+
this.push(
157+
commandRunner(
158+
commandId,
159+
this.navigateResultView.bind(this, direction)
160+
)
161+
);
162+
}
170163

171164
this.push(
172165
this.databaseManager.onDidChangeDatabaseItem(({ kind }) => {

0 commit comments

Comments
 (0)