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

Provide adding decorators as quickfix. Fixes #1406 #5544

Merged
merged 7 commits into from
Jan 27, 2022

Conversation

nilshedstrom
Copy link
Contributor

This PR adds the ability to add common decorators for parameters (as suggested in #1406).

The implementation is based on "Codefix example" made by @anthony-c-martin

The following decorators are supported

  • secure
  • description
  • allowed
  • minLength
  • maxLength
  • minValue
  • maxValue

Note that it will only be possible to add a decorator if it is supported by the current parameter type (minValue and maxValue can only be added to parameters of type int as an example).

The changes to src/Bicep.LangServer.IntegrationTests/CodeActionTests.cs were made to avoid the tests to get confused by the new fixes provided by ParameterCodeFixProvider (they are tested in src/Bicep.LangServer.IntegrationTests/CodeFixTests.cs)

@nilshedstrom
Copy link
Contributor Author

I do not understand why my changes caused a "Azure.Identity.CredentialUnavailableException: EnvironmentCredential authentication unavailable. Environment variables are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/environmentcredential/troubleshoot" in the build so that all "Build / Test CLI (live)" builds failed.

Please tell me what I need to change if my changes are related to the build failures.

@anthony-c-martin
Copy link
Member

@nilshedstrom you can safely ignore the live test failures - they're optional, and the breakages are unrelated to your changes.

Copy link
Member

@anthony-c-martin anthony-c-martin left a comment

Choose a reason for hiding this comment

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

Looks great, thank you very much for contributing!

@StephenWeatherford
Copy link
Contributor

Reverting the checkin - suites are failing. It's likely they started failing after the PR was created. Sorry, Nils. @nilshedstrom

@StephenWeatherford
Copy link
Contributor

@anthony-c-martin Thanks for fixing the test!
@nilshedstrom Thanks for the new features!

davidcho23 pushed a commit that referenced this pull request Feb 1, 2022
* Codefix example

* Made SecureParameterCodeFixProvider more robust

* Trying to fix the tests for CodeActions (after adding the new QuickFix'es)

* Added DescriptionParameterCodeFixProvider

* Refactored and added support for @Allowed, @minlength, @maxlength, @minValue, @MaxValue

* Made ParameterCodeFixProvider more robust

Co-authored-by: Anthony Martin <antmarti@microsoft.com>
Co-authored-by: Hedström, Nils <nils.hedstrom@if.se>
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.

3 participants