Move the getCompletions call for Snippets into the Snippets module.

This commit is contained in:
Shane Kilkelly 2016-03-17 10:00:07 +00:00
parent 2985a0b0b2
commit 7cc3f7613e
3 changed files with 9 additions and 8 deletions

View file

@ -3,7 +3,7 @@ define [
"ide/editor/directives/aceEditor/auto-complete/Snippets"
"ace/ace"
"ace/ext-language_tools"
], (SuggestionManager, Snippets) ->
], (SuggestionManager, SnippetManager) ->
Range = ace.require("ace/range").Range
getLastCommandFragment = (lineUpToCursor) ->
@ -38,9 +38,7 @@ define [
enableLiveAutocompletion: false
})
SnippetCompleter =
getCompletions: (editor, session, pos, prefix, callback) ->
callback null, Snippets
SnippetCompleter = new SnippetManager()
references = @$scope.$root._references
ReferencesCompleter =

View file

@ -1,6 +1,6 @@
define () ->
environments = [
"abstract",
"abstract",
"align", "align*",
"equation", "equation*",
"gather", "gather*",
@ -96,5 +96,9 @@ define () ->
"""
meta: "env"
}]
class SnippetManager
getCompletions: (editor, session, pos, prefix, callback) ->
console.log ">> get snippet completions"
callback null, snippets
return snippets
return SnippetManager

View file

@ -28,7 +28,7 @@ define [], () ->
# Ignore single letter commands since auto complete is moot then.
commandRegex: /\\([a-zA-Z][a-zA-Z]+)/
nextCommand: () ->
i = @doc.search(@commandRegex)
if i == -1
@ -123,4 +123,3 @@ define [], () ->
completionBeforeCursor: completionBeforeCursor
completionAfterCursor: completionAfterCursor
}