Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS 2015: No highlighting and intellisense in JS files

Tags:

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>
like image 393
Shimmy Weitzhandler Avatar asked Aug 14 '15 00:08

Shimmy Weitzhandler


People also ask

Does Visual Studio work with JavaScript?

Visual Studio provides an out of the box, first class debugging experience for JavaScript. Powerful features like source maps allow you to drop breakpoints directly in your code.

What is JavaScript IntelliSense?

IntelliSense# Visual Studio Code's JavaScript IntelliSense provides intelligent code completion, parameter info, references search, and many other advanced language features.

How do I add JavaScript to Visual Studio 2017?

With your project open in Visual Studio, right-click on a folder or your project node in Solution Explorer (right pane), and choose Add > New Item. In the New File dialog box, under the General category, choose the file type that you want to add, such as JavaScript File, and then choose Open.


2 Answers

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:

  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.

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:
    1. Download the installer for your edition of Visual Studio, e.g., vs_community.exe.
    2. 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

  1. CD into C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
  2. Run devenv /updateconfiguration
  3. Run devenv /clearcache

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

Source: https://github.com/Microsoft/TypeScript/issues/4238

like image 182
Eduardo Roth Avatar answered Oct 09 '22 18:10

Eduardo Roth


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.

like image 31
ManyRootsofAllEvil Avatar answered Oct 09 '22 19:10

ManyRootsofAllEvil