I am using Sublime Text 3, in this case to edit LaTeX. To further customize the syntax highlighting I would like to define a new scope that simply extends the shipped LaTeX.tmLanguage
(to which I do not have access, not even to read). N.B. I have no interest to write my own tmLanguage-file, not even to download an existing, I just want to extend it, much like overloading a class in Python.
In particular I would like to add meta.footnote.latex
to have a custom syntax highlight for \footnote{...}
(one definition I found in https://github.com/bradrobertson/sublime-packages/blob/master/LaTeX/LaTeX.tmLanguage)
You can use the include directive to import existing rules from a different file and override or extend its rules.
.tmLanguage:
<dict>
<key>fileTypes</key>
<array>
<string>mylatex</string>
</array>
<key>name</key>
<string>MyLatex</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>text.tex.latex</string>
</dict>
<!-- your rules -->
</array>
<key>scopeName</key>
<string>text.tex.latex.mylatex</string>
</dict>
.sublime-syntax:
%YAML 1.2
---
name: MyLatex
file_extensions:
- mylatex
scope: text.tex.latex.mylatex
contexts:
main:
- include: scope:text.tex.latex
# your rules