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

Wait for VSCode Settings Import to finish before proceeding to next step #250

Merged
merged 10 commits into from
Jan 29, 2025

Conversation

lenghuang
Copy link

@lenghuang lenghuang commented Jan 27, 2025

Description ✏️

Closes trypear/pearai-app#170

  • Make the loading for import VSCode Extensions step synchronous
  • Show skip button, then hide for 5 seconds, then show again
  • Remove associated usages of local storage
  • Add error handling
  • Still works if you press back
Error Case Skip Reappears
error case skip reappears

Initially, I got some permissions error when copying.

Failed to copy settings: Error: EACCES: permission denied, copyfile '/Users/len/.vscode/extensions/redhat.java-1.39.0-darwin-x64/jre/21.0.5-macosx-x86_64/legal/java.base/ADDITIONAL_LICENSE_INFO' -> '/Users/len/.pearai/extensions/redhat.java-1.39.0-darwin-x64/jre/21.0.5-macosx-x86_64/legal/java.base/ADDITIONAL_LICENSE_INFO

Then I ran these commands to get it working.

chmod -R u+rw ~/.vscode/extensions/redhat.java-1.39.0-darwin-x64
chmod -R u+rw ~/.pearai/extensions/
Success Case It Remembers If You Press Back
success remember

Here we see that it automatically goes to the next step on success, and that if you were to go back for some reason, the "done" status stays there.

Testing Details 🧪

  • Got this PearAI-Dev version from Nang for darwin-x86 https://drive.google.com/file/d/1YHUXNZfW5ZyGmYxcjCsRKvlqoEmnhvvC/view?usp=sharing
  • With that, I needed to be on node v22.13.1 for some reason. If not, ./scripts/install-and-build.sh would not succeed
  • From play button run task / launch config Extension (VSCode)
  • Added another command for startOnboarding since my local was slow and sometimes Reset Onboarding wasn't enough.

Checklist ✅

  • I have added screenshots (if UI changes are present).
  • I have done a self-review of my code.
  • I have manually tested my code (if applicable).

Important

Make VSCode settings import synchronous with error handling and retry logic, and update UI to reflect import status.

  • Behavior:
    • Make VSCode settings import synchronous in importUserSettingsFromVSCode() in copySettings.ts.
    • Add error handling and retry logic in ImportExtensions.tsx.
    • Show skip button, hide for 5 seconds, then show again in ImportExtensions.tsx.
    • Ensure process can be skipped or retried in ImportExtensions.tsx.
  • Commands:
    • Add pearai.startOnboarding command in package.json and commands.ts.
    • Modify pearai.welcome.importUserSettingsFromVSCode to return a boolean in commands.ts.
  • Local Storage:
    • Add isDoneImportingUserSettingsFromVSCode to localStorage.ts.
  • UI:
    • Update FinalStep.tsx and ImportExtensions.tsx to handle import completion and errors.
    • Adjust UI elements to reflect import status in ImportExtensions.tsx.

This description was created by Ellipsis for fdc0746. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to e5d829c in 1 minute and 38 seconds

More details
  • Looked at 598 lines of code in 8 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. .prettierignore:4
  • Draft comment:
    Remove temporary lines before merging to avoid unintended formatting issues.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment is directly addressing changes in the diff. The lines are explicitly marked as temporary in the code itself with "do not merge with this" comments. The comment is essentially redundant since the code already makes this clear. Additionally, this is a .prettierignore file which is a development tool configuration, not application logic.
    The comment could be helpful as an extra reminder to prevent accidental merging of temporary changes. Development tool configurations can affect code quality.
    While true, the code itself already contains clear "do not merge" comments. An additional PR comment doesn't add meaningful value and could be considered noise.
    Delete the comment since it's redundant with the explicit "do not merge" comments in the code itself.
2. core/protocol/ide.ts:94
  • Draft comment:
    Ensure that the change in return type for importUserSettingsFromVSCode is consistently applied across all usages to prevent type errors.
  • Reason this comment was not posted:
    Comment did not seem useful.
3. core/protocol/ideWebview.ts:26
  • Draft comment:
    Ensure consistent use of semicolons or commas in object type definitions for clarity and to prevent potential errors.
  • Reason this comment was not posted:
    Comment did not seem useful.
4. extensions/vscode/src/commands.ts:262
  • Draft comment:
    Consider handling the boolean return value of importUserSettingsFromVSCode to manage success or failure scenarios effectively.
  • Reason this comment was not posted:
    Marked as duplicate.
5. extensions/vscode/src/copySettings.ts:142
  • Draft comment:
    Re-evaluate the necessity of the 1-second delay in copyVSCodeSettingsToPearAIDir to optimize performance.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    In copySettings.ts, the copyVSCodeSettingsToPearAIDir function has a hardcoded delay of 1 second. This could lead to unnecessary waiting time if the operation completes faster.
6. extensions/vscode/src/extension/VsCodeMessenger.ts:110
  • Draft comment:
    Utilize the boolean return value of importUserSettingsFromVSCode to handle success or failure scenarios appropriately.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_dEjVeX7IYumqd8ue


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 3e98ca7 in 13 seconds

