Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 99637

require keyword not appearing in code completion

$
0
0

I'm learning Node.js using Visual Studio Code (VSCode) v1.40.0 on a Mac Catalina and I'm not seeing the 'require' keyword appear in the code completion. Is there an extension or setting I need in order to see the "require" keyword appear?

Extensions installed: ESLint v1.9.1, JavaScript (ES6) Code Snippets v1.7.2, JavaScript Snippet Pack v0.1.5, Node.js Extension Pack v0.1.9, Node.js Modules Intellisense v1.5.0, TSLint v1.2.2, Visual Studio Intellicode 1.2.0, and VS Code for Node.js - Development v2.0.1

Code completion does not appear for require('SomeModule'); var aName = require('SomeModule');

I expected to see the 'require' keyword to appear in the code hints/intellisense/Code completion.


UPDATE: I've been able to get rid of type errors but I can't seem to figure out how to get code completion to list 'require' or 'module.exports' in its options.

To get ride of type error messages.

{ "compilerOptions": { "module": "commonjs", "target": "es2015" }, "exclude": ["node_modules"] }


UPDATE: I think I may have figured out how to get some es2015/CommonJS (Since I'm new to NodeJS I don't know if I'm using the right terms) to appear for code completion but not the 'require' keyword when used inline like in:

var aName = require('SomeModule');

How I did it. When you're in a .js file look towards the bottom of VSCode and you'll see "JavaScript", clicking on it will bring up language option, select "Configure 'JavaScript' language based settings...", then under settings.json change

"eslint.options": { "parserOptions": { "ecmaVersion": 6,

to

"ecmaVersion": 5,


Viewing all articles
Browse latest Browse all 99637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>