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

Code generator improvements #934

Merged

Conversation

cezarypiatek
Copy link
Contributor

No description provided.

@cezarypiatek
Copy link
Contributor Author

@StefH would you mind reviewing/merging this pr? Thanks in advance.

@StefH
Copy link
Collaborator

StefH commented May 12, 2023

@StefH would you mind reviewing/merging this pr? Thanks in advance.

will do later today

@StefH StefH added the feature label May 12, 2023
Copy link
Collaborator

@StefH StefH left a comment

Choose a reason for hiding this comment

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

Some small question... See comments

@@ -537,4 +555,85 @@ private static string FormatArray(JArray jArray, int ind)

return $"new [] {{ {string.Join(", ", items)} }}";
}

private static readonly HashSet<string> csharp_keywords = new HashSet<string>(new[]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you move this to the top of the file?

(And maybe instead of using this list, you can maybe use:
https://github.com/StefH/ProxyInterfaceSourceGenerator/blob/main/src/ProxyInterfaceSourceGenerator/Extensions/SymbolExtensions.cs#L35
) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using SyntaxFacts.GetKeywordKind requires reference to Microsoft.CodeAnalysis.CSharp.
I can extract the whole logic responsible for generating anonymous object to a separate class, what fo you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, maybe a new internal static class, placed in Util folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks

@StefH StefH merged commit 8444c8c into WireMock-Net:master May 13, 2023
@cezarypiatek cezarypiatek deleted the feature/code_generator_improvements branch May 13, 2023 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants