diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee index 23e653ae54..4bdcb4512c 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee @@ -46,14 +46,22 @@ define [ ReferencesCompleter = getCompletions: (editor, session, pos, prefix, callback) -> if references.keys - result = references.keys.map (key) -> { - caption: key, - snippet: key, - meta: "reference", - score: 10000 - } - console.log result - callback null, result + range = new Range(pos.row, 0, pos.row, pos.column) + lineUpToCursor = editor.getSession().getTextRange(range) + commandFragment = getLastCommandFragment(lineUpToCursor) + console.log commandFragment + if commandFragment == '\\cite{' + console.log ">> yes" + result = references.keys.map (key) -> { + caption: key, + snippet: key, + meta: "reference", + score: 10000 + } + console.log ">> reference keys #{result.length}" + callback null, result + else + callback null, [] @editor.completers = [@suggestionManager, SnippetCompleter, ReferencesCompleter]