How to avail this feature in Visual Studio code editor?

I am using vscode and I have noticed that it doesn’t show autocomplete/intellisense for imported modules. Say for example I made module named colour which has 2 methods say red and blue.
Now I imported this colour module in mu main file by var colour = require('colour').
Now when I type colour. , it should show me red, blue . But by default it doesn’t have this feature. I have seen in some tutorials this feature been available in atom. Does anybody know how to avail this feature in Visual Studio code?

What happens if you add JSDoc comments to your color module?

if a module is written in javascript, you have to provide type definition for it to make intellisense work.

I gave colour module here as example.Although i am working on similar pattern , and there if I am typing /** it is showing intellisence to complete.

What is type definition and how and how and where I should provide it?

It might be a bit advanced topic (I don’t know on what level you’re at) but anyway
https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html

newer versions of vscode automagically import declaration files for packages listed in package.json file.

We talked with our friends on the TypeScript team and they came up with “Automatic Type Acquisition”. ATA makes typings files almost invisible. A TypeScript language server that has ATA enabled watches your package.json files and automatically installs the typings files of all dependencies in a cache on your file system. It does the same when it finds references to well known client-side libraries. When you then invoke IntelliSense, the TypeScript server uses the typings files in the cache. The cache is shared between all your workspaces.

from http://code.visualstudio.com/updates/v1_7

I have latest update of VScode(1.10).

newer versions of vscode automagically import declaration files for packages listed in package.json file.

That’s working for me. I was actually talking about the file we make and require that in another file.
Anyways thanks for your time and replies :slight_smile:

Just so that you’re extra annoyed: This seems to be working for me just fine in VS Code without doing any setup on my part. Not sure what to say. (Running 1.10.2)

Yes! Some of my FCC friends have also working this feature perfectly fine! I don’t know why it’s not working for me! May be something because of ubuntu? Or may be just Microsoft hates me as I switched from Windows to linux few months back! LOL :smiley:

1 Like