自动完成案例问题 [英] Autocomplete case issue

查看:96
本文介绍了自动完成案例问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio(社区2017)中编写C#时,总是很困扰我,当我有两个名称相似的标识符,一个以大写字母开头,一个以小写字母开头时,有时我开始输入小写字母,它将自动使用大写字母标识符完成.

When writing C# in Visual Studio (Community 2017), it's always really bugged me that when I have two similarly-named identifiers, one beginning with upper-case and one beginning with lower-case, that sometimes when I start typing in lower-case it'll autocomplete on the upper-case identifier instead.

通常在我将小写参数分配给大写字段/属性时发生,例如:

This typically happens when I'm assigning from a lower-case parameter to an upper-case field/property, for example:

当我开始键入my...时,它会匹配小写的myValue,直到我键入v为止,这时它将开始匹配大写的MyValue.显然我不想要这个,因为这样我将以MyValue = MyValue结尾!有什么办法可以使我根据仅首字母的大小写而不是现在所做的任何事情来解决大小写不一的情况?如果我开始使用小写字母输入,那么当我输入更多字符时,我希望它继续匹配以小写字母开头的标识符.

When I start typing my..., it matches the lower-case myValue until I type the v, at which point it starts to match the upper-case MyValue instead. Obviously I don't want this because then I'll end up with MyValue = MyValue! Is there any way that I can get it to resolve case ambiguities based on the case of the first letter only instead of whatever it's doing now? If I start typing in lower-case then I want it to continue matching the identifier beginning with lower-case as I type more characters.

这是一个与类型而不是变量匹配的示例.我已经用适当的大小写输入了完整的参数名称,并且它仍然匹配类型而不是变量:

Here's an example where it's matching a type instead of a variable. I've typed the parameter name in full, with proper case, and it's still matching a type rather than the variable:

推荐答案

对于您的第一个示例,我在本地进行了测试,结果如下图所示,我发现预先选择的完成列表取决于"最近使用过的成员",请检查以下内容:

For your first example, I tested it on my local side and the result is as the following screenshot, I found the pre-selected completion list is depends on "Most recently used members", please check this: Visual C# IntelliSense

IntelliSense会记住您最近在弹出的列表成员"框中选择的用于自动完成对象名称的成员.下次使用会员列表时,顶部会显示最近使用的会员.

对于您的第二个示例,我得到的结果与您的相同.由于我们尝试在()"中键入代码,并且我假设根据某些特定的规则或原则进行了VS过滤的完成列表,因此我们也可以从上述文档中找到规则.

For your second example, I got the same result as yours. Since we tried to type code into ‘()’ and I assume the VS filtered completion list per some specific rules or principles, which we can also find the rules from the above documents.

如果您对这种智能感知有任何建议或想法,请转到帮助-发送反馈-提供建议...以将其分享给VS产品团队,他们愿意听到不同的建议和用户的声音.

If you have some suggestions or idea about this intellisense, please go to Help-Send Feedback-Provide a suggestion… to share it to the VS Product Team, they are willing to hear different suggestions and user voices.

这篇关于自动完成案例问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