[TxMt] Re: javascript syntax highlighting help

Graham Heath graham.p.heath at gmail.com
Thu Aug 1 17:58:40 UTC 2019


Hi Robert,

The issue, it seems to me is that the grammar for functions picks up 
`if()` but the grammar for control structures picks up `if ()`. I did 
take a whack at your request directly but didn't achieve the goal. An 
easy solution might be to highlight the function version in your theme 
to be the same as the control structure.

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()`.

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.

I'd love to see a "Newbs guide to TM Language Grammars" (or maybe could 
point one out). There's a lot of information out there, but it'd be nice 
to gather in to one place, and format it in a "zero to hero" format. I 
feel like StackOverflow agrees: 
https://stackoverflow.com/search?q=textmate+grammar (and it'd be nice to 
reduce the number of TextMate tags on VSCode issues, lol).

Hope that helps,
Graham

On 31 Jul 2019, at 20:14, Robert J. Carr wrote:

> (I just asked this to irc so sorry for the duplicate)
>
> I'm looking for guidance on how to change the javascript grammar so 
> it'll
> syntax highlight both, e.g., "if (...)" and "if(...)".  Currently, 
> only the
> former works, and I believe this is for most control statements, e.g., 
> if,
> for, while, etc.
>
> In java, for example, both work, and I tried to compare the grammars 
> to
> make my own edits, but found them too complicated and different, and
> anything I tried didn't work.
>
> Any guidance would be appreciated.
>
> Thanks-
> Robert
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> https://lists.macromates.com/listinfo/textmate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macromates.com/textmate/attachments/20190801/b753e33b/attachment.html>


More information about the textmate mailing list