VSCode is ignoring .editorconfig settings for csharp files in certain folders

89 views Asked by At

I am attempting to configure VSCode for use with a Unity C# project. The formatter is running, but not always following the rules in my .editorconfig file.

I have created a new VSCode profile and installed the following plugins:

  • EditorConfig
  • C#
  • Unity

This automatically installed the following dependencies:

  • C # Dev Kit
  • IntelliCode for C# Dev Kit
  • .NET Install Tool

I have a basic .editorconfig file in the root of my project with the following settings:

# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
indent_style = tab
indent_size = 4

# C# Formatting Rules
[*.cs]
csharp_new_line_before_open_brace = none
csharp_space_around_declaration_statements = ignore
csharp_space_around_binary_operators = ignore

In my VSCode profile settings.json I have set the following:

    "editor.formatOnSave": true,
    "[csharp]": {
        "editor.defaultFormatter": "ms-dotnettools.csharp",
        "editor.codeActionsOnSave": [
            "source.organizeImports",
            "source.fixAll"
        ]
    }

For some reason this is not working correctly. The formatter is correctly using the .editorconfig settings when applied to scripts in the /Editor/ folder, but is not using the correct options when applied to scripts in other folders, such as /Scripts/.

Why is VSCode ignoring my settings for csharp scripts in certain subfolders? I only have a single .editorconfig.

0

There are 0 answers