使用visual studio code做为unity3d 的代码编辑工具,按照网上安装了一些插件。在自动生成类或方式的注释时发现生成了重复内容。最终原因是因为我安装了 C# XML Documentation Comments这个插件。网上查的资料都是几年前的,现在这个插件已经不再更新了,说明里有如下内容:

C# for Visual Studio Code (powered by OmniSharp) now officially supports the documentation comment from v1.23.8 (December 18th, 2020). You can use the official one by turning on Editor: Format On Type.

所以在C#插件里已经集成了注释的功能。把C# XML Documentation卸载掉就可以了。

原因说明

在 VS Code 中为 Unity 的 C# 脚本生成 XML 注释时出现重复内容,通常是因为装了功能重叠的插件——已内置注释支持的 C# 扩展与旧的 C# XML Documentation Comments 同时生效。

解决办法

  • 卸载已不再维护的 C# XML Documentation Comments 插件。
  • 新版 C# 扩展(OmniSharp 1.23.8 起)已内置文档注释支持,在设置中开启即可。
  • 重启 VS Code 生效,并检查其它注释类插件是否冲突。

相关阅读

参考资料