Is it currently possible to associate a given language with a file extension that is not typically associated with that language?
Say I have a filetype *.foo, and I want to associate it with JavaScript for syntax highlighting. Does anyone know if this is currently possible with VSCode?
I am working in a language that is syntactically similar to Visual Basic, and want to associate it with that language type. I understand that you can assign a language after the file is opened, however this is cumbersome to do each time a file is opened.
In Sublime Text for example it is possible to select "Open all with current extension as...". Does this exist yet for VSCode?
EDIT: The Visual Studio Code team has added a proper way to add both themes and languages.
https://code.visualstudio.com/updates#_yo-code-streamlined-customizations-for-vs-code
VS code file association. README.md. In Visual Studio Code you can add persistent file associations for language highlighting to your settings.json file like this: // Place your settings in this file to overwrite the default settings { "some_setting": custom_value, ... "
In Visual Studio Code, we have support for almost every major programming language. Several ship in the box, for example, JavaScript, TypeScript, CSS, and HTML but more rich language extensions can be found in the VS Code Marketplace.
VS Code extensions support two main languages: JavaScript and TypeScript.
VSCode v1.0 officially adds the File to Language Association feature. Add the following into .vscode/settings.json
:
"files.associations": {
"*.foo": "javascript"
}
You may find more details in the Visual Studio Code 1.0.0 release notes “File to language association” section.
You can do it yourself: For this example I'll add the ".ino" files to the C++ plugin.
Navigate to the folder containing the corresponding plugin: C:\Users\username\AppData\Local\Code\app-0.1.0\resources\app\plugins\vs.language.cpp
Open the ticino.plugin.json file and edit contributes.language.extension. In this case, you go from:
"extensions": [ ".cpp", ".c", ".cc", ".cxx", ".h", ".hpp", ".hh"],
to
"extensions": [ ".cpp", ".c", ".cc", ".cxx", ".h", ".hpp", ".hh", ".ino" ],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With