VS 2015:JS 文件中没有突出显示和智能感知
VS 2015: No highlighting and intellisense in JS files
我无法真正重现该问题,但是 .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.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>
我在这里找到了答案:
修复步骤如下:
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
消除了最后一个错误,一切正常。
这个问题似乎已在 Update 1 中修复。我使用的是专业版,但我想它适用于所有版本。
需要说明的是,Intellisense 无法为我工作 css 剃刀文件上的相关内容,post 更新 1 它似乎可以工作。
我知道这个问题显然是针对 Visual Studio 2015 年的。
但是,如果接受的答案也适用于 Visual Studio 2017.
,我想为那些拼命尝试的人付出我的两分钱
就我而言,语法高亮丢失是由新的 javascript 语言服务引起的。取消选中以下复选框并重新启动 Visual Studio:
后,我立即恢复了它
Tools > Options > Text Editor > JavaScript/TypeScript > Language
Service > Enable the new JavaScript language service.*
参考:https://developercommunity.visualstudio.com/comments/34109/view.html
我无法真正重现该问题,但是 .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.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>
我在这里找到了答案:
修复步骤如下:
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
消除了最后一个错误,一切正常。
这个问题似乎已在 Update 1 中修复。我使用的是专业版,但我想它适用于所有版本。
需要说明的是,Intellisense 无法为我工作 css 剃刀文件上的相关内容,post 更新 1 它似乎可以工作。
我知道这个问题显然是针对 Visual Studio 2015 年的。
但是,如果接受的答案也适用于 Visual Studio 2017.
,我想为那些拼命尝试的人付出我的两分钱就我而言,语法高亮丢失是由新的 javascript 语言服务引起的。取消选中以下复选框并重新启动 Visual Studio:
后,我立即恢复了它Tools > Options > Text Editor > JavaScript/TypeScript > Language Service > Enable the new JavaScript language service.*
参考:https://developercommunity.visualstudio.com/comments/34109/view.html