<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">On 1 Aug 2019, at 19:58, Graham Heath wrote:</p>

</div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir="auto">The way I gathered this information was to use "Show scope" ( in a JS file with the cursor on the `if`s, this was showing "keyword.control.js" for `if ()`, but 'punctuation.definition.function-call.begin.js' for `if()`.<br>
<br>
Maybe, short of an answer, this helps you figure out the issue? Or inspire someone else on the group to help get you an actual answer.</p>
</blockquote></div>
<div style="white-space:normal">

<p dir="auto">This seems to be a precedence problem.</p>

<p dir="auto">Line 287 of the grammar has this (includes the rule to match function calls):</p>

<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">{    include = '#function-call'; },
</code></pre>

<p dir="auto">Then line 305-307 has this rule (to match <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">if</code> and other keywords):</p>

<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">{    name = 'keyword.control.js';
    match = '(?<!\.|\$)\b(async|await|break|case|catch|continue|default|do|else|export|finally|for|if|return|switch|throw|try|while|with)\b(?!\$)';
},
</code></pre>

<p dir="auto">The problem is that the rule to match function calls comes first in the grammar, so when the construct is matched by that line, it never reaches the keyword rule.</p>

<p dir="auto">The fix is to move the <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">keyword.control.js</code> rule up before the function call rule.</p>

<p dir="auto">But the grammar is pretty complex, I didn’t check if there would be any side effects from this.</p>
</div>
</div>
</body>
</html>