简体   繁体   English

如何隐藏“基于最近编辑”的 Intellisense 建议?

[英]How to hide Intellisense "based on recent edits" suggestions?

What the title says.标题说的是什么。

I don't mind them being in the "Error List" because they're only marked as "Messages" so they can easily be filtered, but I'd like to hide the dots in the code.我不介意它们出现在“错误列表”中,因为它们仅被标记为“消息”,因此可以轻松过滤它们,但我想隐藏代码中的点。

To turn off the "Based on recent edits" stuff, go to turn off IntelliCode suggestions .要关闭“基于最近的编辑”内容,请拨打 go 关闭 IntelliCode 建议

Per the docs:根据文档:

If you wish to turn it off, choose Tools > Options, IntelliCode General tab, and then switch C# suggestions to Disabled如果您想关闭它,请选择“工具”>“选项”、“IntelliCode 常规”选项卡,然后将 C# 建议切换为“已禁用”

在此处输入图像描述

This will turn off "Based on Recent edits" while still leaving on the other stuff like code styles/autocomplete/etc.这将关闭“基于最近的编辑”,同时仍然保留其他内容,如代码样式/自动完成/等。

How to hide Intellisense “based on recent edits” suggestions?如何隐藏“基于最近编辑”的 Intellisense 建议?

If you want to hide such suggestion in Intellisense(show as a dot ), you should add this below on the top of every cs file:如果你想在 Intellisense 中隐藏这样的建议(显示为一个dot ),你应该在每个 cs 文件的顶部添加下面的内容:

#pragma warning disable xxx(suggestion ID)

Or use #pragma warning disable to disable every suggestion.或者使用#pragma warning disable禁用所有建议。

For an example, I have make a similar sample:例如,我做了一个类似的样本:

在此处输入图像描述

在此处输入图像描述

================================================================ ================================================ ==============

And usually to remove that Intellisense Suggestion, you should enter Tools --> Options --> Text Editor --> C# --> Code Style and then find such suggestion message and change its Severity from Suggestion to Refactoring Only .通常要删除该 Intellisense Suggestion 您应该进入Tools --> Options --> Text Editor --> C# --> Code Style然后找到这样的建议消息并将其SeveritySuggestion更改为Refactoring Only With this, you could remove such Suggestion on Code Editor .有了这个,你可以删除这样的代码编辑器建议。

在此处输入图像描述

Since I did not know your specific suggestion message(based on recent edits) and the ID and also not sure whether such suggestion are in the Code Style menu, so I suggest you could try my first solution.由于我不知道你的具体建议消息(基于最近的编辑)和ID ,也不确定这样的建议是否在代码样式菜单中,所以我建议你可以尝试我的第一个解决方案。

Note that: So far, no matter which way you suppress the suggestion, removing dot in the Code Editor will also remove the message in the Error List .请注意:到目前为止,无论您以何种方式抑制建议,在代码编辑器中删除dot也会删除错误列表中的消息。 They are unified, you cannot suppress the IntelliSense in the Code Editor and save the message in the Error List .它们是统一的,您不能在Code Editor中抑制IntelliSense并将消息保存在Error List中。

Besides, if you still want this,you could suggest a feature on our User Voice Forum .此外,如果您仍然想要这个,您可以在我们的User Voice Forum上建议一个功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM