0

Yes, I've seen a dozen questions on this exact subject, I'll list a few dozen below:

How to enable Node.js code autocompletion in VSCode?
There is no intellisense in vs code node js
Visual Studio Code Intellisense not working for Javascript

All of these questions have the same answer: install @types/node, which makes a package.json and a node_modules folder.

I want to work on a simple script, one that will be one file, starts with a node shebang, and has no package dependencies. I'm working in a dropbox folder. I don't want to create a hundred-thousand subfolders under node_modules that my dropbox has to sync because no one knows how to write a package without a dozen redundant dependencies anymore. I'd be perfectly fine with installing the types package globally, but I have yet to see that function without an absolute path to the node installation (dropbox folder, remember?).

Is there a way to enable autocompletion in VSCode without needing to install packages as a sibling in the folder structure?

Tustin2121
  • 2,058
  • 2
  • 25
  • 38

1 Answers1

0

Apparently creating a jsconfig.json file as follows in the same folder will allow one to enable node.js autocompletion without needing to install anything. (Though I did do this after globally installing @types/node, so that might be required.)

{
    "typeAcquisition": {
        "include": [
            "node"
        ]
    }
}

This will apparently tell VSCode to automatically search for and include the given types? Either way, it enables node.js autocompletion.

Tustin2121
  • 2,058
  • 2
  • 25
  • 38