VS 2015 Razor Autocomplete/Intellisense 下拉菜单在下拉菜单后立即隐藏 [英] VS 2015 Razor Autocomplete/Intellisense dropdown hides immediately after dropdown

查看:29
本文介绍了VS 2015 Razor Autocomplete/Intellisense 下拉菜单在下拉菜单后立即隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 VS 2015 中,仅当在 Razor (.cshtml) 文件中时,大约有一半的时间自动完成/建议列表/智能感知无法正常工作(抱歉,不确定实际术语...当您键入对象时并点击 . 和属性和方法列表显示可供选择)

行为是当我点击 . 时,列表会弹出几分之一秒然后关闭.它发生得太快了,我尝试快速执行 Backspace.Backspace. 循环几次以至少看到我需要的名字,但我通常无法得到它,最终不得不从代码的其他地方找到确切的名字.极度刺激...

它偶尔发生,我找不到真正的模式.以下是我排除的模式:

  • 打开的文件似乎无关紧要.
  • 我是否关闭/重新打开文件似乎并不重要
  • 我是否导航到另一个文件并返回似乎无关紧要
  • 它可以在同一个文件中多次打开和关闭工作/不工作
  • 它似乎与任何特定的对象/属性/方法无关

我检查了所有选项(Razor 似乎没有文本编辑选项?),尝试清除缓存、重新加载解决方案/项目、重新启动 VS,所有这些似乎仍然没有提供任何模式.

有没有人遇到过这个问题并且对我可以在哪里修复它有任何想法?

示例这是一个非常简单的例子......新项目,很少的代码/文件,非常简单的视图.在 Model. 停止的地方,我应该有常用的基本方法和一个项目"集合.它弹出一瞬间然后消失......不涉及 lambdas/复杂视图解析(这也是可重现的):

更新:模式

我注意到的事情:

  • 如果我输入 @model ns.ns.ns.type,它很少发生在命名空间的基本"端.当我进一步接近它发生的类型时.这是间歇性的.
  • 在某些情况下,它每次都能正常运行.例如,我经常使用 DevExpress 工具,并且从未见过它们的任何扩展上的行为(因此,@Html.DevExpress().(和其他类似的,不一定是 DevEx 模型)永远不会导致一个问题)
  • 当我访问我的 @Model(这是我最想要的地方!)时,它几乎一直发生.我发现有些情况每次都可以重现(见上面的例子),但大约 90%+
  • 有时,当我处理对象树时,一个会失败而下一个有效(例如:@models ProjName.Web.App.Subscriptions.Models.AccountCreateVM...它可能会失败Subscriptions 但在 Models) 上工作正常)
  • 有时,开始在自动完成功能中键入名称会使其重新启动并重新开始工作.在上面的示例中,开始为 AccountCreateVM 键入 Acc 会使其重新开始工作.

解决方案

我还没有找到根本原因,但在所有情况下,CTRL+SPACE 都有效.这不是最好的,但总比没有好.

(这个快捷方式不是我过去用过的,所以这可能是标准行为,但是...)如果您在点 Model. 处并且自动完成列表消失,CTRL+SPACE 始终将其带回来,当它回来时,它会保持不变!如果只有一个可能的自动完成成员,它会在 CTRL+SPACE 时为您自动填充该成员>

In VS 2015, only when in Razor (.cshtml) files, roughly half of the time the autocomplete/suggestion list/intellisense doesn't work correctly (sorry, not sure the actual term... when you type an object and hit . and the list of properties and methods shows to select from)

The behavior is that when I hit ., the list popups up for a fraction of a second and then closes. It happens so fast I try to do a quick Backspace, ., Backspace, . cycle a few times to at least see the name I need, but I usually cant' get it and end up having to find the exact name elsewhere from code. Extremely irritating...

It happens sporadically with no real pattern I can find. Here's patterns that I've ruled out:

  • The file that's open doesn't seem to matter.
  • Whether or not I close/reopen the file doesn't seem to matter
  • Whether I navigate to another file and back doesn't seem to matter
  • It will work/not work multiple times on and off throughout the same file
  • It doesn't seem to be relevant to any particular object/property/method

I've checked all my options (there doesn't seem to be Text Editing options for Razor?), have tried clearing caches, the reloading solution/projects, restarting VS, all of which seem to still provide no pattern.

Has anyone come across this and have any ideas of where else I can look to fix it?

Example Here's an extremely simple example... new project, very little code/files, very simple view. Where the Model. stops, I should have the usual base methods, and an 'Items' collection. It pops up for a split second then disappears... no lambdas/complex view parsing involved (this is reproducible as well):

Update: Patterns

Things I've noticed:

  • If I'm entering a @model ns.ns.ns.type, it rarely happens toward the "base" end of the namespaces. It's as I get further towards the type that it happens. This one is intermittent.
  • In some cases, it works perfectly fine, every single time. For example, I often use DevExpress tools, and have never seen the behavior on any of their extensions (so, @Html.DevExpress(). (and other similar, not necessarily DevEx models) will never cause a problem)
  • It happens almost all the time when I'm accessing my @Model (which is where I most want it!). I've found some cases where this is reproducible every time (see above example), but it's about 90%+
  • Occasionally, as I work through the object tree, one will fail while the next works (ex: @models ProjName.Web.App.Subscriptions.Models.AccountCreateVM... it might fail on Subscriptions but work fine on Models)
  • Occasionally, beginning to type the name within autocomplete kicks it back into gear and it starts working again. In the above example, starting to type Acc for AccountCreateVM causes it to start working again.

解决方案

I haven't found the root cause, but in all cases, CTRL+SPACE works. This isn't the best, but light years better than nothing at all.

(this shortcut is not one I've used in the past, so this is likely standard behavior, but...) If you're at the dot Model. and autocomplete list disappears, CTRL+SPACE consistently brings it back up, and when it does come back, it stays! If there's only one possible autocomplete member, it'll auto-fill the member for you upon CTRL+SPACE

这篇关于VS 2015 Razor Autocomplete/Intellisense 下拉菜单在下拉菜单后立即隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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