Sublime Forum

Working on a custom symbol list for a specific type of XML

#1

Hi,

I am working on a symbol list for a specific type of XML file that contains the following:

<?xml version="1.0" encoding="UTF-8"?>
<graph name="graphName">

  <description>bla</description>
  
  <abc-state-defaults bla />
   
  <abc-state name="foo" actionRequest="bla">
    ....
  </abc-state>
  
  <abc-state name="bar" actionRequest="asdf">
    ....
  </abc-state>

<close-state name="Complete"/>
</graph>

I tried the following to get the symbols to at least show up:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>name</key>
    <string>Symbol List: ARHs</string>
    <key>scope</key>
    <string>text.xml</string>
    <key>settings</key>
    <dict>
        <key>showInSymbolList</key>
        <integer>1</integer>
        <key>showInIndexedSymbolList</key>
        <integer>1</integer>
    </dict>
</dict>
</plist>

However, this is resulting in all of the xml file to appear as a single symbol. Is there a way I can get the following as symbols:

  • graph name; namely “graphName”
  • abc-state names; namely “foo” & “bar”
  • close-state name; namely “Complete”

Thanks for the help in advance!

0 Likes

#2

In a custom syntax definition, you need to assign specific scope names to the tokens you want to add to the list which you then select via the .tmPreferences file.

See also http://docs.sublimetext.info/en/latest/reference/symbols.html.

0 Likes