Sublime Forum

Alphabetic sorting packages list

#1

PreferencesPackage Settings → list of my packages:

Unfortunately, not all packages sorted alphabetically by default. How can I sort them? Thanks.

2 Likes

#2

I just discovered something interesting. The packages are loaded in the correct order, and thus one would expect that the menu would be populated in the same order. Well, it is, even though it doesn’t look like it. Because, if the package declares an id for it’s item in the Main.sublime-menu file, then it goes underneath all those menu entries without an id, and order could be based on the id value, which is why they aren’t like a-z for all those without id’s and a-z for all those with ids - the ids might not be the same as the package name…

As there is no need for the id, you can use PackageResourceViewer to comment it out.

For example, I just edited Packages/ScopeHunter/Main.sublime-menu and commented out the line //"id": "ScopeHunter", and it then appeared in the correct alphabetical order with the others.

EDIT: although, as per what FichteFoll says below, my idea will only work if none of your packages are extracted, or all of them are.

it seems the docs already mention this :slight_smile: http://docs.sublimetext.info/en/latest/customization/menus.html?highlight=load%20order

2 Likes

#3

You can’t. Package load order is described in the package docs on sublimetext.info.

Well okay, you could make them sorted by extracting all .sublime-package files, but I don’t recommend it.

Edit: and what @kingkeith said regarding ids, if there are any. You will generally notice that the packages in the menu start at a again at some point, which is caused by package load order.

0 Likes

#4

@kingkeith, I read documentation, but I can not understand, what I do wrong. My example file:

[
    {
        "caption": "Preferences",
        "mnemonic": "n",
        "id": "preferences",
        "children":
        [
            {
                "caption": "Package Settings",
                "mnemonic": "P",
                "id": "package-settings",
                "children":
                [
                    {
                        "caption": "SashaSublime",
                        "children":
                        [
                            {
                                "caption": "Send issue",
                                "command": "sasha_sublime_issues",                            },
                        ]
                    }
                ]
            }
        ]
    }
]

But example menu Item in bottom:

Thanks.

0 Likes

#5

Here are the links, for convenience:

2 Likes