英文:
How to Disable the StyleCop add project and header info from Intellisense Visual Studio
问题
我使用 Visual Studio 2022 配合 StyleCop。对于我的解决方案,我使用一个 .editorconfig 文件来管理所有的 StyleCop 分析器规则。我还禁用了规则 1633“文件应该有标题”,因为我不在我的文档中使用标题以减少杂乱。
然而,StyleCop 仍然在 IntelliSense 上下文菜单中添加了选项“将 StyleCop 设置文件添加到项目”和“添加文件头”。
是否有一种方法可以禁用 IntelliSense 菜单中的这两个选项?我经常意外点击其中一个,导致执行这些操作。
英文:
I use StyleCop with Visual Studio 2022. For my Solutions, I use an .editorconfig file to manage all of my StyleCop analyzer rules. I also have the rule 1633 File should have header
disabled as I do not use headers in my documents to minimize clutter.
However, StyleCop still adds the options Add StyleCop settings file to the project
and Add file header
into the Intellisense context menu.
Is there a way to disable these two options from the Intellisense menu? I regularly accidentally click one of these causing those action to perform.
答案1
得分: 0
我最终将此问题发布在 StyleCop 的 GitHub 页面上。
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3679
我在那里收到了如何解决这个问题的答案。
无法通过 Visual Studio 编辑器配置编辑器正确控制设置。当通过 Visual Studio 的编辑器设置为禁用时,它会将值设置为 silent
,这不会消除上下文菜单。
您必须在另一个文本编辑器(例如 Notepad++)中打开 .editorconfig 文件,并手动更改行 dotnet_diagnostic.SA1633.severity = none
。这将停止上下文菜单的显示。
这已作为一个问题在 Roslyn 项目上打开 https://github.com/dotnet/roslyn/issues/69176。
英文:
I eventually posted this as an issue on StyleCop's GitHub page.
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3679
I received the answer there how to resolve this.
The settings can't be properly controlled from the Visual Studio editorconfig editor. When set to disabled through Visual Studio's editor, it will set the value to silent
, which does not eliminate the context menus.
You must instead open the the .editorconfig file in another text editor (eg. notepad++) and manually change the line dotnet_diagnostic.SA1633.severity = none
. This will stop the context menus from appearing.
This has been opened as an issue on the Roslyn project https://github.com/dotnet/roslyn/issues/69176.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论