Skip to content

Auto indent ignores tabsize configured for C# and uses general tab size #8755

@AlphaSheep

Description

@AlphaSheep

Type: Bug

Issue Description

vscode-csharp-indent.mp4

The automatic indentation seems to ignore the language specific setting for editor.tabSize.

The last version that worked correctly was v2.90.60 of the C# extension, and after that, several automatic indentation related things started going wonky. This is still not working as of 2.97.38 of the C# extension.

Steps to Reproduce

My user settings.json contains the following:

{
  "editor.tabSize": 2,
  "[csharp]": {
    "editor.tabSize": 4,
    "editor.defaultFormatter": "csharpier.csharpier-vscode"
  },
  ...

To reproduce, say I have the following code

class SomeClass
{
    void thing() {}
}

Then if I place the cursor between the braces for the thing method and press Enter and type something, say "int".

Expected Behavior

What I'd expect is

class SomeClass
{
    void thing()
    {
        int
    }
}

That is, it should automatically indent using my configured tab size for C# of 4.

Actual Behavior

the result is the following.

class SomeClass
{
    void thing()
  {
    int
  }
}

That is, it's automatically formatted the braces but using an indentation size of 2 spaces (my general tabSize setting).

Extension version: 2.97.38
VS Code version: Code - Insiders 1.106.0-insider (18dcf126ce32be16046183e72da1438a4b4dbed6, 2025-11-07T01:27:38.699Z)
OS version: Windows_NT x64 10.0.26100
Modes:

Logs

C# log

2025-11-07 09:52:32.966 [info] Locating .NET runtime version 9.0.1
2025-11-07 09:52:34.484 [info] Dotnet path: C:\Program Files\dotnet\dotnet.exe
2025-11-07 09:52:34.485 [info] Activating C# + C# Dev Kit...
2025-11-07 09:52:34.916 [info] [stdout] info: Program[0]
      Server started with process ID 13532

2025-11-07 09:52:36.348 [info] [stdout] {"pipeName":"\\\\.\\pipe\\47a76fe3"}

2025-11-07 09:52:36.348 [info] received named pipe information from server
2025-11-07 09:52:36.349 [info] client has connected to server
2025-11-07 09:52:36.521 [info] [Program] Language server initialized
2025-11-07 09:52:40.477 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project C:\Projects\Optalitix\Optalitix.DataSource\Optalitix.DataStore.csproj loaded by C# Dev Kit
2025-11-07 09:52:40.730 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project C:\Projects\Optalitix\Optalitix.DataSource\Example\Example.csproj loaded by C# Dev Kit
2025-11-07 09:52:40.737 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project C:\Projects\Optalitix\Optalitix.DataSource\Tests\Optalitix.DataStore.Tests.csproj loaded by C# Dev Kit
2025-11-07 09:55:39.726 [info] Installing C# dependencies...
2025-11-07 09:55:39.726 [info] 

2025-11-07 09:55:39.726 [info] Platform: win32, x86_64

2025-11-07 09:55:39.726 [info] 

2025-11-07 09:55:39.726 [info] Downloading package 'Language server for Roslyn Copilot integration' 
2025-11-07 09:55:41.138 [info] (47 KB)
2025-11-07 09:55:41.138 [info] .......
2025-11-07 09:55:41.418 [info] .......
2025-11-07 09:55:41.419 [info] ......
2025-11-07 09:55:41.419 [info]  Done!

2025-11-07 09:55:41.420 [info] Validating download...

2025-11-07 09:55:41.420 [info] Integrity Check succeeded.

2025-11-07 09:55:41.421 [info] Installing package 'Language server for Roslyn Copilot integration'

2025-11-07 09:55:41.421 [info] 

2025-11-07 09:55:41.444 [info] Finished

2025-11-07 09:55:41.444 [info] 

2025-11-07 09:55:41.913 [info] Locating .NET runtime version 9.0.1
2025-11-07 09:55:46.625 [info] Dotnet path: C:\Program Files\dotnet\dotnet.exe
2025-11-07 09:55:46.625 [info] Activating C# + C# Dev Kit...
2025-11-07 09:55:47.245 [info] [stdout] info: Program[0]
      Server started with process ID 32644

2025-11-07 09:55:49.154 [info] [stdout] {"pipeName":"\\\\.\\pipe\\3efe4f06"}

2025-11-07 09:55:49.154 [info] received named pipe information from server
2025-11-07 09:55:49.155 [info] client has connected to server
2025-11-07 09:55:49.296 [info] [Program] Language server initialized
2025-11-07 09:55:52.859 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project C:\Projects\Optalitix\Optalitix.DataSource\Tests\Optalitix.DataStore.Tests.csproj loaded by C# Dev Kit
2025-11-07 09:55:52.889 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project C:\Projects\Optalitix\Optalitix.DataSource\Optalitix.DataStore.csproj loaded by C# Dev Kit
2025-11-07 09:55:52.895 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project C:\Projects\Optalitix\Optalitix.DataSource\Example\Example.csproj loaded by C# Dev Kit
2025-11-07 09:56:13.062 [info] Locating .NET runtime version 9.0.1
2025-11-07 09:56:14.103 [info] Dotnet path: C:\Program Files\dotnet\dotnet.exe
2025-11-07 09:56:14.103 [info] Activating C# + C# Dev Kit...
2025-11-07 09:56:14.422 [info] [stdout] info: Program[0]
      Server started with process ID 33788

2025-11-07 09:56:15.596 [info] [stdout] {"pipeName":"\\\\.\\pipe\\3add00d0"}

2025-11-07 09:56:15.596 [info] received named pipe information from server
2025-11-07 09:56:15.597 [info] client has connected to server
2025-11-07 09:56:15.703 [info] [Program] Language server initialized
2025-11-07 09:56:18.855 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project C:\Projects\Optalitix\Optalitix.DataSource\Example\Example.csproj loaded by C# Dev Kit
2025-11-07 09:56:18.893 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project C:\Projects\Optalitix\Optalitix.DataSource\Optalitix.DataStore.csproj loaded by C# Dev Kit
2025-11-07 09:56:18.900 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project C:\Projects\Optalitix\Optalitix.DataSource\Tests\Optalitix.DataStore.Tests.csproj loaded by C# Dev Kit

C# LSP Trace Logs log


Environment Information

VSCode version: 1.106.0-insider
C# Extension: 2.97.38
Using OmniSharp: false

Dotnet Information .NET SDK: Version: 9.0.306 Commit: cc9947ca66 Workload version: 9.0.300-manifests.abe91478 MSBuild version: 17.14.28+09c1be848

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.306\

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
Version: 9.0.10
Architecture: x64
Commit: e1f19886fe

.NET SDKs installed:
8.0.415 [C:\Program Files\dotnet\sdk]
9.0.306 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Visual Studio Code Extensions
Extension Author Version Folder Name
black-formatter ms-python 2025.3.11831009 ms-python.black-formatter-2025.3.11831009
bun-vscode oven 0.0.31 oven.bun-vscode-0.0.31
code-spell-checker streetsidesoftware 4.2.6 streetsidesoftware.code-spell-checker-4.2.6
code-viz-stat vizzuhq 0.1.4 vizzuhq.code-viz-stat-0.1.4
cpptools-extension-pack ms-vscode 1.3.1 ms-vscode.cpptools-extension-pack-1.3.1
cpptools-themes ms-vscode 2.0.0 ms-vscode.cpptools-themes-2.0.0
csdevkit ms-dotnettools 1.70.3 ms-dotnettools.csdevkit-1.70.3-win32-x64
csharp ms-dotnettools 2.97.38 ms-dotnettools.csharp-2.97.38-win32-x64
csharpier-vscode csharpier 2.1.0 csharpier.csharpier-vscode-2.1.0
debugpy ms-python 2025.15.2025110501 ms-python.debugpy-2025.15.2025110501-win32-x64
docker docker 0.18.0 docker.docker-0.18.0-win32-x64
gitlens eamodio 17.6.2 eamodio.gitlens-17.6.2
hexeditor ms-vscode 1.11.1 ms-vscode.hexeditor-1.11.1
jupyter ms-toolsai 2025.10.2025101002 ms-toolsai.jupyter-2025.10.2025101002-win32-x64
jupyter-keymap ms-toolsai 1.1.2 ms-toolsai.jupyter-keymap-1.1.2
jupyter-renderers ms-toolsai 1.3.2025062701 ms-toolsai.jupyter-renderers-1.3.2025062701
karma-problem-matcher rctay 1.0.1 rctay.karma-problem-matcher-1.0.1
live-server ms-vscode 0.4.16 ms-vscode.live-server-0.4.16
makefile-tools ms-vscode 0.12.17 ms-vscode.makefile-tools-0.12.17
markdown-mermaid bierner 1.29.0 bierner.markdown-mermaid-1.29.0
material-product-icons PKief 1.7.1 pkief.material-product-icons-1.7.1
mypy-type-checker ms-python 2025.3.12581007 ms-python.mypy-type-checker-2025.3.12581007
prettier-vscode esbenp 11.0.0 esbenp.prettier-vscode-11.0.0
pylint ms-python 2025.3.12271016 ms-python.pylint-2025.3.12271016
python ms-python 2025.17.2025110501 ms-python.python-2025.17.2025110501-win32-x64
remote-containers ms-vscode-remote 0.430.0 ms-vscode-remote.remote-containers-0.430.0
remote-wsl ms-vscode-remote 0.104.3 ms-vscode-remote.remote-wsl-0.104.3
rust-analyzer rust-lang 0.4.2671 rust-lang.rust-analyzer-0.4.2671-win32-x64
slidev antfu 51.4.0 antfu.slidev-51.4.0
sqlite-viewer qwtel 0.10.6 qwtel.sqlite-viewer-0.10.6-win32-x64
volar Vue 3.1.3 vue.volar-3.1.3
vscode-containers ms-azuretools 2.2.0 ms-azuretools.vscode-containers-2.2.0
vscode-counter uctakeoff 3.7.2 uctakeoff.vscode-counter-3.7.2
vscode-dotnet-runtime ms-dotnettools 2.3.9 ms-dotnettools.vscode-dotnet-runtime-2.3.9
vscode-ebnf igochkov 1.4.0 igochkov.vscode-ebnf-1.4.0
vscode-firefox-debug firefox-devtools 2.15.0 firefox-devtools.vscode-firefox-debug-2.15.0
vscode-graphql GraphQL 0.13.2 graphql.vscode-graphql-0.13.2
vscode-graphql-syntax GraphQL 1.3.8 graphql.vscode-graphql-syntax-1.3.8
vscode-icons vscode-icons-team 12.15.0 vscode-icons-team.vscode-icons-12.15.0
vscode-jest Orta 6.4.4 orta.vscode-jest-6.4.4
vscode-jupyter-cell-tags ms-toolsai 0.1.9 ms-toolsai.vscode-jupyter-cell-tags-0.1.9
vscode-jupyter-slideshow ms-toolsai 0.1.6 ms-toolsai.vscode-jupyter-slideshow-0.1.6
vscode-pylance ms-python 2025.9.1 ms-python.vscode-pylance-2025.9.1
vscode-python-envs ms-python 1.11.13081015 ms-python.vscode-python-envs-1.11.13081015-win32-x64
vscode-tailwindcss bradlc 0.14.29 bradlc.vscode-tailwindcss-0.14.29
vscode-theme-onedark akamud 2.3.0 akamud.vscode-theme-onedark-2.3.0
vscode-wakatime WakaTime 25.4.0 wakatime.vscode-wakatime-25.4.0
vscode-yaml redhat 1.19.1 redhat.vscode-yaml-1.19.1
C# Settings
Setting Value
preferCSharpExtension false
compilerDiagnosticScope openFiles
analyzerDiagnosticScope openFiles
enableXamlTools true
useServerGC true
System Info
Item Value
CPUs Intel(R) Core(TM) Ultra 7 165U (14 x 2688)
GPU Status 2d_canvas: enabled
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.46GB (7.41GB free)
Process Argv --crash-reporter-id eacfa160-48bd-448f-909d-ad9b7b677265
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
pythonvspyt551:31249597
nativeloc1:31118317
dwcopilot:31158714
dwoutputs:31242946
copilot_t_ci:31333650
g012b348:31231168
6gi0g917:31259950
pythonrdcb7:31268811
pythonpcpt1:31399616
6518g693:31302842
6abeh943:31336334
envsactivate1:31349248
editstats-enabled:31346256
aa_c:31379597
t123456:31413567
cloudbuttont:31366566
aihoversummaries_t:31413033
todos-1:31405333
v66_all_req:31396048
3efgi100_wstrepl:31403338
trigger-command-fix:31379601
chat-sessions-view-c:31407656
auto_model_enabled:31385282
use-responses-api:31390341
applesignin:31399434
9i271672:31414246
je187915:31401257
control_gfa0i828:31401959
j1f0b290:31405249
2a0ce269:31405335
disable_auto_fix_gb0j8799:31411651
agentic_ask_h7d75428:31406124
ec5jj548:31408805
ff8f5884:31411053
terminalsuggestenabled:31411718
cmp-ext-control:31413469
terminal:31413574

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions