From 020fd2e88dfa9411807cd05ebb6751a5779f0305 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 17 Mar 2016 15:58:57 +0000 Subject: [PATCH] De-dupe autocomplete entries --- .../aceEditor/auto-complete/SnippetManager.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/SnippetManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/SnippetManager.coffee index 3b3d4baf3b..6dc605e8ea 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/SnippetManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/SnippetManager.coffee @@ -126,7 +126,12 @@ define () -> docText = session.getValue() customEnvironments = parseCustomEnvironments(docText) beginCommands = parseBeginCommands(docText) - parsedItems = _.union(customEnvironments, beginCommands) + parsedItemsMap = {} + for environment in customEnvironments + parsedItemsMap[environment.name] = environment + for command in beginCommands + parsedItemsMap[command.name] = command + parsedItems = _.values(parsedItemsMap) snippets = staticSnippets.concat( parsedItems.map (item) -> {