Home Download Buy Blog Forum Support

Syntax Highlighting for nested objects (html specifically)

Re: Syntax Highlighting for nested objects (html specifically)

Postby nick. on Fri Sep 14, 2012 4:53 pm

chris.george wrote:Or am I misreading that? So, if I'm reading you correctly, you answered my original question: nested scopes doesn't work.


You are correct that the first matching scope is the one that is applied. But that doesn't mean nesting doesn't work.

Suppose we have the following text:
Code: Select all
def my_function():
    pass

def my_other_function():
    pass


With this syntax definition:
Code: Select all
<dict>
    <key>name</string>
    <string>entity.name.function.python</string>
    <key>begin</key>
    <string>def</key>
    <key>end</key>
    <string>:$</string>
    <key>patterns</key>
    <array>
        <dict>
            <key>name</key>
            <string>my-function.python</string>
            <key>match</key>
            <string>my_function\(</string>
        </dict>
    </array>
</dict>


Q: What is the scope of my_function?
A: entity.name.function.python and my-function.python, with the styling (color scheme/.tmTheme) going from most specific to least specific.

Q: What is the scope of my_other_function?
A: Just entity.name.function.python
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Previous

Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], tommyp, Yahoo [Bot] and 30 guests