Using EditorConfig with Synergy projects
EditorConfig is a feature in Visual Studio 2017 and higher that enables you to specify code editor settings in a text file (named .editorconfig) that can be applied to any Visual Studio project or solution. These settings override corresponding text editor settings made from the Visual Studio UI (e.g., in the Options window), enabling you to use this feature to enforce a coding style across multiple machines.
An .editorconfig file can be added to solutions or projects, can be used for multiple projects and solutions, and can be added to source control.
When you add an EditorConfig file to a project or solution, existing code will not be formatted to match the settings in the EditorConfig file unless you use the Format Document feature (Edit > Advanced > Format Document) to reformat the code. New code, however, will be formatted according to EditorConfig settings that apply to it. |
The following is a basic outline of how you could use an .editorconfig file with your Synergy/DE projects. It includes a list of supported settings (in step 4 below). For more information, see Visual Studio documentation (e.g., docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options) and the EditorConfig site (editorconfig.org).
1. | Create a file with the name .editorconfig, open the file in a text editor, and add a “root” setting at the top of the file. For example: |
root = true
If root is set to “true”, no higher-level .editorconfig files are used when this .editorconfig file applies. If it is set to “false”, higher-level .editorconfig files that apply are used.
2. | Add a section heading under the root setting. A section heading specifies which source files will be affected by settings that follow the section heading. Section headings are enclosed in square brackets and can have wildcards. For example, the following specifies that settings under this heading will affect all files with the .dbl extension: |
[*.dbl]
See wildcard pattern information at editorconfig.org for more information.
3. | Add editor settings under the section heading. The following settings are supported for Synergy projects: |
- indent_style – can be set to “tab” or “space”. For example,
indent_style = space
indent_size = 4
tab_width = 2
For more information on these settings, see EditorConfig documentation (e.g., github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties).
4. | Add other sections as necessary, and then add the .editorconfig file to solutions or projects (e.g. by using the Project > Add Existing Item menu entry). |