 
 module.exports =
 class AutocompleteView extends SelectListView
+  SORT_MAP:
+    'LOW': 1
+    'DEFAULT': 0
+    'HIGH': -1
+
   initialize: (@editorView, @autocompleter) ->
     super
     @editor = @editorView.editor

    $$ ->
      @li class: 'two-lines', =>
        @div class: 'primary-line', item.completion
        @div class: 'secondary-line', item.docSummary        

  selectNextItemView: ->
    super


    @subscribe @autocompleter, 'autocomplete', (@autocompleteInfo) =>
      results = @autocompleteInfo.results
      sortedResults = _.sortBy results, (res) => @SORT_MAP[res.relevance]
      @setItems(sortedResults)

  # Copied from atom/autocomplete/lib/autocomplete-view.coffee
  attach: ->
