mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-28 11:31:55 +02:00
use helpers to see if there is '}' already
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user