-
Notifications
You must be signed in to change notification settings - Fork 19
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
Apply code formatting config to all source files #406
Comments
#143 falls under this issue |
I need to revisit the .editorconfig, recently my vscode C# got updated (I assume) because it's giving new suggestions that aren't in the editor config and were not previously defaults: remove "this" qualifier on member variables/methods/properties when they are not shadowing a local non-member identifierpersonally, I don't like this default, I prefer members to be qualified with "this" because it makes code easier to read at the expense of being slightly more verbose to type use explicit type instead of varI believe this has been our recommended coding style, but I don't think my editor used to complain use lowercase identifier for builtin types instead of capitalised (ie. double instead of Double)new expression can be simplifiedinstead of object initialisation can be simplifiedhere's a real world example from our codebase:
after:
The indentation is messed up here but the idea is to assign fields values inside a member initialiser list that's tacked on to the end of the constructor (in this case, it's the default ctor, but this syntax also works for something like |
I definitely agree with using 'this' by default. It also helps with autocomplete when typing. Using 'new()' instead of 'var' seems fair. Object initialization seems cool but I haven't used it enough to have much of an opinion. It does make it easier to hide setters. |
#163 introduced a .editorconfig with code formatting rules. Reformat all .cs (and .gd?) files at once. Going forward devs should use this file in their IDE if possible, and format changes accordingly. But first let's settle on what the formatting rules should be.
I recommend we follow Godot's own C# style guide, and Microsoft's as a fallback. Discuss formatting here.
The text was updated successfully, but these errors were encountered: