我无法真正重现该问题,但在 .js
文件中没有突出显示或智能感知,但它在 .json
文件中工作得很好。
.js
文件的默认编辑器是 JSON 编辑器。
我尝试了安全模式、禁用所有扩展、重置所有设置,甚至重新安装了 IDE(修复),但问题仍然存在。
我要补充一点,当我启动 IDE 并且在范围内打开 JS 文件时,我收到以下错误消息(突出显示和智能感知无论如何都不起作用):
The 'JavaScriptWebExtensionPackage' package did not load correctly.
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'.
Restarting Visual Studio could help resolve the issue.
Continue to show this error message?
Here您可以查看 ActivityLog.xml 文件,我粘贴了一些我认为可能相关的最近行:
<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 - Lost JavaScript support after update TypeSript Tools
修复此问题的步骤如下:
If the “Universal Windows App Development Tools” are still installed:
- Go to Programs and Features, select Visual Studio 2015, click Change.
- In Visual Studio setup, click Modify.
- Deselect the feature “Universal Windows App Development Tools”
- Select “Universal Windows App Development Tools” again, and click Update.
If you have already uninstalled the “Universal Windows App Development Tools”:
- Reinstall “Universal Windows App Development Tools”
- Or, take the following steps to reinstall the JavaScript project system and language service:
- Download the installer for your edition of Visual Studio, e.g., vs_community.exe.
- Open a CMD window, and run the following command: vs_community.exe /modify /installselectableitems JavaScript_Hidden /passive
我已经完成了第一步并重新获得了 Javascript 支持。
希望这有帮助
-更新-
完成上述步骤后,几乎一切正常,除了每次打开 .js 文件时都会收到一条错误消息,以下方法解决了问题:
我的猜测是,仅重新安装 SDK 并没有更新 MEF 缓存。您可以按照以下步骤手动执行此操作:
Open a command prompt as administrator
- CD into C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
- Run devenv /updateconfiguration
- Run devenv /clearcache
这消除了最后一个错误,一切正常。
关于javascript - VS 2015 : No highlighting and intellisense in JS files,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32000562/