Visual Studio Javascript Intellisense



I had a set of very strange problems after upgrading to Visual Studio 2019 early this week, and they were significantly hampering my ability to get work done.

  1. Go To Definition didn't work for a great many classes, methods, and properties.
  2. Intellisense was straight-up missing in multiple places.

I hadn't realized how much I relied on those two features of Visual Studio until I could no longer use them. It was like suddenly missing a finger, or being unable to find my phone: part of myself was gone.

Visual Studio Code (VS Code) is very handy when used as an IDE for web related developments. However, when it comes to Leaflet Javascript library, VS code does not provide off-the-shelf IntelliSense functionality. Therefore, we need to manually tweak Visual Studio Code to have IntelliSense for Leaflet, and here are the steps: STEP 1. In Visual Studio, we get IntelliSense support for JavaScript in our markup files (.html or.aspx) when we include these references using the. XrmToolkit provides both JavaScript and TypeScript files that allow you to have all the intellisense features in Visual Studio for your CRM forms. To learn how to generate these files see the documentation found here. Both the older JavaScript API (Xrm.Page). IntelliSense, code navigation, and refactoring Visual Studio maximizes JavaScript productivity with rich IntelliSense completions and signature help, cross project refactoring, and lightning-fast code navigation. Using Intellisense with Esri's JavaScript API in Visual Studio 03 Mar 2013. We all love Intellisense in Visual Studio, but with JavaScript is a little difficult to do that given it’s a dynamic language. However, most JavaScript libraries now comes with VSDoc files that provide a way to add intellisense to JavaScript in Visual Studio (and.

Visual studio code javascript intellisense

I went off to Google the problem and found nothing that helped me. So, when I eventually did find the solution that worked for me, it occurred to me that I cannot be the only one with this problem. Hence, this post.

Screensleeves. Here's how I fixed my missing Intellisense and nonfunctional Go To Definition in Visual Studio 2019.

(If you're just looking for the solution, jump to the Summary section at the bottom)

Tracking the Problem

Our project is an ASP.NET Framework 4.5.2 MVC solution, with lots of other tech thrown in (e.g. Entity Framework). As I mentioned at the time, the Intellisense and definitions were not missing for all of my classes, methods, etc., just for a majority of them. For example, in my controllers I could not use Go To Definition on the ASP.NET MVC Controller class, nor the attribute HttpGet, nor any of our custom classes for this project. But I could use it on certain common extensions, such as ToString or ToList.

It took me a while to work this out, but I eventually determined that what I was actually missing was all of ASP.NET MVC and Entity Framework. With that commonality in mind, I started poking around the solution, which is when I discovered this:

All of my project references were in error! Even ones that should exist on my system, like System.Data.

Which is stupid. I can use this project perfectly fine in VS 2017, so why was VS 2019 giving me such problems? And, more importantly, what was I going to do about it?

Javascript

Potential Solution #1: Delete the .vs File

A bit of googling lead me to this blog post by Rick Strahl which suggested that I should delete the hidden .vs folder at the root of my solution. When I did so and opened Visual Studio again, VS recreated this folder. But, unfortunately, it didn't fix the issues I was having with Intellisense and Go To Definition.

It was at this point that something occurred to me: all of the things which I could not get Intellisense for (MVC and EF) were, in fact, NuGet packages. I wondered if this had something to do with NuGet, and, it turns out, it does!

Potential Solution #2: Restore NuGet Packages

There's a right-click option on .sln files called 'Restore NuGet Packages'. This was the first thing I attempted to do while trying to fix this problem. Unfortunately, it didn't help, because all I got was this:

Visual Studio Javascript Intellisense

'All packages are already installed and there is nothing to restore.' Which is not helpful in the least.

Potential Solution #3: Use the NuGet UI

The next thing I could think to do was use the NuGet UI within Visual Studio to reinstall all the packages. Problem is, there is approximately (counts on fingers) 57 jillion packages on this solution. Refreshing them using the UI would take a lot of time.

Clearly I was not going to do this. I needed something a bit more.. forceful. Which is when I stumbled upon the actual, final solution that restored Intellisense and fixed Go To Definition..

Actual Solution: Delete Local NuGet Packages

..I deleted my local copy of this solution's NuGet packages.

At the root of our solution there is a packages folder. I deleted the entire contents of this folder. Upon reopening Visual Studio, Intellisense and Go To Definition were restored to full working order.

If I'm being completely honest, I do not know exactly why this works. After all, Visual Studio showed errors on references which should exist on my local machine, not in NuGet packages. But at this point, I don't particularly care why it works, I'm just glad it does.

Summary

Visual Studio Javascript Intellisense

It turned out the issue was related to NuGet; what I needed to do was delete the contents of the packages folder. For completeness's sake, here's the steps to do what I did. Shazam mobile data not working.

  1. Close all instances of Visual Studio 2019.
  2. Delete the contents of the packages folder at the root of your solution on your local machine.
  3. Open Visual Studio 2019 again.

This final solution worked for me. I am including the potential solutions in this post in the hopes that one of them (actual or potential) works for you, dear reader. Let me know if you have any other solutions in the comments!

Ts1084 Visual Studio

Happy Coding!

Visual Studio Javascript Intellisense Namespace

Hello Dear Reader! Want to get the best C#, ASP.NET, web tech, tips, and stories anywhere on the Web?Sign up to receive my premium newsletter The Catch Block!Each Wednesday, you'll get the best reads, job listings, stories, tips, and news from around the ASP.NET and C# worlds.All for only $5/month or $50/year!Become a subscriber today!