-
Notifications
You must be signed in to change notification settings - Fork 816
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
fix: get the defaultEditor value from the localEnvInfo context variable #9783
fix: get the defaultEditor value from the localEnvInfo context variable #9783
Conversation
Get the defaultEditor value from the context when the local-env-info.json file has not been created yet fix aws-amplify#8356
…nto cli/add-default-editor-to-config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @flozender, thanks for the contribution. What do you think about adding this to the getEditor
method instead as the fallback value in the if/else statement?
Ah, yes - that should be better! |
Codecov Report
@@ Coverage Diff @@
## master #9783 +/- ##
==========================================
+ Coverage 53.10% 53.26% +0.15%
==========================================
Files 830 830
Lines 45991 45993 +2
Branches 9820 9822 +2
==========================================
+ Hits 24423 24497 +74
+ Misses 19556 19487 -69
+ Partials 2012 2009 -3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks!
I was just looking at this test, and it looks like it may be easy to stub the context out and write a unit test. Do you mind adding one? You can add a |
Sure, I can get that done! |
…nto cli/add-default-editor-to-config
mockContext.exeInfo = { | ||
inputParams: {}, | ||
localEnvInfo: { | ||
defaultEditor: 'Visual Studio Code', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please use a defaultEditor value from this list https://github.com/aws-amplify/amplify-cli/blob/master/packages/amplify-cli/src/extensions/amplify-helpers/editor-selection.ts#L5-L42 . ( please use the value "vscode" instead of the name "Visual Studio Code" in this test)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
it could be that on Windows the executable is named "Visual Studio Code". no need to change then.
👋 Hi, this pull request was referenced in the v7.6.23 release! Check out the release notes here https://github.com/aws-amplify/amplify-cli/releases/tag/v7.6.23. |
Description of changes
Get the default editor value from the context variable when the
local-env-info.json
file has not been created yet.Issue #, if available
Closes #8356
Description of how you validated changes
The default editor now shows up on running
amplify configure project
since thelocal-env-info.json
file now has thedefaultEditor
key.yarn test
also passes.Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.