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

Amplify environment plugin requires restart of VSCode after pulling new environment #3

Open
abdallahshaban557 opened this issue Jun 11, 2022 · 12 comments

Comments

@abdallahshaban557
Copy link

Hi Poya,

I have noticed that after I create a new Amplify project, or pull a project using the CLI, I need to restart VSCode before the plugin starts showing my environment details.

Is this something that can be addressed?

@poyashad
Copy link
Owner

Hi @abdallahshaban557 I think this is possible by also having a filesystem watcher on the team provider file. I will have a look at it

@abdallahshaban557
Copy link
Author

Awesome! Thank you, Poya!

@poyashad
Copy link
Owner

Hi @abdallahshaban557,

I think I have found a solution.

I looked at the activation events (specific events that activate the extension). Before this feature request, the extension activation event was an event that looked for a team-provider-info.json file in the workspace at startup. This was only triggered at startup, and if the file was not found, the extension was not activated. And if the file was added later while vs code was running, this new file was not caught by the activation event.

With this fix, the extension is activated at startup, but in a kind of silent mode with a file system watcher subscription. When the file system watcher detects the creation of the team-provider-info.json file. Then the extension is activated.

This means that when you create a new Amplify project, or pull a project using the CLI, the extension will detect the creation of the team-provider-info.json and display the extension in the status bar.

Thanks for the feature request, please let me if this fix works for you and what you think.

Best Regards!

@abdallahshaban557
Copy link
Author

Will try this out! Thank you so much, @poyashad!

@abdallahshaban557
Copy link
Author

I am noticing this error when I do these steps:

  • I deleted my Amplify project locally using the CLI (the Amplify Environment was not removed)
  • I pulled another Amplify project to my local machine
  • I started seeing multiple environments from the Extension

image

@poyashad
Copy link
Owner

Thanks for testing it out @abdallahshaban557 !

I think the extension will have to do some checks and also watch for when the project gets deleted. And go into "silent mode" again.

I will take a look at it!

@poyashad
Copy link
Owner

poyashad commented Jun 29, 2022

Hi @abdallahshaban557,

Since the extension did not detect the deletion of the team-provider-info.json file, it could not disable/deactivate/hide the extension. I have now added a file system watcher that looks for a deletion. Could you please run some tests to see if it works as intended?

Thanks!

@abdallahshaban557
Copy link
Author

Hi @poyashad - I have tried it again, and it seems the issue was not resolved. I am still seeing duplicate environments when I try to remove an Amplify project.

@poyashad
Copy link
Owner

poyashad commented Jul 4, 2022

Hi @abdallahshaban557, i will take a look and try to duplicate the issue!

@poyashad
Copy link
Owner

poyashad commented Sep 5, 2022

Hi @abdallahshaban557 Sorry for the inactivity! Could you please just post the AWS Amplify CLI commands that are triggering this issue? I will try to replicate the problem.

@abdallahshaban557
Copy link
Author

Hi @poyashad - The command I was using is amplify pull

@poyashad
Copy link
Owner

Thanks @abdallahshaban557 i will try to replicate and debug.

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

No branches or pull requests

2 participants