For a long time, writing JavaScript code in Visual Studio was very painful. There were no tools that could support writing JavaScript. But ReSharper changed this by providing you with a rich set of features that you know from C#.
Support for JavaScript starts with IntelliSense. IntelliSense prompts you with defined JavaScript keywords and methods, and objects and methods from your custom objects as well as from external JavaScript libraries such as jQuery. A sample prompt for jQuery methods is shown in the following screenshot:
Another well-known ReSharper feature is Code Analysis. It allows you to quickly find and fix some common errors.
From this analysis, ReSharper will notify you when it will find any one of the following conditions:
switch
statement or property declarationYou can find a complete list of available Code Inspections in the ReSharper options by navigating to Code Inspection | Inspection Severity in the JS tab.
Together with Code Analysis, ReSharper comes with some simple refactoring methods for JavaScript. You will find options such as Rename, Create from usage, or Introduce variable.
All these features work in JavaScript in the same way as they work in C#.
With ReSharper, you can also easily review JavaScript code structure in the File Structure window. A sample structure is shown in the following screenshot:
Same as in other languages, you can navigate between different type members in your file with the Go to File Member (Alt + ) option and find code dependencies by finding the code declaration or code usage.
Starting with ReSharper v8, you can use the SSR feature together with JavaScript code. You can find out more about this feature in Chapter 4, Making Your Code Better.
3.139.240.244