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.
I tried safe-mode, disabling all extensions, resetting all settings, and I even reinstalled the IDE (repair), but the issue still persists.
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):
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 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>
I found answer here: Visual Studio 2015 RTM - Lost JavaScript support after update TypeSript Tools
These are the steps to fix it:
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
I've followed the first steps and got back Javascript support.
Hope this helps
-UPDATED-
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:
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
- CD into C:\Program Files (x86)\Microsoft Visual Studio
14.0\Common7\IDE
- Run devenv /updateconfiguration
- Run devenv /clearcache
That got rid of the last error, and everything is working fine.
Source: https://github.com/Microsoft/TypeScript/issues/4238
The issue seems to be fixed on Update 1. I'm on the professional version but I imagine that it applies to all versions.
To be clear, Intellisense was not working for me for css related stuff on razor files and post update 1 it seems to be working.
I know this question is clearly targeting Visual Studio 2015.
However, I wanted to put my two cents in for those who desperately tried out if the accepted answer also works for Visual Studio 2017.
In my case, the loss of syntax highlighting was caused by the new javascript language service. I got it back right after deselecting the following checkbox and restarting Visual Studio:
Tools > Options > Text Editor > JavaScript/TypeScript > Language
Service > Enable the new JavaScript language service.*
Reference: https://developercommunity.visualstudio.com/comments/34109/view.html