<div dir="ltr">Hi Allan-<div><br></div><div>Sorry for the late reply, but changing the order did seem to fix the problem, but like you said I don't know what the side effects will be. I'll keep the original grammar as a backup in case something goes wrong, but thanks for taking the time to look into this.</div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><br><div>Robert</div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 1, 2019 at 12:03 PM Allan Odgaard <<a href="mailto:mailinglist@textmate.org">mailinglist@textmate.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div>
<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 rgb(119,119,119);color:rgb(119,119,119);margin:0px 0px 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:rgb(247,247,247);border-radius:5px;margin-left:15px;margin-right:15px;max-width:90vw;overflow-x:auto;padding:5px" bgcolor="#F7F7F7"><code style="background-color:rgb(247,247,247);border-radius:3px;margin:0px;padding:0px" bgcolor="#F7F7F7">{ include = '#function-call'; },
</code></pre>
<p dir="auto">Then line 305-307 has this rule (to match <code style="background-color:rgb(247,247,247);border-radius:3px;margin:0px;padding:0px 0.4em" bgcolor="#F7F7F7">if</code> and other keywords):</p>
<pre style="background-color:rgb(247,247,247);border-radius:5px;margin-left:15px;margin-right:15px;max-width:90vw;overflow-x:auto;padding:5px" bgcolor="#F7F7F7"><code style="background-color:rgb(247,247,247);border-radius:3px;margin:0px;padding:0px" 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:rgb(247,247,247);border-radius:3px;margin:0px;padding:0px 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>
</div>
<br>
_______________________________________________<br>
textmate mailing list<br>
<a href="mailto:textmate@lists.macromates.com" target="_blank">textmate@lists.macromates.com</a><br>
<a href="https://lists.macromates.com/listinfo/textmate" rel="noreferrer" target="_blank">https://lists.macromates.com/listinfo/textmate</a></blockquote></div>