Keep Tabs Setting Not Working in Visual Studio 2026

Pierre Plourde 6 Reputation points
2025-12-05T16:52:18.0633333+00:00

I recently upgraded to Visual Studio 2026. I have Adapting Formatting turned off. I have my Space/Tab setting to Keep Tabs for the all languages default and for all the individual languages that have this option. Despite this, Visual Studio keeps replacing my tabs with spaces throughout any C# file. I have reviewed the article in Microsoft Learn "Configure indent and tab settings in Visual Studio" as well as an old post in Stack Overflow ("Keep Tabs" setting not working in Visual Studio 2019). I do not have a .editorconfig file. Indeed, the only solution I have found to work is to create a .editorconfig file at the Solution level and specify indent_style = tab.

Is this a known issue that is being worked on? Is there anything else I should look at for settings?

Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2025-12-05T16:52:31.5366667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    It seems you are experiencing issues with the "Keep Tabs" setting in Visual Studio 2026, despite having the appropriate settings configured. Here are a few things you might consider checking or trying:

    1. EditorConfig File: You mentioned that you do not have a .editorconfig file, but creating one at the solution level and specifying indent_style = tab has worked for you. This is a valid approach, as .editorconfig files can override the IDE settings and enforce consistent formatting across your project.
    2. Advanced Text Editor Options: Ensure that you have configured the advanced text editor options correctly. The setting for using tabs can sometimes be affected by other configurations in the editor. You can check these settings under Tools > Options > Text Editor > All Languages > Tabs to confirm that "Keep Tabs" is selected.
    3. Adapting Formatting: Since you have turned off Adapting Formatting, Visual Studio should respect your tab settings. However, if you notice that it still converts tabs to spaces, double-check if there are any other formatting settings that might be conflicting.
    4. Language-Specific Settings: Make sure that the settings for C# specifically are also set to "Keep Tabs". Sometimes, language-specific settings can override the general settings.
    5. Updates and Known Issues: As for whether this is a known issue, it's always a good idea to check the Visual Studio release notes or forums for any reported bugs or issues related to formatting in the latest version. Microsoft may address such issues in future updates.

    If none of these solutions work, it may be beneficial to report the issue to Microsoft through their feedback tools in Visual Studio, as they can provide more direct assistance or updates regarding known issues.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.