I have a couple of annoying issues with VSCode for some time. I'm on version 1.68.1 and working in Node.js on MacOS. For the purposes of this test, I created a setup as follows:
projectDir
- package.json
- logger.js
- index.js
The package.json is inconsequential here but the other two files are as follows.
logger.js
const logger = (msg) => {
console.log(msg);
}
module.exports = { logger };
index.js
const { logger } = require("./logger");
someFunc();
logger("Hello!");
Here are the two things I'm struggling with:
- Unimported functions are not flagged. For example, there's a call to
someFunc()inindex.jsbut VSCode has no problems with it. It's the same with undeclared variables. If I adda = zz;in the file, there are no warnings. - If I close the
logger.jsfile, I can't autocomplete the import. What I mean is, if thelogger.jsfile is open, then I can just type "logger" and select the import from the suggestions list, but it doesn't happen if the file is closed. I'm not sure if this is how it's supposed to be, but it's very annoying once there are more than 10-15 files in the project as I need to manually open them before VSCode becomes "aware" of their exports.
Sorry if this is all silly, but these two things have been impacting my workflow. Please feel free to ask for more info!