Skip to content

Code-type codelenses now prompt for a runtime #1112

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 3 commits into from
May 27, 2020

Conversation

bryceitoc9
Copy link
Contributor

Description

Codelenses in source now prompt the user on which runtime to use for the created debug config instead of assuming the newest.

CONSIDERATION: now that we're creating a quick pick, should we also use a quick pick instead of the modal that pops up when using a template codelens with a legacy configuration?

Motivation and Context

Results of a bug bash

Testing

Tested manually with all three runtime families.

Checklist

  • I have read the README document
  • I have read the CONTRIBUTING document
  • My code follows the code style of this project
  • I have added tests to cover my changes
  • All new and existing tests passed
  • A short description of the change has been added to the changelog using the script npm run newChange

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@bryceitoc9 bryceitoc9 requested a review from a team as a code owner May 26, 2020 23:24
* Returns a set of runtimes for a specified runtime family or undefined if not found.
* @param family Runtime family to get runtimes for
*/
function getRuntimesForFamily(family: RuntimeFamily): Set<Runtime> | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: probably makes sense to refactor the various runtime lists into a map later. Off-topic for this PR.

pseudocode:

export runtimes = { 
  RuntimeFamily.Node: Set<Runtime>(['nodejs12.x', 'nodejs10.x', 'nodejs8.10']),
  RuntimeFamily.Python: Set<Runtime>(['python3.8', 'python3.7', 'python3.6', 'python2.7']),
  ...,
}

This would eliminate nodeJsRuntimes, pythonRuntimes, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will drop a TODO for this. I'm getting sick and tired of the various wrappers we have around suggested runtimes but I'm afraid that it'll make this PR balloon pretty badly.

* Creates a quick pick for a Runtime with the following parameters (all optional)
* @param params buttons: array of buttons to add to the quick pick;
* currRuntime: Runtime to set a "Selected Previously" mark to;
* runtimeFamily: a RuntimeFamily that will define the list of runtimes to show (default: samLambdaCreatableRuntimes)
Copy link
Contributor

@justinmk3 justinmk3 May 27, 2020

Choose a reason for hiding this comment

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

Does docstring format have a better way to document these "keywords style" params?

Maybe this is good enough as a hack:

@param buttons ...
@param currRuntime ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like this is the correct way to do it: https://jsdoc.app/tags-param.html#parameters-with-properties

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI, while that's the technically correct way to do it, it doesn't look like Typescript (and thus, VS Code) has implemented it yet: microsoft/TypeScript#11597

@bryceitoc9 bryceitoc9 merged commit a711128 into feature/debugconfig May 27, 2020
@bryceitoc9 bryceitoc9 deleted the bryceito/runtime-select branch May 27, 2020 03:51
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