Visual Studio 2015 粘贴时将单词后的制表符转换为空格

Visual Studio 2015 converting tabs after words into spaces when pasting

我在 Visual Studio 2015 年遇到了格式问题,我找不到修复它的选项。每当我在初始行缩进后粘贴使用制表符的代码时,制表符都会转换为空格并丢弃所有内容。禁用此选项的选项是什么?

粘贴前(类型和成员名称之间的间距为制表符)

private int             roomSpacing;
private int             currentLayer;
private int             currentToolIndex;
private int             previousToolIndex;
private TileDrawModes   aboveTileDrawMode;
private TileDrawModes   belowTileDrawMode;

粘贴后(现在一切都被隔开)

private int             roomSpacing;
private int             currentLayer;
private int             currentToolIndex;
private int             previousToolIndex;
private TileDrawModes   aboveTileDrawMode;
private TileDrawModes   belowTileDrawMode;

尝试工具 -> 选项 -> 文本编辑器 -> C# -> 标签 -> 保留标签

您需要检查您的编辑器设置。

在 Visual Studio 中,转到 工具 -> 选项 然后选择 文本编辑器 和 select 语言(假设是 C#) 转到 Formatting 并查看 "Automatically format on paste" 是否被选中。如果您关闭它,编辑器将不会在粘贴后格式化您的代码。您可能还想检查 Formatting 下的 Spacing 设置。

仔细阅读 OP - 现在很明显 OP 知道各自的设置 - 这实际上是一个已知问题,也在 Visual Studio 2017 中出现。Post-code 制表符被转换为空格,而不管选项卡 preferences/settings.

MS 报告:"We recommend that you vote on and follow the earlier reported issue for updates and fix notifications. -- Kevin Pilch, .NET Developer Experience":https://github.com/dotnet/roslyn/issues/5873