gpt4 book ai didi

visual-studio - Visual Studio - 自动格式化 - 列模式或准则

转载 作者:行者123 更新时间:2023-12-04 05:32:52 28 4
gpt4 key购买 nike

默认情况下,我对所有文档都使用自动格式设置,但如果将代码的某些部分保留为分栏模式(如下图所示),则代码的某些部分更具可读性。

   switch (itUnit)
{
case ItUnit.NotApplicable: return -1;
case ItUnit.KilometersPerHour: return 1;
case ItUnit.MetricTons: return 1;
case ItUnit.Centimeter: return 0.01f;

我不想停止使用一两个列模式样式功能自动格式化文件。我正在寻找一些选项来帮助我解决这个问题。也许像 EditorGuidelines但是自动格式不会忽略它们(就像它忽略我链接的版本一样)。或者一些选项来标记代码的某些部分以被格式化程序忽略。或者可能是一些支持指南的第三方格式化程序?

自动格式化将使这个:

    switch (itUnit)
{
case ItUnit.NotApplicable: return -1;
case ItUnit.KilometersPerHour: return 1;
case ItUnit.MetricTons: return 1;
case ItUnit.Centimeter: return 0.01f;

最佳答案

通常您可以使用撤消 (ctrl-z) 来撤消自动格式更改,特别是在粘贴列对齐的代码行之后。不理想,但可以提供帮助。

还有 Tools/Options/C#/Code Style/Formating/Spacing,勾选“Ignore spaces in declaration statements”也有帮助。

关于visual-studio - Visual Studio - 自动格式化 - 列模式或准则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44243223/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com