VS 2015:JS文件中没有突出显示和智能感知 [英] VS 2015: No highlighting and intellisense in JS files

查看:292
本文介绍了VS 2015:JS文件中没有突出显示和智能感知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法真正重现这个问题,但在 .js 文件中没有突出显示或intellisense工作,它在 .json中运行正常但是文件。

.js 文件的默认编辑器是JSON编辑器。

I can't really reproduce the issue, but no highlighting or intellisense is working in .js files, it works just fine in .json files however.
The default editor for .js files is JSON Editor.

我尝试了安全模式,禁用所有扩展,重置所有设置,我甚至重新安装了IDE(修复),但问题仍然存在。

I tried safe-mode, disabling all extensions, resetting all settings, and I even reinstalled the IDE (repair), but the issue still persists.

我将补充一点,当我启动IDE并且JS文件在作用域上打开时,我收到以下错误消息(突出显示并且intellisense无论如何都不起作用):

I will add, that when I launch the IDE and a JS file is open on scope, I get the following error message (highlighting and intellisense don't work anyway):

'JavaScriptWebExtensionPackage'包未正确加载。

The 'JavaScriptWebExtensionPackage' package did not load correctly.

问题可能是由配置更改或安装其他扩展程序引起的。您可以获取更多信息来检查文件'C:\Users \Shimmy \ AppData \Roaming\Microsoft \VisualStudio \14.0\ActivityLog.xml'。

The problem may have been caused by a configuration change or by the installation of another extension. You can get more information examining the file 'C:\Users\Shimmy\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml'.

重新启动Visual Studio可以帮助解决问题。

Restarting Visual Studio could help resolve the issue.

继续显示此错误消息?

此处您可以查看 ActivityLog.xml 文件,我粘贴在我认为可能相关的一些最近的行中:

Here you can view the ActivityLog.xml file, I pasted in some of the recent lines I think might be relevant:

<entry>
  <record>188</record>
  <time>2015/08/14 13:00:57.332</time>
  <type>Information</type>
  <source>VisualStudio</source>
  <description>Begin package load [JavaScriptWebExtensionsPackage]</description>
  <guid>{30DB8F9B-EC9F-44D6-B377-83C7C27A1A8B}</guid>
</entry>
<entry>
  <record>189</record>
  <time>2015/08/14 13:00:57.394</time>
  <type>Error</type>
  <source>VisualStudio</source>
  <description>SetSite failed for package [JavaScriptWebExtensionsPackage]</description>
  <guid>{30DB8F9B-EC9F-44D6-B377-83C7C27A1A8B}</guid>
  <hr>80131500</hr>
  <errorinfo>Expected 1 export(s) with contract name "Microsoft.VisualStudio.JavaScript.Web.Extensions.ReferenceAutoSync.IReferencesFilePathProvider" but found 0 after applying applicable constraints.</errorinfo>
</entry>
<entry>
  <record>190</record>
  <time>2015/08/14 13:00:57.394</time>
  <type>Error</type>
  <source>VisualStudio</source>
  <description>End package load [JavaScriptWebExtensionsPackage]</description>
  <guid>{30DB8F9B-EC9F-44D6-B377-83C7C27A1A8B}</guid>
  <hr>80131500</hr>
  <errorinfo>Expected 1 export(s) with contract name "Microsoft.VisualStudio.JavaScript.Web.Extensions.ReferenceAutoSync.IReferencesFilePathProvider" but found 0 after applying applicable constraints.</errorinfo>
</entry>


推荐答案

我在这里找到答案: Visual Studio 2015 RTM - 更新TypeSript工具后失去JavaScript支持

以下是修复它的步骤:


如果是通用Windows 应用程序开发工具仍然安装:

If the "Universal Windows App Development Tools" are still installed:


  1. 转到程序和功能,选择Visual Studio 2015,单击更改。

  2. 在Visual Studio安装程序中,单击修改。

  3. 取消选择通用Windows应用程序开发工具功能

  4. 选择通用Windows应用程序再次开发工具,然后单击更新。

  1. Go to Programs and Features, select Visual Studio 2015, click Change.
  2. In Visual Studio setup, click Modify.
  3. Deselect the feature "Universal Windows App Development Tools"
  4. Select "Universal Windows App Development Tools" again, and click Update.

如果您已经卸载了通用Windows应用程序开发工具:

If you have already uninstalled the "Universal Windows App Development Tools":


  • 重新安装Universal Windows App Developmen t工具

  • 或者,按照以下步骤重新安装JavaScript项目系统和语言服务:

  • Reinstall "Universal Windows App Development Tools"
  • Or, take the following steps to reinstall the JavaScript project system and language service:

  1. 下载您的Visual Studio版本的安装程序,例如vs_community.exe。

  2. 打开CMD窗口,然后运行以下命令:vs_community.exe / modify / installselectableitems JavaScript_Hidden / passive


我已按照第一步操作并返回Javascript支持。

I've followed the first steps and got back Javascript support.

希望这会有所帮助

-UPDATED -

在我完成上述步骤后,几乎所有内容都正常工作,除了每次打开.js文件时都收到错误消息,以下是诀窍:

After I did the above steps, almost everything was working, except that I got an error message every time I opened a .js file, the following did the trick:

我的猜测是,只有重新安装SDK才会更新MEF缓存。您可以按照以下步骤手动执行此操作:

My guess is that only reinstalling the SDK didn't update the MEF cache. You can do this manually by following these steps:


以管理员身份打开命令提示符

Open a command prompt as administrator


  1. CD进入C:\Program Files(x86)\ Microsoft Visual Studio
    14.0 \ Common7 \IDE

  2. 运行devenv / updateconfiguration

  3. 运行devenv / clearcache


摆脱最后一个错误,一切正常。

That got rid of the last error, and everything is working fine.

来源: https://github.com/Microsoft/TypeScript/issues/4238

这篇关于VS 2015:JS文件中没有突出显示和智能感知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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