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

Multichoice implementation contd #4666

Conversation

JanKrivanek
Copy link
Member

Problem

#4490

Solution

  • Added ability to specify multiple values for single parameter (but surfaced only for choices)
  • Overloaded equality comparison for multi-choice values
  • Added ability to express multichoices as single string (for template replacing)
  • Added note into help string
  • Builds upon the previous PR: #4490 implementing support for quote-less choice literals #4574

Checks:

  • [x ] Added unit tests
  • [x ] Added #nullable enable to all the modified files ?

@JanKrivanek JanKrivanek requested a review from a team as a code owner May 3, 2022 10:31
@JanKrivanek JanKrivanek requested a review from vlada-shubina May 3, 2022 17:32
Copy link
Member

@vlada-shubina vlada-shubina left a comment

Choose a reason for hiding this comment

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

Great work!

left some comments inline.

It would be good to add more tests on parsing, reading\writing template cache, help and may be split RPG tests to json parsing and e2e test.

What about JSON schema update? do you plan to make it in separate PR?

src/Microsoft.TemplateEngine.Utils/MultiValue.cs Outdated Show resolved Hide resolved
// Template content preparation
//

string templateConfig = @"
Copy link
Member

Choose a reason for hiding this comment

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

(not actionable):
couple of ideas how to avoid strings (they a hard to manage)

  • use anonymous classes where members match properties
  • after recent refactoring you can create SimpleConfigModel and init its fields

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually considered those test to be a typo of e2e test that can be a bit more performant - so I prefered the input to be as unprocessed as possible

{
return match;
}
List<string?> val = literal.Tokenize().Select(t => ResolveChoice(environmentSettings, t, param)).Where(r => !string.IsNullOrEmpty(r)).ToList();
Copy link
Member

Choose a reason for hiding this comment

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

(not actionable)
it would be great to move from string, string relation to string, object or string, IParameterValue relation for template parameters as part of the further refactoring

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah - that would be much better. However we still likely would need to keep it in edge contracts

@JanKrivanek JanKrivanek requested a review from vlada-shubina May 6, 2022 19:17
@JanKrivanek JanKrivanek merged commit 1fe9608 into dotnet:feature/multichoices May 9, 2022
JanKrivanek added a commit that referenced this pull request May 13, 2022
* #4490 implementing support for quote-less choice literals (#4574)

* #4490 implementing support for quote-less choice literals

* Testfix

* Make the unquoted literals feature opt-in via EnableQuotelessLiterals property

* Localize error message

* Fix code and tests after merge

* Multichoice implementation contd (#4666)

* #4490 implementing support for quote-less choice literals

* #4490 multichoice parameters implementation

* Add Tab completion test cases

* Fix code + tests after merge

* Fix code and unit tests after merging

* Add support for multichoice parameters in join macro

* Improve based on review comments

* fix #4650 - adding validation for multichoice symbols (#4698)

* fix #4650 - adding validation for multichoice symbols

* Adjust error message

* Multichoice refactor quoteless (#4708)

* #4665 Refactoring part 1: Make EnableQuotelessLiterals exposed only to Orchestrator

* Fix parameters localization

* Fix after merge
JanKrivanek added a commit that referenced this pull request May 26, 2022
…ft.TemplateEngine.Abstractions (#4717)

* #4490 implementing support for quote-less choice literals (#4574)

* #4490 implementing support for quote-less choice literals

* Testfix

* Make the unquoted literals feature opt-in via EnableQuotelessLiterals property

* Localize error message

* Fix code and tests after merge

* Multichoice implementation contd (#4666)

* #4490 implementing support for quote-less choice literals

* #4490 multichoice parameters implementation

* Add Tab completion test cases

* Fix code + tests after merge

* Fix code and unit tests after merging

* Add support for multichoice parameters in join macro

* Improve based on review comments

* fix #4650 - adding validation for multichoice symbols (#4698)

* fix #4650 - adding validation for multichoice symbols

* Adjust error message

* #4665 Refactoring part 1: Make EnableQuotelessLiterals exposed only to Orchestrator

* Fix parameters localization

* #4665: Refactor step 2 - lower the Core dependency on Abstractions

* Fix tests - proper fixtures typing

* Fix tests after refactorings - mainly issues with PhysicalFileSystem

* Fix tests

* Revert back to mounted file system in orchestrator for source files

* fix api

* Improve - further removal of IEnvironemnt, test logger improvement, nullability to api, other

* Fix test bug - add log providers to test log factory
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