mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Move the getCompletions
call for Snippets into the Snippets module.
This commit is contained in:
parent
2985a0b0b2
commit
7cc3f7613e
3 changed files with 9 additions and 8 deletions
|
@ -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 =
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue