-
Notifications
You must be signed in to change notification settings - Fork 169
Consider using Coding Style and .editorconfig #342
Comments
Thanks for the suggestion! We've discussed standardizing the coding style recently. An .editorconfig file sounds like a good idea. It looks like a lot of editors have support for it, including Visual Studio and Visual Studio Code. We're also interested in tools to automatically check code style, for example as part of the automated builds for PRs. It looks like dotnet-format can do this, but we're open to other suggestions. |
In C# extension in VS Code, editorconfig support is an opt in flag for OmniSharp (https://www.strathweb.com/2019/07/editorconfig-support-in-omnisharp-and-c-extension-vs-code/), we hide most of these newer features behind an opt-in flag on order to keep the base featureset is as lightweight as possible. but yes it definitely makes sense to me too! For enforcing code style at build time you can also have a look at |
We actually have an editorconfig for the samples repo for precisely this reason. We've looked into using dotnet-format with precommit before to help with code style, but to limited success. |
I'm starting to work on an .editorconfig file in the marshallsa/editorconfig branch. Some mixed results so far. First, it seems like the only way to reformat @rstm-sf's
becomes
I think this is unnecessary, but I can't find a way to apply the reformatting to Second, it seems like Visual Studio does not support reformatting F# files at all. So unfortunately we might have to manually enforce an F# coding style. At least it could still be a good idea to write out some of the rules explicitly so we can refer back to them (probably based on the F# style guide with a few modifications), unless someone knows another way to auto-format F#. |
It seems to me that the following option looks better It seems that I was mistaken in that I looked at the settings of editorconfig from far: for such a case it is difficult to choose an option. Maybe because it is not popular? Before that, I saw two equivalent options:
and
But this was the first time I met such an option and it seems to me that it is overloaded: trying to fit everything on one line only complicates further support |
There is a Fantomas project. It also has an issue supporting editorconfig fsprojects/fantomas#650 |
We reformatted all of the C# code using StyleCop, so the code sample mentioned in the original post has been fixed. :) The F# code still has no formatting rules currently, though, so I'll leave this issue open until we do. Thanks @rstm-sf for pointing out Fantomas! |
Hello!
Please, consider using Coding Style and .editorconfig. Because it’s unusual to see, for example, the following code
qsharp-compiler/src/QsCompiler/Compiler/CompilationLoader.cs
Lines 408 to 409 in 9bdc214
The text was updated successfully, but these errors were encountered: