Reputation: 111
Trying to make the move from webstorm to vscode.
Im trying to figure out how to target textMateRules more accurately. Specifically demanding more than one scope match.
I read somewhere that you did it like this, but it gets overwritten by the default entity.name.function
.
"scope": [
"entity.name.function meta.method.declaration"
],
Any help appriciated.
Upvotes: 3
Views: 1835
Reputation: 153
It looks like you have to use the textmate scopes from the inspector in the opposite order (from bottom to top).
For example, I tried to apply my rule to array
keyword followed by a round bracket (PHP).
The scope inspector showed the scopes in this order:
support.function.construct.php
meta.array.php
meta.function-call.php
source.php
meta.embedded.block.php
text.html.php
Like this:
I took the first two and reversed the order in my settings.json
file like this.
In the screenshot above you can see that the rule is already applied.
{
"scope": "meta.array.php support.function.construct.php"
"settings": {
"foreground": "#000ba3",
"fontStyle": "bold"
}
}
Upvotes: 1
Reputation: 121
In my VS Code (1.63.2) for multiple scopes I use this code:
"scope": [
"entity.name.function",
"meta.method.declaration"
],
Upvotes: 1
Reputation: 111
I had not realized ordering was important.
"scope": [
"meta.method.declaration entity.name.function"
],
Did the trick.
Upvotes: 8