From 5d0c23e0fa001b5a2c44848c1ea77c33ee12d917 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 25 Feb 2013 14:50:55 -0800 Subject: [PATCH] Sort grammars by name in select list --- src/app/grammar-view.coffee | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/app/grammar-view.coffee b/src/app/grammar-view.coffee index b20ef13e5..1b9bde470 100644 --- a/src/app/grammar-view.coffee +++ b/src/app/grammar-view.coffee @@ -31,6 +31,17 @@ class GrammarView extends SelectList populate: -> grammars = new Array(syntax.grammars...) + grammars.sort (grammarA, grammarB) -> + if grammarA.scopeName is 'text.plain' + -1 + else if grammarB.scopeName is 'text.plain' + 1 + else if grammarA.name < grammarB.name + -1 + else if grammarA.name > grammarB.name + 1 + else + 0 grammars.unshift(@autoDetect) @setArray(grammars)