From cbae1857e74a12e1623a6a15020816c50b9d53c8 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 29 Jun 2017 10:54:07 +0100 Subject: [PATCH] Allow exact match to be ranked higher than any other result --- .../auto-complete/SuggestionManager.coffee | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/SuggestionManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/SuggestionManager.coffee index 97241a90ce..bb15035b44 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/SuggestionManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/SuggestionManager.coffee @@ -80,7 +80,6 @@ define [], () -> doc = session.getValue() parser = new Parser(doc) commands = parser.parse() - completions = [] for command in commands caption = "\\#{command[0]}" @@ -94,12 +93,12 @@ define [], () -> snippet += "{${#{i}}}" caption += "{}" i++ - unless caption == prefix - completions.push { - caption: caption - snippet: snippet - meta: "cmd" - } + completions.push { + caption: caption + snippet: snippet + meta: "cmd" + score: if prefix == caption then 99 else 50 + } callback null, completions