2016年12月13日 星期二

解決Visual Studio Code的node.js自動提示功能無法正確動作

在編輯javascript檔時輸入程式時VS Code會根據內容自動提示

1. root folder中建立一個新的jsconfig.json
只要有這個檔案存在,VS Code就會認為這個專案是Javascript,這樣Javascript的Auto Hint才會動作。

2.使用node.js的typings模組產生node.js的typing definition檔(TypeScript語言)

安裝typings模組的指令:

npm install -g typings

使用typings工具去安裝Node.js及Express的type definition檔的指令:

typings install dt~node --global --save
typings install dt~express dt~serve-static dt~express-serve-static-core --global --save

其中的dt~前置詞是要Typings工具去DefinitelyTyped repository找type definition檔。



沒有留言: