VS Code, PHPタグをハイライトする

phpファイルを読む際、phpのタグは通常のHTMLタグと色分けされている方が読みやすい。また、コメント部分も何か色をつけるとわかりやすい。

そのためには、Setting.Jsonを開いて、”editor.tokenColorCustomizations”項目を追加すると良い。

    "editor.tokenColorCustomizations": {
        "comments": {
            "foreground": "#00ff0d",
            "fontStyle": "italic"
        },
        "textMateRules": [
            {
                "scope": [
                    "punctuation.section.embedded.begin.php"
                ],
                "settings": {
                    "foreground": "#ff0000",
                    "fontStyle": "italic"
                }
            },
            {
                "scope": [
                    "punctuation.section.embedded.end.php"
                ],
                "settings": {
                    "foreground": "#ff0000",
                    "fontStyle": "italic"
                }
            }
        ]
    }