I tried both including source.php
after my match rule and injection into the PHP language syntax.
Including the source shows PHP syntax coloring without my override, whereas injection shows my override without PHP coloring.
Attempt | PHP Syntax | My Syntax Override |
---|---|---|
With Injection | ❌ | ✅ |
Include PHP Source (source.php) | ✅ | ❌ |
I would like to see both work at the same time where my syntax overrides the PHP syntax.
Any ideas what is happening or how to achieve this please?
My code setup:
# Language
"languages": [
{
"id": "phpf",
"aliases": ["PHPF", "phpf"],
"extensions": [".phpf"],
"configuration": "./language-configuration.json",
"icon": {
"light": "file-icons/phpf.png",
"dark": "file-icons/phpf.png"
}
}
]
# Grammar
"grammars": [
{
"language": "phpf",
"scopeName": "source.phpf",
"path": "./syntaxes/phpf.json",
"injectTo": ["source.php"]
}
]
# Syntax
{
"scopeName": "source.phpf",
"fileTypes": ["phpf"],
"name": "PHPF",
"injectionSelector": "L:source.php",
"patterns": [
{
"name": "phpf.a",
"match": "___[A-Z]+___"
},
{
"include": "source.php"
}
]
}
# Coloring
"configurationDefaults": {
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "phpf.a",
"settings": {
"fontStyle": "bold",
"foreground": "#e24d33"
}
}
]
}
}