mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #71 from sharelatex/ns-package-completer
fixing package completer
This commit is contained in:
commit
8ef48925c1
3 changed files with 62 additions and 18 deletions
|
@ -1,10 +1,11 @@
|
|||
define [
|
||||
"ide/editor/directives/aceEditor/auto-complete/CommandManager"
|
||||
"ide/editor/directives/aceEditor/auto-complete/EnvironmentManager"
|
||||
"ide/editor/directives/aceEditor/auto-complete/PackageManager"
|
||||
"ide/editor/directives/aceEditor/auto-complete/Helpers"
|
||||
"ace/ace"
|
||||
"ace/ext-language_tools"
|
||||
], (CommandManager, EnvironmentManager, Helpers) ->
|
||||
], (CommandManager, EnvironmentManager, PackageManager, Helpers) ->
|
||||
Range = ace.require("ace/range").Range
|
||||
aceSnippetManager = ace.require('ace/snippets').snippetManager
|
||||
|
||||
|
@ -35,6 +36,7 @@ define [
|
|||
})
|
||||
|
||||
SnippetCompleter = new EnvironmentManager()
|
||||
PackageCompleter = new PackageManager()
|
||||
|
||||
Graphics = @graphics
|
||||
Preamble = @preamble
|
||||
|
@ -126,10 +128,11 @@ define [
|
|||
callback null, result
|
||||
|
||||
@editor.completers = [
|
||||
@suggestionManager,
|
||||
SnippetCompleter,
|
||||
ReferencesCompleter,
|
||||
LabelsCompleter,
|
||||
@suggestionManager
|
||||
SnippetCompleter
|
||||
PackageCompleter
|
||||
ReferencesCompleter
|
||||
LabelsCompleter
|
||||
GraphicsCompleter
|
||||
]
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ define [], () ->
|
|||
'Lambda', 'Xi', 'Pi', 'Sigma', 'Upsilon', 'Phi', 'Psi', 'Omega'
|
||||
]
|
||||
singleArgumentCommands = [
|
||||
'chapter', 'usepackage', 'section', 'label', 'textbf', 'subsection',
|
||||
'chapter', 'section', 'label', 'textbf', 'subsection',
|
||||
'vspace', 'cite', 'textit', 'documentclass', 'includegraphics', 'input',
|
||||
'emph','caption', 'ref', 'title', 'author', 'texttt', 'include',
|
||||
'hspace', 'bibitem', 'url', 'large', 'subsubsection', 'textsc', 'date',
|
||||
|
@ -30,7 +30,7 @@ define [], () ->
|
|||
]
|
||||
special = ['LaTeX', 'TeX']
|
||||
|
||||
rawCommands = [].concat(
|
||||
rawCommands = ['usepackage'].concat(
|
||||
noArgumentCommands,
|
||||
singleArgumentCommands,
|
||||
doubleArgumentCommands,
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
define () ->
|
||||
packages = [
|
||||
'inputenc', 'graphicx', 'amsmath', 'geometry', 'amssymb', 'hyperref',
|
||||
'babel', 'color', 'xcolor', 'url', 'natbib', 'fontenc', 'fancyhdr',
|
||||
'amsfonts', 'booktabs', 'amsthm', 'float', 'tikz', 'caption',
|
||||
'setspace', 'multirow', 'array', 'multicol', 'titlesec', 'enumitem',
|
||||
'ifthen', 'listings', 'blindtext', 'subcaption', 'times', 'bm',
|
||||
'subfigure', 'algorithm', 'fontspec', 'biblatex', 'tabularx',
|
||||
'microtype', 'etoolbox', 'parskip', 'calc', 'verbatim', 'mathtools',
|
||||
'epsfig', 'wrapfig', 'lipsum', 'cite', 'textcomp', 'longtable',
|
||||
'textpos', 'algpseudocode', 'enumerate', 'subfig', 'pdfpages',
|
||||
'epstopdf', 'latexsym', 'lmodern', 'pifont', 'ragged2e', 'rotating',
|
||||
'dcolumn', 'xltxtra', 'marvosym', 'indentfirst', 'xspace', 'csquotes',
|
||||
'xparse', 'changepage', 'soul', 'xunicode', 'comment', 'mathrsfs',
|
||||
'tocbibind', 'lastpage', 'algorithm2e', 'pgfplots', 'lineno',
|
||||
'graphics', 'algorithmic', 'fullpage', 'mathptmx', 'todonotes',
|
||||
'ulem', 'tweaklist', 'moderncvstyleclassic', 'collection',
|
||||
'moderncvcompatibility', 'gensymb', 'helvet', 'siunitx', 'adjustbox',
|
||||
'placeins', 'colortbl', 'appendix', 'makeidx', 'supertabular', 'ifpdf',
|
||||
'framed', 'aliascnt', 'layaureo', 'authblk'
|
||||
]
|
||||
|
||||
packageSnippets = for pkg in packages
|
||||
{
|
||||
caption: "\\usepackage{#{pkg}}"
|
||||
snippet: "\\usepackage{#{pkg}}"
|
||||
meta: "pkg"
|
||||
}
|
||||
|
||||
packageSnippets.push {
|
||||
caption: "\\usepackage{}"
|
||||
snippet: "\\usepackage{}"
|
||||
meta: "pkg"
|
||||
score: 70
|
||||
}
|
||||
|
||||
class PackageManager
|
||||
getCompletions: (editor, session, pos, prefix, callback) ->
|
||||
callback null, packageSnippets
|
||||
|
||||
return PackageManager
|
Loading…
Reference in a new issue