visual-studiovisual-studio-2017javascript-intellisense

Cannot add a global JavaScript Intellisense reference in Visual Studio 2017 RC


I'm trying to make the migration over to 2017 from 2015 as painless as possible. The codebase that I work with has a couple of custom libraries that I was able to add as references in VS 2015.

However, in VS 2017 RC, the 'references' option has been removed from the options->text editor->JavaScript/Typescript->Intellisense menu, where it was present in VS 2015.

Any direction in getting this working would be greatly appreciated.


Solution

  • My understanding is that the new JavaScript language service, 'Salsa', is the culprit here.

    This blog link (provided by i100) has the following statement under the Notable Changes section:

    Another key difference is that while the old language service supported an extensibility model that allowed custom extensions to be developed for specific 3rd party JavaScript libraries, Salsa no longer supports these extensions in favor of TypeScript definition files which encourage community collaboration and are easier to keep up-to-date.

    While, the wording is somewhat ambiguous to me, I assume that this means that adding javaScript libraries as references directly is no longer supported in VS 2017. The only way to get Intellisense in VS 2017 is with a TypeScript definition file.

    I found this question on how to generate TypeScript def files from existing JavaScript files. The conventional wisdom is that TS def files require more specificity than JavaScript files, and therefore are most reliably created manually. However this may not be a feasible solution if you are like me and have tens of thousands of lines of custom library definitions.

    There are a couple of programs that will allegedly generate TS def files automatically, but I have never used them and cannot speak to their effectiveness.

    dts-gen is created by Microsoft.

    dts-generator is created by SitePen.

    It appears that the industry thinks that TypeScript is the way of the future, and are working hard to make TS development the standard.