Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

UTY-2643: fix codegen indentation #1424

Merged
merged 3 commits into from
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
### Fixed

- Fixed a bug in the Worker Inspector where component foldouts were being rendered too often, causing poor performance when the entity had many components or very complex components. [#1403](https://github.com/spatialos/gdk-for-unity/pull/1403)
- Fixed minor indentation issue in generated code caused by newline formatting. [#1424](https://github.com/spatialos/gdk-for-unity/pull/1424)

### Internal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public string Format(int indentLevel)
{
var spaces = CommonGeneratorUtils.GetIndentSpaces(indentLevel);
var indentedCode = snippet
.Replace($"{Environment.NewLine}", $"{Environment.NewLine}{spaces}")
.Replace("\r\n", "\n")
.Replace("\n", $"{Environment.NewLine}{spaces}")
.Replace($"{Environment.NewLine}{spaces}{Environment.NewLine}", $"{Environment.NewLine}{Environment.NewLine}");
return $"{spaces}{indentedCode}";
}
Expand Down