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

21

当我尝试格式化 CSS 代码时,我遇到了问题。Visual Studio 在 CSS 中给我添加了不必要的空格。

在 Visual Studio 中格式化 CSS 代码之前:

.test-parent {
}

.test-parent .test-child {
}

.test-parent .test-child .test-child-child {
}

在Visual Studio格式化CSS代码后:

.test-parent {
}

    .test-parent .test-child {
    }

        .test-parent .test-child .test-child-child {
        }

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

1个回答

47

我相信这个功能被称为"分层缩进"。

你可以通过完成以下步骤来禁用它。

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

这样就可以阻止Visual Studio以嵌套格式对CSS进行格式化。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接