BoltEngine / Bolt-Tracker

New issue tracker for Photon Bolt
10 stars 2 forks source link

Feature Request: Mergeable json formatting #177

Closed HenryStratton closed 3 years ago

HenryStratton commented 3 years ago

Feature Request: Provide the option to serialize the bolt project.json as a non-minified/pretty format. Currently the minified formatting makes it impossible to attempt merges between developer changes when conflicts occur, as the entire file is treated as a single change.

Having this format in a 'pretty' format across multiple lines would allow developers to try and manage and resolve conflicts without having to resolve with one and redo the work, and it avoids having to implement custom workarounds to reformat that file on save.

tfJonathan commented 3 years ago

This would indeed be a huge help, trying to merge project.json has not been a great experience.

HenryStratton commented 3 years ago

This would indeed be a huge help, trying to merge project.json has not been a great experience.

One of our devs is going to look at writing an asset importer for text assets that will specifically look for the project.json file for bolt and re-format it any time it changes to try and address this, will see how that works out as a workaround in the meantime.

ramonmelo commented 3 years ago

Hello @HenryStratton

The formatting depends on the Bolt DLL Mode, in Debug Mode, it will be formatted to facilitate the reading of the project.json file for debugging purposes, while when in Release Mode, there are no spaces applied so we save a bit of space. If you are changing the Bolt Assets with different modes, you will indeed have different results in the formatting. It's done that way to facilitate when developing but optimize when releasing. We are already considering exposing a setting for this or have it fixed to the indented format.

Meanwhile, you can take a look at the script here. It will create a new Menu Item to Compile and Reformat that JSON file.

tfJonathan commented 3 years ago

@ramonmelo Does the Project.json get used in build ? I was assuming it only gets used for code generation in the editor. Cause if it's not used in build the space saved by removing styling from the json is not really worth it.

ramonmelo commented 3 years ago

Hi,

Yes, it's used only to generate code in the Editor.

We've changed the internal serializer to always save the file as indented. Available on the next release.

Thanks for your feedback.