diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/CommandManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/CommandManager.coffee index 07ca3d2ecb..d194c7fb4a 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/CommandManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/CommandManager.coffee @@ -2,8 +2,6 @@ define [ "./top_hundred_snippets" ], (topHundred) -> - commandNames = (snippet.caption.match(/\w+/)[0] for snippet in topHundred) - class Parser constructor: (@doc, @prefix) -> @@ -96,18 +94,23 @@ define [ constructor: (@metadataManager) -> getCompletions: (editor, session, pos, prefix, callback) -> + commandNames = {} + for snippet in topHundred + commandNames[snippet.caption.match(/\w+/)[0]] = true + packages = @metadataManager.getAllPackages() packageCommands = [] for pkg, snippets of packages for snippet in snippets packageCommands.push snippet + commandNames[snippet.caption.match(/\w+/)[0]] = true doc = session.getValue() parser = new Parser(doc, prefix) commands = parser.parse() completions = [] for command in commands - if command[0] not in commandNames + if not commandNames[command[0]] caption = "\\#{command[0]}" score = if caption == prefix then 99 else 50 snippet = caption