简体   繁体   English

Visual Studio 2015 JavaScript Intellisense奇怪的行为

[英]Visual Studio 2015 JavaScript Intellisense strange behaviour

I am working on MVC application in Visual Studio 2015. Suddenly, intellisense for JavaScript files started behaving strangely. 我正在Visual Studio 2015中使用MVC应用程序。突然,对JavaScript文件的智能感知开始表现异常。 Sometimes, the intellisense does not pop up but it can be displayed using keyboard shortcut. 有时,智能提示不会弹出,但是可以使用键盘快捷键显示。 The worse problem is that it does not show local variables. 更严重的问题是它不显示局部变量。 The screenshot is here: http://i.imgur.com/RvyQVTm.jpg . 屏幕截图位于: http : //i.imgur.com/RvyQVTm.jpg The local variable abcde is not in the list. 本地变量abcde不在列表中。 Here is a screenshot of the right behaviour: http://i.imgur.com/w5LM0JA.jpg . 这是正确行为的屏幕截图: http : //i.imgur.com/w5LM0JA.jpg I encouter similar behaviour for object atributes when writing method (intellisense does not show attributes when writing this. ). 在编写方法时,我会为对象属性提供类似的行为(在编写this.方法时,智能不会显示属性this. )。

The problem started happening on my laptop. 问题开始在我的笔记本电脑上发生。 I tried to solve it. 我试图解决它。 I tried different solutions but with no luck. 我尝试了不同的解决方案,但是没有运气。 The reason is that the solutions I found were not for my specific problem. 原因是我找到的解决方案不适用于我的特定问题。 I even tried reinstalling Visual Studio. 我什至尝试重新安装Visual Studio。

Since I was not able to fix it on the laptop I tried installing Visual Studio on my desktop with fresh Windows 10 installation. 由于我无法在笔记本电脑上对其进行修复,因此尝试在全新安装Windows 10的台式机上安装Visual Studio。 I created new project and transfered files from laptop to the new project. 我创建了新项目,并将文件从笔记本电脑传输到了新项目。 Intellisense was working in the new project. Intellisense正在从事新项目。 I wrote some code, saved the project and turned the computer off. 我写了一些代码,保存了项目并关闭了计算机。

When I returned to my project after few days I noticed that the intellisence was behaving the same way as on the laptop. 几天后回到我的项目时,我注意到智能的表现方式与笔记本电脑相同。

The most interresting thing is that the intellisense works in any new project I create. 最有趣的是,智能感知可以在我创建的任何新项目中使用。

I'm really desperate because I have already spent so much time trying to fix this issue. 我真的很绝望,因为我已经花了很多时间来解决此问题。 I will be glad for any help. 我会很高兴为您提供任何帮助。

Since the time I posted this question I found out some ways how to minimize (maybe even fix) the issue: 自从我发布此问题的时间以来,我发现了一些方法来最小化(甚至修复)该问题:

  1. I created new solution for the project and moved all files there by copying their contents. 我为该项目创建了新的解决方案,并通过复制其内容将所有文件移到了那里。

  2. I do not turn the computer off. 我没有关闭计算机。 I use hibernation with Visual Studio running. 我在运行Visual Studio时使用了休眠模式。 This might not be necessary because my project survived one Windows Update restart and several VS restarts due to plugin updates. 这可能不是必需的,因为由于插件更新,我的项目在一次Windows Update重新启动和几次VS重新启动中幸免于难。

  3. If you encounter the issue, check for syntax errors as gpersell suggests. 如果遇到问题,请按照gpersell的建议检查语法错误。 Once, the intellisense got broken for me when I tried calling function with missing parentheses. 一次,当我尝试使用缺少括号的函数来调用时,智能感知功能对我来说很困难。

  4. If you are sure there are no syntax errors, leave the computer for a while. 如果确定没有语法错误,请离开计算机一段时间。 This might sound stupid but it already helped me three times. 这听起来可能很愚蠢,但是已经帮助了我三次。 I usually leave computer for 5 - 15 minutes with Visual Studio running with project open and when I come back the intellisense works again. 我通常在Visual Studio运行且项目打开的情况下离开计算机5到15分钟,而当我回来时,Intellisense再次起作用。

  5. Do not delete contents of the \\obj\\Debug and \\obj\\Release folders. 不要删除\\obj\\Debug\\obj\\Release文件夹的内容。 Use Visual Studio's Clean Project feature instead. 请改用Visual Studio的“清理项目”功能。

  6. If nothing of the above helps, start again from the point 1. 如果以上方法均无济于事,请从第1点重新开始。

I hope this helps someone. 我希望这可以帮助别人。

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

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