简体   繁体   中英

VScode detects file as JavaScript, but doesn't highlight undefined functions

The following JavaScript is saved into a file called test.js

iDontExist();

(this is the entire file)

VSCode doesn't show the highlights for the iDontExist function, which isn't imported or required anywhere.

How can I make VScode highlight the undefined function?

在此处输入图像描述

Note other Intellisense features (eg, inspecting imports) in JS files (not TS files) seem to work fine:

在此处输入图像描述

Undefined functions in VSCode aren't automatically highlighted when they are undefined because ofglobals , this includes a totally different setup to get the highlighting running:

Using the ESlint Extension to get undefined functions or errors highlighted.

在此处输入图像描述

You can also use ts-check , which is what I use and has been working fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM