Possible to set this up within Jetbrains Rider using the folder watch to format on save?
See original GitHub issueHas anyone set this up with Rider? I have never set up a watcher from scratch as with GoLand you just tell it to format on save and it is built into the IDE, but I would imagine it should be possible to set this up to be able to format the particular file you are working on and autoformat it on file save?
I tried to see if I could get a single folder to format but I believe I might have done it incorrectly as nothing happened. When I omitted the --files and subsequent path it did indeed work, but of course it did the entire project which then forced a reimport of all of the files into Unity which would end up becoming quite time consuming on larger projects.
This is what I attempted:
dotnet-format -v diag --workspace /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Navigation_DOTS_20192.sln --files /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Assets/_instance.id/_ECS/scripts/Waypoint/Systems
I made a few purposeful changes to force the need for formatting and tried again with increased verbosity:
~ » dotnet-format -v diag --workspace /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Navigation_DOTS_20192.sln --files /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Assets/_instance.id/_ECS/scripts/Waypoint/Systems
Formatting code files in workspace '/home/mosthated/_dev/_unity/Navigation_DOTS_20192/Navigation_DOTS_20192.sln'.
Loading workspace.
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Sirenix.OdinInspector.CompatibilityLayer.Editor.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Sirenix.OdinInspector.CompatibilityLayer.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/BovineLabs.Entities.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Assembly-CSharp-firstpass.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Sirenix.OdinInspector.CompatibilityLayer.Editor.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Sirenix.OdinInspector.CompatibilityLayer.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/BovineLabs.Entities.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Assembly-CSharp-firstpass.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Sirenix.OdinInspector.CompatibilityLayer.Editor.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Sirenix.OdinInspector.CompatibilityLayer.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/BovineLabs.Entities.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Assembly-CSharp-firstpass.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Assembly-CSharp.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Assembly-CSharp-Editor-firstpass.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Sirenix.OdinInspector.CompatibilityLayer.Editor.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Sirenix.OdinInspector.CompatibilityLayer.csproj
Found project reference without a matching metadata reference: /home/mosthated/_dev/_unity/Navigation_DOTS_20192/BovineLabs.Entities.csproj
Complete in 2385ms.
Determining formattable files.
Complete in 188ms.
Running formatters.
Complete in 11ms.
Formatted 0 of 395 files.
Format complete in 2589ms.
This is what ended up working though and did all files.
dotnet-format -v diag --workspace /home/mosthated/_dev/_unity/Navigation_DOTS_20192/Navigation_DOTS_20192.sln
Issue Analytics
- State:
- Created 4 years ago
- Comments:20 (11 by maintainers)
Top GitHub Comments
Same - I’m so happy there’s a formatter for .NET, because having it in JavaScript is amazing with Prettier. I just don’t even worry about formatting anymore, I just left Prettier take care of it. The possibilities of stuff that can be done is making me really excited.
@JoeRobich thanks for your help!