More details
  • Looked at 75 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. gui/src/pages/welcome/setup/ImportExtensions.tsx:62
  • Draft comment:
    Use double quotes for strings to maintain consistency with the rest of the codebase.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of single quotes for strings is inconsistent with the rest of the codebase, which uses double quotes. This should be standardized for consistency.
2. gui/src/pages/welcome/setup/ImportExtensions.tsx:83
  • Draft comment:
    Consider implementing the TODO to hide the skip button for the first five seconds to improve user experience.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The TODO comment suggests hiding the skip button for the first five seconds, but this is not implemented. This could be a potential UX improvement.

Workflow ID: wflow_1Ugwui0kg2vu6C06


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on f00f34a in 17 seconds

More details
  • Looked at 24 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. gui/src/pages/welcome/setup/ImportExtensions.tsx:45
  • Draft comment:
    Consider adding 'onNext' to the dependency array of the useEffect hook to ensure it captures the latest reference.
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.

Workflow ID: wflow_CzmjkJiJ9121AAXi


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 04f6d6c in 46 seconds

More details
  • Looked at 65 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_UleVrwOjYXvHSYR9


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 2e5c904 in 16 seconds

More details
  • Looked at 77 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. extensions/vscode/package.json:186
  • Draft comment:
    The PR description mentions syncing VS Code settings without Prettier, but the code changes don't seem to address this specific requirement. Ensure that the changes align with the PR's intent.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. gui/src/pages/welcome/setup/ImportExtensions.tsx:27
  • Draft comment:
    The setTimeout logic for showing the skip button is duplicated. Consider consolidating this logic to avoid redundancy.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The handleImport function uses setTimeout to show the skip button after 3 seconds. This logic is duplicated in the useEffect cleanup function, which is removed. Ensure consistency in handling the skip button visibility.

Workflow ID: wflow_CSDZBVvwdtSZoVss


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 53484bc in 1 minute and 43 seconds

More details
  • Looked at 130 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. extensions/vscode/src/extension/VsCodeMessenger.ts:109
  • Draft comment:
    Consider retaining the type check for 'val' to ensure robustness. Returning 'false' if 'val' is not a boolean can prevent unexpected behavior.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The command being called is "pearai.welcome.importUserSettingsFromVSCode" which is likely a custom command. Since this is a custom command, the implementer would know what type it returns. The try/catch block already handles errors and returns false in that case. The type check seems overly defensive and adds complexity without clear benefit.
    The comment raises a valid point about type safety. What if the command implementation changes in the future to return a non-boolean value?
    The command is part of the same codebase and its contract should be maintained through normal code review processes. Adding defensive type checks everywhere creates unnecessary complexity. The error case is already handled.
    The comment should be deleted. The type check was unnecessary defensive programming that added complexity without clear benefit, and error cases are already handled by the try/catch block.
2. gui/src/pages/gui.tsx:300
  • Draft comment:
    The removal of 'localStorage.removeItem("importUserSettingsFromVSCode");' is consistent with the changes in ImportExtensions.tsx where this item is no longer used.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The removal of the localStorage item 'importUserSettingsFromVSCode' is consistent with the changes in the ImportExtensions component, where this item is no longer used.
3. gui/src/pages/welcome/setup/ImportExtensions.tsx:36
  • Draft comment:
    Ensure 'isDoneImportingUserSettingsFromVSCode' is consistently used across the codebase to maintain state across sessions.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The use of localStorage for 'isDoneImportingUserSettingsFromVSCode' is consistent across the codebase, ensuring the state is preserved across sessions.

Workflow ID: wflow_pgs3xDTpmXg5gAms


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@lenghuang lenghuang changed the title [wip] Feat/lh/sync loading of vs code settings without prettier [wip] Wait for VSCode Settings Import to finish before proceeding to next step Jan 28, 2025
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 3307be3 in 20 seconds

More details
  • Looked at 24 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_MFbdfzZczjgb0QOW


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@lenghuang lenghuang changed the title [wip] Wait for VSCode Settings Import to finish before proceeding to next step Wait for VSCode Settings Import to finish before proceeding to next step Jan 28, 2025
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on fdc0746 in 11 seconds

More details
  • Looked at 15 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. .prettierignore:3
  • Draft comment:
    Ensure that the removal of these lines is intentional and that no local development settings are needed in the main codebase.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The changes in the .prettierignore file seem to be removing temporary local dev settings. This is a good practice to ensure that local development settings do not interfere with the main codebase.

Workflow ID: wflow_sgGdK45ghl5KKZr3


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@nang-dev nang-dev merged commit a83a9c2 into main Jan 29, 2025
2 checks passed
nang-dev pushed a commit that referenced this pull request Feb 4, 2025
…tep (#250)

* copy over what i have from other branch but without less formatting changes

* temp

* undo some formatting changes

* undo some more formatting

* only show skip button after 3 seconds

* move idemessenger helper back and tweak skip timer not showing up

* check is done on local storage

* remove comments

* remove prettier ignore changes
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.

Wait for vscode copy over settings to finish
2 participants