9

How can I get WebStorm IDE to give me code completion for libraries that I've downloaded.

JavaScript Libraries

As you can see angularjs-DefinitelyTyped and jQuery-DefinitelyTyped have been downloaded.

Now I believe that I have to reference the definition file in my .ts files.

Code

But, where WebStorm saves the definition files so I can reference them in my code?

Thank you!

ThiagoPXP
  • 5,362
  • 3
  • 31
  • 44
  • I find that if you include all of the necessary files, everything just works. I use Ext JS and I haven't ever needed to use the WebStorm Libraries functionality. – Sumner Evans Mar 13 '14 at 01:34
  • 1
    I just find it weird with there is an option in the IDE to download the reference files, set their scope to Global and then what? :( – ThiagoPXP Mar 13 '14 at 01:40

3 Answers3

21

As basarat says in his answer, you need to include the definitions manually. The easiest way to do this is with tsd. Once installed (npm install -g tsd), navigate to the directory you want to hold the typings, and install definition files (such as angular, in the following example) like this:

tsd query angular --action install

or, better yet:

tsd init
tsd query angular --save --action install

Note that you can do all this within Webstorm (alt-F12 opens a terminal window).

dug
  • 2,275
  • 1
  • 18
  • 25
7

That dialog is for JavaScript scope, not TypeScript scope (e.g. see mocha demo http://youtu.be/4mKiGkokyx8?t=1m19s). That is, Webstorm is using TypeScript definitions to give intellisence for JavaScript.

For TypeScript itself you need to include the definitions into your project manually (https://github.com/borisyankov/DefinitelyTyped/blob/master/angularjs/angular.d.ts) and reference them like you always have.

basarat
  • 261,912
  • 58
  • 460
  • 511
0

On Webstorm for mac

Preferences->Languages&Frameworks->Typescript

Use tsconfig.json should be checked and you should create a tsconfig.json file which contains

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "sourceMap": true
  },
  "exclude": [
    "node_modules"
  ]
}
Guest
  • 1