文件中没有突出显示和智能感知

文件中没有突出显示和智能感知

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

问题描述

我无法真正重现该问题,但是 .js 文件中没有突出显示或智能感知,但是它在 .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 文件时,我收到以下错误消息(突出显示和智能感知无论如何都不起作用):

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' 包未正确加载.

问题可能是由配置更改或安装其他扩展引起的.您可以通过检查文件C:UsersShimmyAppDataRoamingMicrosoftVisualStudio14.0ActivityLog.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:UsersShimmyAppDataRoamingMicrosoftVisualStudio14.0ActivityLog.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 的支持

这些是修复它的步骤:

如果Universal Windows App Development Tools"仍然安装:

  1. 转到程序和功能,选择 Visual Studio 2015,点击更改.
  2. 在 Visual Studio 设置中,单击修改".
  3. 取消选择通用 Windows 应用开发工具"功能
  4. 再次选择Universal Windows App Development Tools",然后点击更新.

如果您已经卸载了Universal Windows App Development Tools":

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

  • 重新安装通用 Windows 应用开发工具"
  • 或者,按照以下步骤重新安装 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.

希望能帮到你

-更新-

在我完成上述步骤后,几乎一切正常,除了每次打开 .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:

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

  1. CD 到 C:Program Files (x86)Microsoft Visual Studio14.0Common7IDE
  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 文件中没有突出显示和智能感知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!