node.js - Visual Studio Code Intellisense not working for Javascript -


i using visual studio code (vsc) 0.10.11 on windows , mac. purpose of question have small javascript snippet:

'use strict';  const os = require('os'); console.log(os.homedir()); 

i followed john papa on visual studio code (blog entry , pluralsight visual studio code javascript intellisense - have account) , therefore expect vsc provides intellisense , quick fix options when typings available.

in snippet above vsc recognizes console , log() (i use hoover, same intellisense):

console log

but not os , homedir():

os homedir

but 4 typings available in typings/main/ambient/node/index.d.ts. know difference require in case of os, in john papa's video course vsc provided intellisense required modules. difference john papa used tsd while using typings.

so questions are

  • how can enable intellisense known typings?
  • what have vsc offers me quick fix (green line under moduls missing typings)?

the above links outdated. in older versions of vs code needed reference typings /// <reference path> somelibrary.d.ts.

with new version need initialize project creating jsconfig.json @ root of project , add following inside:

{     "compileroptions": {         "target": "es5",         "module": "commonjs"     },     "exclude": [       "node_modules"     ] } 

next install typing need. can use either tsd or typings. in case need install tsd install node or typings install node --ambient. make sure have typings/tsd installed. restart project.

please refer docs:

  1. setup js project - https://code.visualstudio.com/docs/languages/javascript
  2. node.js - https://code.visualstudio.com/docs/runtimes/nodejs
  3. debugging - https://code.visualstudio.com/docs/editor/debugging

update:

since version 1.7 there no need manually install typings, should downloaded automatically. better javascript intellisense


Comments