-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add support for Predefined List in Code Generation extension #23
Add support for Predefined List in Code Generation extension #23
Conversation
Nice, thank you! |
Co-authored-by: Zoltán Lehóczky <[email protected]>
Added some smarter formatting to handle simple arrays. Let me know if I missed anything else. |
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, almost perfect!
Co-authored-by: Zoltán Lehóczky <[email protected]>
… of https://github.com/CloudConstruct/Helpful-Extensions into extension/code-generation/add-predefined-list-handling
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.
Thank you!
Co-authored-by: Zoltán Lehóczky <[email protected]>
Any news on this in the meantime? There's very little missing. |
Sorry I let this slip. I'll wrap it up this week. |
How about now? :) |
@Piedone I made the requested updates. The changed file list looks crazy although I only changed a single file. Do you want me to close this and create a new PR? |
The target branch should now be |
@Piedone Updated to use |
Co-authored-by: Zoltán Lehóczky <[email protected]>
Co-authored-by: Zoltán Lehóczky <[email protected]>
I mean, when #23 (comment) is also done ;). |
@Piedone that change is already done unless I'm missing something.
|
I commented before your commit :). I'll check it out. |
case JArray jArray: | ||
return $"new[] {{ {string.Join(", ", jArray.Select(ConvertJToken))} }}"; | ||
var format = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4))}"; |
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.
var format = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4))}"; | |
var indentation = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4))}"; |
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.
You can simplify this by using this string
constructor:
var format = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4))}"; | |
var indentation = new string(' ', indentationDepth + 4); |
The same goes for the other occurence.
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.
@devlife Did you see these suggestions?
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.
Ah no I did not. I replaced the string.Join statements with the string ctor.
Co-authored-by: Zoltán Lehóczky <[email protected]>
Co-authored-by: Zoltán Lehóczky <[email protected]>
Co-authored-by: Zoltán Lehóczky <[email protected]>
Co-authored-by: Zoltán Lehóczky <[email protected]>
Co-authored-by: Zoltán Lehóczky <[email protected]>
Hey guys. Any other changes you'd like to see? |
There are build errors, and #23 (comment) (the variable name) is not addressed. |
… of https://github.com/CloudConstruct/Helpful-Extensions into extension/code-generation/add-predefined-list-handling
I updated the variable name but it compiles without any issues for me. Can you point me to the build issues you're seeing? |
Well, now it compiles with your new commits ;). #23 (comment) is not addressed though. |
comment 23 is addressed! |
Thanks for fixing the other occasions too! |
And it's released, also on NuGet: https://github.com/Lombiq/Helpful-Extensions/releases/tag/v2.1.0 |
Thank YOU for your long wind! |
Problem
When using the Code Generation extension, if a
TextField
with an editor ofPredefined List
outputs the following textHowever, the source code indicates that we should use type OrchardCore.ContentFields.Settings.ListValueOption
Resolution
When a
JObject
is passed intoConvertJToken
we return a string using the name/value pair as theName
andValue
properties respectively.Screenshot