Sublime Forum

Preferences menu does not work

#1

hi,

I am trying to set my preferences for a plugin. First, ‘Preferences’ showed up twice, now only once (I changed some things) but ‘Test’ is not listed in ‘Package Settings’

[
   {
      "caption": "Test",
      "mnemonic": "T",
      "id": "test",
      "children":
      [
         {
            "caption": "tool",
            "children":
            [
               { "command": "command"}
            ]
         }
      ]
   },
   {
      "id": "preferences",
      "children":
      [
         {
            "caption": "Package Settings",
            "mnemonic": "P",
            "id": "package-settings",
            "children":
            [
               {
                  "caption": "Test",
                  "children":
                  [
                     {
                        "command": "open_file",
                        "args": {"file": "${packages}/Test/Test.sublime-settings"},
                        "caption": "Settings – Default"
                     }
                  ]
               }
            ]
         }
      ]
   }
]

I cannot see the problem?

0 Likes

#2

The problem is the order. Because the item with the original preferences id occurs before the first item with test (the one you just created in the first file), the second preferences id will point to a different element and try to create a new menu. However, because you didn’t provide a caption it fails and you don’t see anything.

See also the “Note” here:

http://docs.sublimetext.info/en/latest/customization/menus.html#item-ids

1 Like

#3

hah, took me a while to understand that! You are right it’s the order of things. :smiley:

0 Likes

#4

Yeah, took me a while too when I reverse-engineered ST to write that document :wink:

0 Likes