mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 21:59:00 +02:00
Move the getCompletions call for Snippets into the Snippets module.
This commit is contained in:
+2
-4
@@ -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 =
|
||||
|
||||
+6
-2
@@ -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
|
||||
|
||||
+1
-2
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user