-
Notifications
You must be signed in to change notification settings - Fork 5
C#: implement C# loader plugin #98
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
base: master
Are you sure you want to change the base?
Conversation
Imran-imtiaz48
left a comment
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.
Review Comment on helper.go:
The newly added Indent function:
func Indent(depth int) string {
return strings.Repeat(" ", depth)
}Explanation:
This utility function generates a string consisting of depth repetitions of four spaces. It's a concise and idiomatic way to create indentation for generated code, improving readability and maintainability in code generation scenarios. Whenever you need to output a line with a certain indentation level, you can simply call Indent(level) to get the appropriate amount of leading spaces.
Suggestion:
The implementation is clear and effective. If you anticipate changes to the indent style (for example, switching from 4 spaces to a tab), you could consider defining the indent string as a constant at the top of the file for easier updates:
const indentString = " "
func Indent(depth int) string {
return strings.Repeat(indentString, depth)
}But this is optional. The current code is good as-is!
|
Hi, @pengjipan! please review this PR (tableau C# loader protoc plugin). As you are an experienced and senior C# developer. |
| - Install: **dotnet-sdk-8.0** | ||
| - Change dir: `cd test/csharp-tableau-loader` | ||
| - Generate protoconf: `sh gen.sh` | ||
| - Test: `dotnet run` |
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.
Add the C# code style, which we should obey:
| @@ -0,0 +1,127 @@ | |||
| // Code generated by protoc-gen-csharp-tableau-loader. DO NOT EDIT. | |||
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.
Generated code files should have suffix: .pc.cs, which C++ and Go also uses.
| @@ -0,0 +1,24 @@ | |||
| Microsoft Visual Studio Solution File, Format Version 12.00 | |||
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.
DO NOT USE Microsoft Visual Studio, we should use just VSCode.
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.
This is the default file content created by dotnet new sln
4fde7cb to
472ad69
Compare
|
|
||
| ### Requirements | ||
|
|
||
| - dotnet-sdk-8.0 |
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.
About C# language version, compiler version, and runtime version:
- https://docs.unity3d.com/6000.0/Documentation/Manual/csharp-compiler.html
- https://docs.unity3d.com/6000.0/Documentation/Manual/dotnet-profile-support.html
- https://www.reddit.com/r/Unity3D/comments/1e9vjiz/any_news_about_unity_upgrading_to_new_net_runtime/
We should constrain them accurately.
feat: update go.mod and readme feat: add some template code feat: load from bin feat: only support json and bin feat: hub feat: load methods feat: add filter huboptions feat: a simple example feat: git ignore feat: remove LoadMode feat: update readme feat: csharp ordered map feat: add index feat: encapsulate messager container fix(index): correct csharp index logic and add test examples feat: update index and version feat: simplify some logic feat: escapeIdentifier feat: best practice feat: go mod tidy feat: simplify code and remove gen plugin as parameters feat: use lower camel case for private variables feat: OrderedMapValue not null feat: add MessageParser instead of generic types feat: add test case for load bin feat: classes feat: options and newline feat: delete settings feat: add bat scripts feat: support ordered index feat: update bin ext fix: generate file path feat: use *.pc.cs file ext feat: thread-safe messager container feat: use template to genearate hub feat: update scripts feat: add readonly feat: orderedmap feat: index feat: revert feat: ordered index feat: ident feat: IComparable feat: map key feat: map key feat: use tuple feat: leveld index
What should we have learned?
C# code style:
Example (in practice by a Unity Game)