简体   繁体   中英

How to enable JavaScript IntelliSense for custom file extensions in VS Code?

The question title says it all. My organization uses a non-standard file extension on source code written using JavaScript. Changing the file extension to ".js" seems to activate IntelliSense.

However, I was wondering if the IntelliSense could be activated using the non-standard file extension.

Click the bottom right of the window where it says "Plain Text" or the name of the detected language. This will bring up a menu at the top that lets you change it for the current session and also configure that specific extension to always be interpreted as JS. VS代码底部工具栏 VS代码语言选择菜单

Use the files.associations setting :

"files.associations": {
  "*.customExtension": "javascript"
}

From this issue (found in a web search ), it sounds like the TypeScript language service does not support non-standard extensions, so you won't be able to get semantic features like type-based completions (which I assumed was what you meant by IntelliSense). The techniques described in the other answers may give you basic syntax highlighting.

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