Parcourir la source

Merge pull request #63 from sharelatex/revert-39-ns-package-completer

Revert "Complete 'usepackage' with packages"
Henry Oswald il y a 9 ans
Parent
commit
b6c309457c

+ 5 - 8
services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee

@@ -1,11 +1,10 @@
 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, PackageManager, Helpers) ->
+], (CommandManager, EnvironmentManager, Helpers) ->
 	Range = ace.require("ace/range").Range
 	aceSnippetManager = ace.require('ace/snippets').snippetManager
 
@@ -36,7 +35,6 @@ define [
 			})
 
 			SnippetCompleter = new EnvironmentManager()
-			PackageCompleter = new PackageManager()
 
 			Graphics = @graphics
 			Preamble = @preamble
@@ -128,11 +126,10 @@ define [
 								callback null, result
 
 			@editor.completers = [
-				@suggestionManager
-				SnippetCompleter
-				PackageCompleter
-				ReferencesCompleter
-				LabelsCompleter
+				@suggestionManager,
+				SnippetCompleter,
+				ReferencesCompleter,
+				LabelsCompleter,
 				GraphicsCompleter
 			]
 

+ 13 - 13
services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/CommandManager.coffee

@@ -12,7 +12,7 @@ define [], () ->
 		'Lambda', 'Xi', 'Pi', 'Sigma', 'Upsilon', 'Phi', 'Psi', 'Omega'
 	]
 	singleArgumentCommands = [
-		'chapter', 'section', 'label', 'textbf', 'subsection',
+		'chapter', 'usepackage', 'section', 'label', 'textbf', 'subsection',
 		'vspace', 'cite', 'textit', 'documentclass', 'includegraphics', 'input',
 		'emph','caption', 'ref', 'title', 'author', 'texttt', 'include',
 		'hspace', 'bibitem', 'url', 'large', 'subsubsection', 'textsc', 'date',
@@ -63,19 +63,19 @@ define [], () ->
 			meta: "cmd"
 		}
 	special = for cmd in special
-		{
-			caption: "\\#{cmd}{}"
-			snippet: "\\#{cmd}{}"
-			meta: "cmd"
-		}
+			{
+				caption: "\\#{cmd}{}"
+				snippet: "\\#{cmd}{}"
+				meta: "cmd"
+			}
 
 	staticCommands = [].concat(
-		noArgumentCommands,
-		singleArgumentCommands,
-		doubleArgumentCommands,
-		tripleArgumentCommands,
-		special
-	)
+						noArgumentCommands,
+						singleArgumentCommands,
+						doubleArgumentCommands,
+						tripleArgumentCommands,
+						special
+					)
 
 	class Parser
 		constructor: (@doc, @prefix) ->
@@ -172,7 +172,7 @@ define [], () ->
 			commands = parser.parse()
 			completions = []
 			for command in commands
-				if command[0] not in rawCommands and command[0] != "usepackage"
+				if command[0] not in rawCommands
 					caption = "\\#{command[0]}"
 					score = if caption == prefix then 99 else 50
 					snippet = caption

+ 0 - 43
services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/PackageManager.coffee

@@ -1,43 +0,0 @@
-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: 55
-	}
-
-	class PackageManager
-		getCompletions: (editor, session, pos, prefix, callback) ->
-			docText = session.getValue()
-			loaded = parseLoadedPackages docText
-			callback null, packageSnippets
-
-	return PackageManager