Skip to content

Convert local database commands to typed commands#2189

Merged
koesie10 merged 4 commits intomainfrom
koesie10/typed-local-database-ui-commands
Mar 21, 2023
Merged

Convert local database commands to typed commands#2189
koesie10 merged 4 commits intomainfrom
koesie10/typed-local-database-ui-commands

Conversation

@koesie10
Copy link
Copy Markdown
Member

This converts the local databases UI to use typed commands. Please review this commit-by-commit since this also does some clean-up of the commands itself.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

The local databases UI was essentially the only class which was defining
methods using assignment to a class property rather than using function
definitions and binding them. This switches it to use function
definitions and binding, which is more consistent with the rest of the
codebase.
@koesie10 koesie10 marked this pull request as ready for review March 20, 2023 10:59
@koesie10 koesie10 requested a review from a team as a code owner March 20, 2023 10:59
@koesie10 koesie10 requested a review from a team March 20, 2023 10:59

handleChooseDatabaseGithub = async (
credentials: Credentials | undefined,
private async handleChooseDatabaseInternet(): Promise<void> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you talk about why we have chooseDatabaseInternet and also handleChooseDatabaseInternet?

I see one includes withProgress and one doesn't, and the commands registered in extension.ts are using commandRunnerWithProgress. I wonder why we don't use commandRunner and handleChooseDatabaseInternet from extension.ts too. Is that the long term plan and this is just a stepping stone PR?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. We will convert the commands in extension.ts to use typed commands as well, including using withProgress instead of commandRunnerWithProgress. The reason for using two different methods is because for some of these the text that is shown in the progress notification is different, so we can't re-use the same method. I think it's also a somewhat clearer separation if we have separate methods which can be called publicly vs handling commands privately.

@koesie10 koesie10 enabled auto-merge March 21, 2023 09:28
@koesie10 koesie10 merged commit f7b6d4c into main Mar 21, 2023
@koesie10 koesie10 deleted the koesie10/typed-local-database-ui-commands branch March 21, 2023 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants