mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
load the keys if the command is a 'cite'
This commit is contained in:
parent
e94863d026
commit
b0f3d9e6f4
1 changed files with 16 additions and 8 deletions
|
@ -46,14 +46,22 @@ define [
|
||||||
ReferencesCompleter =
|
ReferencesCompleter =
|
||||||
getCompletions: (editor, session, pos, prefix, callback) ->
|
getCompletions: (editor, session, pos, prefix, callback) ->
|
||||||
if references.keys
|
if references.keys
|
||||||
result = references.keys.map (key) -> {
|
range = new Range(pos.row, 0, pos.row, pos.column)
|
||||||
caption: key,
|
lineUpToCursor = editor.getSession().getTextRange(range)
|
||||||
snippet: key,
|
commandFragment = getLastCommandFragment(lineUpToCursor)
|
||||||
meta: "reference",
|
console.log commandFragment
|
||||||
score: 10000
|
if commandFragment == '\\cite{'
|
||||||
}
|
console.log ">> yes"
|
||||||
console.log result
|
result = references.keys.map (key) -> {
|
||||||
callback null, result
|
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]
|
@editor.completers = [@suggestionManager, SnippetCompleter, ReferencesCompleter]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue