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