Skip to content

Keep tabs not working for Razor pages #12260

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work]
I had an issue where my razor cshtml pages switched to spaces instead of tabs. I went into options and made sure that Keep Tabs was selected (it was - both for default and for Razor pages).

I noticed the advanced setting to set a background colour for C# code and thought it looked interesting so turned it on.

Saw immediately it made it much more complicated to work with so turned it back off again, but the settings haven't made a difference.

With Keep Tabs turned on and C# background off, it's still showing spaces and C# background is on.
I've tried restarting both my laptop and Visual Studio with no change.
image.png
image.png
image.png

It's also showing that the Default settings aren't being applied to Razor pages since they are different, but the settings all look the same.


Original Comments

Feedback Bot on 23/09/2025, 03:37 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Feedback Bot on 24/09/2025, 07:40 AM:

This issue is currently being investigated. Our team will get back to you if either more information is needed, a workaround is available, or the issue is resolved.

David Wengier [MSFT] on 24/09/2025, 08:59 AM:

Thanks for reporting this, it definitely seems like there is something wrong with our options for coloring C# backgrounds etc. As far as the “Keep Tabs” thing though, changing the value there doesn’t actually force Visual Studio to change the indentation. Once you’ve changed the value though, you should be able to run Format Document to update it, or click in the bottom right hand side of the editor status bar, where it says “SPC”, and change that to tabs. That will force a change.

Can you let us know if that resolve that part of the issue for you?

Jay Nielson on 24/09/2025, 09:03 AM:

Hi there David,

That’s actually kind of the issue.
I was formatting the document again after changing that setting and it wasn’t making any changes or differences and was just keeping it as spaces 😦

I was formatting using the keyboard shortcut: CTRL+K+D

Cheers

David Wengier [MSFT] on 24/09/2025, 09:05 AM:

Thats weird, I tried the exact same thing and it did work for me. I’ll move this issue to GitHub so we can have a look at it properly.

Metadata

Metadata

Assignees

Labels

author: migration bot 🤖The issue was created by a issue mover bot. The author may not be the actual author

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions