Skip to content

Created generic quick pick util class to support various use cases #1272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 19, 2025

Conversation

gnana997
Copy link
Contributor

Summary of Changes

  • Added a generic createQuickPick utility class to handle multiple scenarios exposing a callback functions for required usecase.

Any additional details or context that should be provided?

Pull request checklist

Please check if your PR fulfills the following (if applicable):

Tests
  • Added new
  • Updated existing
  • Deleted existing
Other
  • All new disposables (event listeners, views, channels, etc.) collected as for eventual cleanup?
  • Does anything in this PR need to be mentioned in the user-facing CHANGELOG or README?
  • Have you validated this change locally by packaging and installing the extension .vsix file?
    gulp clicktest

@shouples shouples self-assigned this Mar 18, 2025
@gnana997
Copy link
Contributor Author

Hi @shouples , I went through the localResource.ts and I have updated the utils quick pick to customize the createQuickPick in localResource.ts. Can you check it once and let me know if I am missing something?
Thanks!

@shouples
Copy link
Contributor

shouples commented Mar 21, 2025

Hey @gnana997, this is working nicely so far! Just one test failure running locally (via gulp test) on MacOS 15.3 (arm64):

  862 passing (4s)
  2 pending
  1 failing
  1) QuickPick utils
       should create a QuickPick with correct options:
     AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal:

[
  {
    label: 'Item 2'
  }
]

should loosely deep-equal

{
  label: 'Item 2'
}

My only suggestion for now would be to include QuickPickItemWithValue as the primary item type (instead of QuickPickItem) in quickPickUtils, and to provide some examples in the PR description or JSDoc comments for how to use the function(s) for simple quickpick use-cases as well as more complicated/customized use-cases.

Thanks for helping out with this -- I'll try to provide a more thorough review next week.

@gnana997 gnana997 force-pushed the create-quick-pick branch from b2b37d5 to 272cac8 Compare March 22, 2025 13:32
@gnana997 gnana997 marked this pull request as ready for review March 22, 2025 13:32
@gnana997 gnana997 requested a review from a team as a code owner March 22, 2025 13:32
@gnana997
Copy link
Contributor Author

Hi @shouples , I have updated the failing test case and also updated the class to use QuickPickItemWithValue along with JSDoc comments on usage.

Should I start migrating functions with showQuickPick to use showEnhancedQuickPick created?

Thanks!

@shouples
Copy link
Contributor

/sem-approve

Copy link
Contributor

@shouples shouples left a comment

Choose a reason for hiding this comment

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

This is looking really nice so far @gnana997! Let's handle migrating the rest of the quickpicks in other smaller PRs. I'll write up some follow-on issues once this PR is merged.

For now I just have a couple questions and suggestions for some cleanup/consolidation.

@gnana997 gnana997 requested a review from shouples March 24, 2025 17:42
@gnana997 gnana997 requested a review from shouples March 27, 2025 18:46
@gnana997 gnana997 requested a review from shouples March 28, 2025 17:32
Copy link
Contributor

@shouples shouples left a comment

Choose a reason for hiding this comment

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

This is really close @gnana997! Just one thing left to fix and then I think this one is good to merge. 🙏

edit: two things: one for the selectedItems handling, one for the Disposables cleanup

Comment on lines +243 to +247
// If we have pre-selected items and haven't captured any selections yet,
// use the pre-selected items
if (selectedItems.length === 0 && options?.selectedItems) {
selectedItems = [...options.selectedItems];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed some strange behavior when clicking the ⚙️ icon (either against the Kafka item or the SR item) where it seems to continue the user flow as if clicking "OK" or hitting "Enter":

local-item-button.mov

I think removing the section here and only assigning selectedItems during onDidAccept will fix this and keep the behavior consistent with what's currently on main.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for taking care of those other fixes @gnana997! Looks like this is the last part needed before we can merge.

@cprovencher cprovencher added rebase and removed rebase labels May 16, 2025
Copy link
Contributor

@shouples shouples left a comment

Choose a reason for hiding this comment

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

Thanks again for all your help on this @gnana997 - I'm going to merge it as-is and address my last comment in a follow-up PR.

@shouples shouples merged commit af10523 into confluentinc:main May 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants