Question
code snippet indentation in Visual Studio 2022
I have set the indentation to 2 spaces per tab in my Visual Studio (2022). Whenever there is any auto-generated code from Visual Studio (also applies when creating new classes), the indentation is set to 4 spaces. This is especially notable with code snippets.
Example:
class Class1
{
public int MyProperty { get; set; }
ctor
public void Method1()
{
}
}
is turned to:
class Class1
{
public int MyProperty { get; set; }
public Class1()
{
}
public void Method1()
{
}
}
If I press undo and then press tab again, the indentation is correct. If I press ctrl-K-D, it's also formatted correctly. The indentation also works as it should for all my custom code snippets. There is no editorconfig or anything that could mess with indentation. On my home machine with my personal account, it's formatted correctly as well, but I can't find any setting that would be responsible for this.
How can i fix this?