Working in my node projects and presentations I pop back and forth between both Sublime Text 3 and VS Code but I find myself increasingly just using VS Code. One of the reasons is that I am able to get great intellisense using the node and express typescript definition files.
As you can see by the screenshots below, even when I am just creating a simple server using the node http module, with VS Code, I get that great “.” intellesense.
This is invaluable for any developer but especially for developers new to the stack that might not have all of the methods available stored in their head.
Getting node and express intellisense in VS Code
In order to get specific package intellisense in vs code you will need to install a couple of things. There are a number of ways to do this but I am just going to use the command line (powershell or Terminal in OSX). The first thing you need to do is to install TSD globally.
npm install -g tsd
When installing this will tell you that TSD is deprecated in favor of Typeings(https://github.com/typings/typings) but I use TSD anyway. Both will work similar with this a bit of a syntax difference when installing the tsd’s.
Once tsd is installed globally. Make sure you are in the project folder that you need the intellisense in and run the following commands.
tsd query node --action install tsd query express --action install
This will install the type definition files for both node and express. If you need tsd files for other things you can see what is available either at the github repository (where tsd pulls these files) https://github.com/DefinitelyTyped/DefinitelyTyped or the website http://definitelytyped.org/
I have tried to find a way to do this with sublime.
I checked http://definitelytyped.org/directory/tools.html and found under IDE tools sublime-typescript https://github.com/raph-amiard/sublime-typescript but it said it was not maintained anymore and sent me here : https://github.com/raph-amiard/sublime-typescript which itself is no longer maintained, which directed me here : https://github.com/Phaiax/ArcticTypescript which is a fork of the last one and seems to be maintained but when I install it, I don’t see it giving me the intellisense I am looking for.
So at this point, I cant seem to get this in Sublime. If someone knows a way to implement this through a plugin, please let me know.