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.
This commit is contained in:
Asger F
2022-10-07 10:35:41 +02:00
parent 0f6100cc42
commit 5a694653d7
2 changed files with 20 additions and 27 deletions

View File

@@ -594,11 +594,11 @@
"title": "Copy Repository List"
},
{
"command": "codeQLQueryResults.nextPathStep",
"command": "codeQLQueryResults.down",
"title": "CodeQL: Navigate down in result viewer"
},
{
"command": "codeQLQueryResults.previousPathStep",
"command": "codeQLQueryResults.up",
"title": "CodeQL: Navigate up in result viewer"
},
{

View File

@@ -142,31 +142,24 @@ export class ResultsView extends AbstractWebview<IntoResultsViewMsg, FromResults
this.handleSelectionChange.bind(this)
)
);
void logger.log('Registering path-step navigation commands.');
this.push(
commandRunner(
'codeQLQueryResults.nextPathStep', // TODO: deprecate the old commands and make them forward to new commands named 'up/down'
this.navigateResultView.bind(this, NavigationDirection.down)
)
);
this.push(
commandRunner(
'codeQLQueryResults.previousPathStep',
this.navigateResultView.bind(this, NavigationDirection.up)
)
);
this.push(
commandRunner(
'codeQLQueryResults.right',
this.navigateResultView.bind(this, NavigationDirection.right)
)
);
this.push(
commandRunner(
'codeQLQueryResults.left',
this.navigateResultView.bind(this, NavigationDirection.left)
)
);
const navigationCommands = {
'codeQLQueryResults.up': NavigationDirection.up,
'codeQLQueryResults.down': NavigationDirection.down,
'codeQLQueryResults.left': NavigationDirection.left,
'codeQLQueryResults.right': NavigationDirection.right,
// For backwards compatibility with keybindings set using an earlier version of the extension.
'codeQLQueryResults.nextPathStep': NavigationDirection.down,
'codeQLQueryResults.previousPathStep': NavigationDirection.up,
};
void logger.log('Registering result view navigation commands.');
for (const [commandId, direction] of Object.entries(navigationCommands)) {
this.push(
commandRunner(
commandId,
this.navigateResultView.bind(this, direction)
)
);
}
this.push(
this.databaseManager.onDidChangeDatabaseItem(({ kind }) => {