VS Code March release brought some interesting features. I had been looking for some editor which would give good intellisense and debugging. Node inspector is pathetic when debugging applications compared to what is available in java, .net and other languages. Webstorm is a good one but is a resource hog and expensive.
Intellisense work amazingly great with VSCode at least when you use Meteor 1.3. It now understands es6 modules and provides full intellisense for your own es6 modules. It still does not work with imports from meteor packages. I did not configure it for outside libraries but for my own modules in the project it works like a charm. Just configure jsconfig.json and you are good to go. Refactoring works nicely with it. I can say it provide the best Intellisense among the many editors i tried like sublime, atom etc.
Here is my jsconfig.json
{
ācompilerOptionsā: {
ātargetā: āES6ā,
āmoduleā: āes6ā
},
āexcludeā: [
ānode_modulesā,
".meteor",
".gagarin"
],
āfilesā: [
āclient/",
"server/ā,
ālib/*ā
]
}
VS Code offer debugging node applications as well. I tried it with meteor but was not able to debug using the launch configuration. The only way i was able to debug meteor application on the server side was to run meteor as āmeteor debugā and than use the attach configuration to attach with the process to debug. I had to alter launch.json file a little and voila i was able to debug inside VSCode and it works amazingly nice. I was able to debug anonymous function and all without a hiccup. Watches and stacks all works nicely.
Here is the example of my launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/server/main.js",
"stopOnEntry": false,
"args": [],
"cwd": "${workspaceRoot}/server/",
"preLaunchTask": null,
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"externalConsole": false,
"sourceMaps": false,
"outDir": null
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858,
"address": "localhost",
"restart": false,
"sourceMaps": true,
"outDir": "${workspaceRoot}/.meteor/local/build/programs/server",
"localRoot": "${workspaceRoot}",
"remoteRoot": null
}
]
}
The first configuration does not work but the second one does using attach.
Please share your experiences if you have tried VSCode. Are there better ways to debug or use intellisense in VSCode than what i have described? If yes please do share so that everybody benefits. VSCode is a fantastic editor and it can become ideal for meteor.
Thanks