Open NightMachinery opened 4 years ago
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
What does project mean here? Are you using a jsconfig.json project? Just opening a folder?
Can you please share example code (as text) or an example project along with more detailed steps to reproduce the issue
@mjbvz Here are my current project-less JavaScript scripts. I mean that they are traditional unix shebang scripts, with no extra config file whatsoever. They simply use the global environment, just as a simple python script might do (as opposed to a python package).
Similar to https://github.com/microsoft/TypeScript/issues/30902
The issue seems to be that we aren't picking up any signals that these JS files should have node apis enable
As a workaround, you can either npm install @types/node
into your workspace or create a jsconfig that explicitly includes the node typings:
{
"compilerOptions": {
"module": "commonjs",
"target": "es2016",
"jsx": "preserve",
},
"exclude": [
"node_modules",
"**/node_modules/*"
],
"typeAcquisition": {
"include": [
"node"
]
}
}
@mjbvz I added that jsconfig file, and now node API is recognized by the IntelliSense, but required packages are not. Is there a way to solve that?
Steps to Reproduce:
Here is intellisense working correctly for a node script in a project:
Here is another screenshot showing the support not working for a global script that does have a project:
As node.js is a perfectly valid choice for scripting, and has no need for verbose project structures to work, the lack of support is a bug.
System Info