Saturn.Cli icon indicating copy to clipboard operation
Saturn.Cli copied to clipboard

Wrong indentation with the saturn gen command

Open mrkaspa opened this issue 7 years ago • 5 comments

dotnet saturn gen command generates modules indented with 2 spaces and the project scaffold has 4 space indentation

mrkaspa avatar Jul 18 '18 20:07 mrkaspa

When you mention the project scaffold, do you mean what you get by running dotnet new Saturn, e.g. https://github.com/SaturnFramework/Saturn.Template? Or do you mean https://github.com/fsprojects/ProjectScaffold?

This brings up an interesting question. What if someone prefers 4-space indents, and wants dotnet saturn gen to generate code that matches their style? Should the gen code look for a .editorconfig file and follow its indentation guidelines if it exists? Defaulting to 2-space indents seems sensible given that the Giraffe View Engine ends up having lots of nesting in your view functions. But if a project has already created a .editorconfig file specifying the project's preferred indent levels, then I think library users would appreciate having the dotnet saturn gen command match what they specified in .editorconfig.

rmunn avatar Jul 19 '18 03:07 rmunn

@rmunn it might be possible to use something like https://github.com/amyboyd/editorconfig-cli as a post-template action to make sure the code is in sync with the users preferences?

baronfel avatar Jul 19 '18 03:07 baronfel

I don't think we can do post-template action for formatting to correct indent... as we don't have formatter that's working well enough for F#. And, while fixing generator to look at the .editorconfig and doing correct indent should be fairly easy to do, i don't think there is a good way to do something like that for dotnet new commands.

Anyway, I certainly agree that both template and dotnet saturn gen should use the same indenting

Krzysztof-Cieslak avatar Aug 03 '18 18:08 Krzysztof-Cieslak

Moved the issue to correct repo.

Krzysztof-Cieslak avatar Dec 10 '18 15:12 Krzysztof-Cieslak

I'd be happy to work on this after #23 is reviewed.

ZaymonFC avatar Aug 06 '19 22:08 ZaymonFC