Skip to content
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

refactor(settings): minimize duplication across prompt settings. #6243

Draft
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

Hweinstock
Copy link
Contributor

@Hweinstock Hweinstock commented Dec 13, 2024

Problem

ToolkitPromptSettings and AmazonQPromptSettings reimplement the same functions.

Solution

  • factor these classes out into the same anonymous class.
  • avoid using inheritance to keep strong typing from the settings.

TODO: figure out how to type the booleans to avoid casting


  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.

License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

  • This pull request modifies code in src/* but no tests were added/updated.
    • Confirm whether tests should be added or ensure the PR description explains why tests are not required.

) {
public isPromptEnabled(promptName: promptName) {
try {
return !this._getOrThrow(promptName, false as never)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Believe there is an issue with how I setup types since I need the cast here.

@@ -808,7 +808,7 @@ class DiskCacheErrorMessage {
: ToolkitPromptSettings.instance

// We know 'ssoCacheError' is in all extension prompt settings
if (await promptSettings.isPromptEnabled('ssoCacheError')) {
if (promptSettings.isPromptEnabled('ssoCacheError')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a welcome change 👍
Not a strong reason for this function to be async

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

2 participants