Visual Studio 2017禁用css格式化不必要的空格

Deo*_*tay 13 visual-studio

我尝试格式化css代码时遇到问题.Visual Studio在css中给了我不必要的空间

在visual studio中格式化css代码之前:

.test-parent {
}

.test-parent .test-child {
}

.test-parent .test-child .test-child-child {
}
Run Code Online (Sandbox Code Playgroud)

在visual studio中格式化css代码之后:

.test-parent {
}

    .test-parent .test-child {
    }

        .test-parent .test-child .test-child-child {
        }
Run Code Online (Sandbox Code Playgroud)

是否可以在Visual Studio 2017中禁用不必要的空间?

Jam*_*mes 30

我相信这个功能叫做"Hierarchical Indentation".

您应该可以通过完成以下操作来禁用它.

  • 单击"工具"菜单
  • 单击选项...
  • 向下滚动并展开"文本编辑器"
  • 向下滚动并展开CSS
  • 选择高级
  • 将分层缩进设置为"关".

这应该阻止Visual Studio以嵌套格式格式化CSS.