IntelliSense 中 properties/methods 的不完整列表

Incomplete list of properties/methods in IntelliSense

我在 Visual Studio Community 2017 中使用 VB.NET。我注意到在某些情况下,对象的可用属性和方法列表不完整。

这里可以看到一个例子:

如图所示,我想使用 dgv 对象的 RowCount 属性,即 System.Windows.Forms.DataGridView 类型。你可以看到,在它的正上方 属性 就在那里并且工作正常,我可以手动输入它。在后台编译器(因为缺少更好的术语)承认它是正确的之前,只需要一两秒钟。这种行为打乱了打字流程,因为 IntelliSense 经常会自动更正它认为是拼写错误的内容。

注意:这不是显示的独有属性。我在其他示例中注意到它,也在函数调用和其他随机位置注意到它,但我找不到明确的方法论来说明缺少什么和不缺少什么。

环顾四周,我发现例如this question,但是它处理的是一个完全不同的问题。

这只是 Visual Studio 中的一个错误(如果是,是否在某处报告过?),有人可以证实这一点吗?有人知道修复方法吗?

按照你的步骤,我得到了和你一样的结果,我已经将这个问题报告给 VS 产品团队,请检查:VS 2017--VB: the intellisense for the DataGridView control not works like VS 2015,你可以投票或添加评论,然后我们需要等待VS产品团队的确认,感谢您的反馈。 同时,我在 C#>Windows Forms 应用程序中尝试过,智能感知工作正常,就像 VS 2015 一样。

Albano Gheller 在 Visual Studio Community page 上发布了一个答案。

引用他的话和修复所需的步骤:

I've fixed the problem in this way:

1. I've exported my settings from Tool - Import/Export settings
2. I've set the property HideAdvancedMembers = true inside
   <ToolsOptionsSubCategory name="Basic" RegisteredName="Basic" PackageName="Text Management Package">
   because C# has true and works
3. I've imported this modified settings.

总结一下:

在导出的设置文档的 Basic ToolsOptionsSubCategory 中找到部件:<PropertyValue name="HideAdvancedMembers">false</PropertyValue>。 将其更改为 <PropertyValue name="HideAdvancedMembers">true</PropertyValue>,保存,然后重新导入设置。

我不知道为什么隐藏成员会导致显示更多成员,但无论如何 ;-)

作为 Jens 的补充 answer/to 为其他人节省一些工作:

  • 采取以下XML,这是翻转问题属性所需的最小设置集:
<UserSettings>
    <ApplicationIdentity version="15.0"/>
    <ToolsOptions>
        <ToolsOptionsCategory RegisteredName="TextEditor" name="TextEditor">
            <ToolsOptionsSubCategory PackageName="Text Management Package" RegisteredName="Basic" name="Basic">
                <PropertyValue name="HideAdvancedMembers">true</PropertyValue>
            </ToolsOptionsSubCategory>
        </ToolsOptionsCategory>
    </ToolsOptions>
</UserSettings>
  • 将其保存在桌面上名为 a.vssettings
  • 的文件中
  • 转到工具..导入和导出设置
  • 选择导入
  • 选择不,直接导入
  • 浏览您保存的文件,执行下一步完成

我推测 VS 中存在一个错误,他们将智能感知的布尔逻辑颠倒了,高级成员在该属性为 false 时隐藏,为 true 时显示