snippetManager should be lowercase
This commit is contained in:
parent
9a59b084cc
commit
28943dcf1d
3 changed files with 22 additions and 19 deletions
|
|
@ -129,9 +129,9 @@ env.editor.commands.addCommands([{
|
|||
editor.cmdLine.focus();
|
||||
return;
|
||||
}
|
||||
var s = SnippetManager.getSnippetByName(needle, editor);
|
||||
var s = snippetManager.getSnippetByName(needle, editor);
|
||||
if (s)
|
||||
SnippetManager.insertSnippet(editor, s.content);
|
||||
snippetManager.insertSnippet(editor, s.content);
|
||||
},
|
||||
readOnly: true
|
||||
}, {
|
||||
|
|
@ -471,15 +471,14 @@ net.loadScript("https://rawgithub.com/nightwing/emmet-core/master/emmet.js", fun
|
|||
|
||||
require("ace/placeholder").PlaceHolder;
|
||||
|
||||
var SnippetManager = require("ace/snippets").SnippetManager
|
||||
var snippetManager = require("ace/snippets").snippetManager
|
||||
var jsSnippets = require("ace/snippets/javascript");
|
||||
window.SnippetManager = SnippetManager
|
||||
window.snippetManager = snippetManager
|
||||
saveSnippets()
|
||||
|
||||
function saveSnippets() {
|
||||
jsSnippets.snippets = SnippetManager.parseSnippetFile(jsSnippets.snippetText);
|
||||
SnippetManager.snipp
|
||||
SnippetManager.register(jsSnippets.snippets, "javascript")
|
||||
jsSnippets.snippets = snippetManager.parseSnippetFile(jsSnippets.snippetText);
|
||||
snippetManager.register(jsSnippets.snippets, "javascript")
|
||||
}
|
||||
|
||||
env.editSnippets = function() {
|
||||
|
|
@ -507,7 +506,7 @@ env.editSnippets = function() {
|
|||
}
|
||||
|
||||
ace.commands.bindKey("Tab", function(editor) {
|
||||
var success = SnippetManager.expandWithTab(editor);
|
||||
var success = snippetManager.expandWithTab(editor);
|
||||
if (!success)
|
||||
editor.execCommand("indent");
|
||||
})
|
||||
|
|
|
|||
|
|
@ -97,8 +97,10 @@ var SnippetManager = function() {
|
|||
}, next: "start"},
|
||||
{regex: "/(" + escape("/") + "+)/(?:(" + escape("/") + "*)/)(\\w*):?",
|
||||
onMatch: function(val, state, stack) {
|
||||
val = this.splitRegex.exec(val);
|
||||
var ts = stack[0];
|
||||
ts.fmtString = val;
|
||||
|
||||
val = this.splitRegex.exec(val);
|
||||
ts.guard = val[1];
|
||||
ts.fmt = val[2];
|
||||
ts.flag = val[3];
|
||||
|
|
@ -230,7 +232,7 @@ var SnippetManager = function() {
|
|||
continue;
|
||||
} else if (ch.text) {
|
||||
var value = this.getVariableValue(editor, ch.text);
|
||||
if (value && ch.fmt)
|
||||
if (value && ch.fmtString)
|
||||
value = this.tmStrFormat(value, ch);
|
||||
ch.processed = i;
|
||||
if (ch.expectIf == null) {
|
||||
|
|
@ -497,7 +499,7 @@ var SnippetManager = function() {
|
|||
snippet = {};
|
||||
} else {
|
||||
var key = m[2], val = m[3];
|
||||
if (key == "regex") {
|
||||
if (key == "regex") {
|
||||
val = val.split(/\/((?:[^\/\\]|\\.)*)\/?/);
|
||||
snippet.guard = val[1];
|
||||
snippet.trigger = val[2];
|
||||
|
|
@ -629,7 +631,7 @@ var TabstopManager = function(editor) {
|
|||
var range = ts[i];
|
||||
if (!range.linked)
|
||||
continue;
|
||||
var fmt = exports.SnippetManager.tmStrFormat(text, range.original)
|
||||
var fmt = exports.snippetManager.tmStrFormat(text, range.original)
|
||||
session.replace(range, fmt);
|
||||
}
|
||||
this.$inChange = false;
|
||||
|
|
@ -708,7 +710,7 @@ var TabstopManager = function(editor) {
|
|||
range.tabstop = ts;
|
||||
ranges.push(range);
|
||||
ts[i] = range;
|
||||
if (p.fmt) {
|
||||
if (p.fmtString) {
|
||||
range.linked = true;
|
||||
ts.hasLinkedRanges = true;
|
||||
} else if (!ts.firstNonLinked)
|
||||
|
|
@ -757,7 +759,8 @@ var TabstopManager = function(editor) {
|
|||
"Esc": function(ed) {
|
||||
ed.tabstopManager.detach();
|
||||
},
|
||||
"Return": function(ed) {
|
||||
// todo multiselectExec doesn't handle command return values
|
||||
"!Return": function(ed) {
|
||||
//ed.tabstopManager.tabNext(1);
|
||||
return false;
|
||||
},
|
||||
|
|
@ -787,7 +790,7 @@ require("./lib/dom").importCssString("\
|
|||
position: absolute;\
|
||||
}");
|
||||
|
||||
exports.SnippetManager = new SnippetManager();
|
||||
exports.snippetManager = new SnippetManager();
|
||||
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -75,8 +75,9 @@ regex /([,{[])|^\s*/:f/
|
|||
${0}
|
||||
}${3:,}
|
||||
# setTimeout function
|
||||
snippet timeout
|
||||
setTimeout(function() {${3}}${2}, ${1:10});
|
||||
snippet setTimeout
|
||||
regex /\b/st|timeout|setTimeo?u?t?/
|
||||
setTimeout(function() {${3:$TM_SELECTED_TEXT}}, ${1:10});
|
||||
# Get Elements
|
||||
snippet gett
|
||||
getElementsBy${1:TagName}('${2}')${3}
|
||||
|
|
@ -166,12 +167,12 @@ snippet for-
|
|||
}
|
||||
# for (...) {...}
|
||||
snippet for
|
||||
for (var ${1:i} = 0; $1 < ${2:Things}.length; $1$++) {
|
||||
for (var ${1:i} = 0; $1 < ${2:Things}.length; $1++) {
|
||||
${3:$2[$1]}$0
|
||||
}
|
||||
# for (...) {...} (Improved Native For-Loop)
|
||||
snippet forr
|
||||
for (var ${1:i} = ${2:Things}.length - 1; $1 >= 0; $1$--) {
|
||||
for (var ${1:i} = ${2:Things}.length - 1; $1 >= 0; $1--) {
|
||||
${3:$2[$1]}$0
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue