How to make VS Code to treat other file extensions as certain language?

后端 未结 9 1469
傲寒
傲寒 2020-11-27 09:35

Or is there a way to switch the current file\'s language to use syntax highlight feature?

For example, *.jsx actually uses JavaScript but VS Code doesn\

9条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 10:03

    Following the steps on https://code.visualstudio.com/docs/customization/colorizer#_common-questions worked well for me:

    To extend an existing colorizer, you would create a simple package.json in a new folder under .vscode/extensions and provide the extensionDependencies attribute specifying the customization you want to add to. In the example below, an extension .mmd is added to the markdown colorizer. Note that not only must the extensionDependency name match the customization but also the language id must match the language id of the colorizer you are extending.

    {
        "name": "MyMarkdown",
        "version": "0.0.1",
        "engines": {
            "vscode": "0.10.x"
        },
        "publisher": "none",
        "extensionDependencies": [
            "markdown"
        ],
        "contributes": {
            "languages": [{
                "id": "markdown",
                "aliases": ["mmd"],
                "extensions": [".mmd"]
            }]
        }
    }
    

提交回复
热议问题