Reputation: 51
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.
Upvotes: 4
Views: 1937
Reputation: 13620
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 comes very handy for adding intellisense to virtual files.
https://code.visualstudio.com/api/references/contribution-points#contributes.languages https://code.visualstudio.com/api/extension-guides/virtual-documents
Upvotes: 0
Reputation: 30879
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.
Upvotes: 0
Reputation:
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.
Upvotes: 5
Reputation: 50028
Use the files.associations
setting:
"files.associations": {
"*.customExtension": "javascript"
}
Upvotes: 1