mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
use helpers to see if there is '}' already
This commit is contained in:
parent
08593f1f4b
commit
d2adc753aa
1 changed files with 6 additions and 3 deletions
|
@ -1,4 +1,6 @@
|
|||
define () ->
|
||||
define [
|
||||
"./Helpers"
|
||||
], (Helpers) ->
|
||||
packages = [
|
||||
'inputenc', 'graphicx', 'amsmath', 'geometry', 'amssymb', 'hyperref',
|
||||
'babel', 'color', 'xcolor', 'url', 'natbib', 'fontenc', 'fancyhdr',
|
||||
|
@ -24,13 +26,14 @@ define () ->
|
|||
constructor: (@metadataManager) ->
|
||||
|
||||
getCompletions: (editor, session, pos, prefix, callback) ->
|
||||
{closingBrace} = Helpers.getContext(editor, pos)
|
||||
usedPackages = Object.keys(@metadataManager.getAllPackages())
|
||||
packageSnippets = []
|
||||
for pkg in packages
|
||||
if pkg not in usedPackages
|
||||
packageSnippets.push {
|
||||
caption: "\\usepackage{#{pkg}}"
|
||||
snippet: "\\usepackage{#{pkg}}"
|
||||
caption: "\\usepackage{#{pkg}#{closingBrace}"
|
||||
snippet: "\\usepackage{#{pkg}#{closingBrace}"
|
||||
meta: "pkg"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue