Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Code completion in Node project #561

Open
ferrao opened this issue Feb 15, 2019 · 2 comments
Open

Code completion in Node project #561

ferrao opened this issue Feb 15, 2019 · 2 comments

Comments

@ferrao
Copy link

ferrao commented Feb 15, 2019

I have been scratching my head for a while on how to get code completion to work with a NodeJS project. All my node projects set NODE_PATH=src:..

This is the best way that I found to avoid things like:

const myModule = require('../../../../some-other-module');

I can now simply do :

const myModule = require('some-other-module');

But code completion does not work at all. Typing myModule. reveals lots of wrong stuff, nothing related to the module contents.

Any pointers on how to properly configure the language server? I have tried all settings.json and jsconfig.json snippets I have found, always without success. I have navigated through many web pages and tried all sorts of configurations, but the result is always the same.

@malob
Copy link

malob commented Feb 17, 2019

Pretty sure completions for javascript files are dependent on type information, and so you'll need to install the types for the modules your working with. Try npm install --save-dev @types/node.

You can search for type definition packages here: http://definitelytyped.org

@ferrao
Copy link
Author

ferrao commented Feb 19, 2019

I'm referring to my own code @malob , not some external project dependency. And all my code is plain JavaScript.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants