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.
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.
Share Improve this question edited Jul 11, 2019 at 7:56 RBT 26k24 gold badges175 silver badges260 bronze badges asked Aug 16, 2018 at 18:24 Rich PRich P 512 bronze badges4 Answers
Reset to default 5Click 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.
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 pletions (which I assumed was what you meant by IntelliSense). The techniques described in the other answers may give you basic syntax highlighting.
Those who needs this functionality for a plugin can use the following contribution in their package.json
files:
"contributes": {
"languages": [
{
"id": "javascript",
"extensions": [
".myext"
]
}
],
}
This defines a file extension call myext
that will be treated as javascript which es very handy for adding intellisense to virtual files.
https://code.visualstudio./api/references/contribution-points#contributes.languages https://code.visualstudio./api/extension-guides/virtual-documents