Merge pull request #1715 from ajaxorg/velocity_snippets
Support loading snippets for mixed modes
This commit is contained in:
commit
eda5eaba39
103 changed files with 190 additions and 39 deletions
|
|
@ -46,10 +46,9 @@ var keyWordCompleter = {
|
|||
|
||||
var snippetCompleter = {
|
||||
getCompletions: function(editor, session, pos, prefix, callback) {
|
||||
var scope = snippetManager.$getScope(editor);
|
||||
var snippetMap = snippetManager.snippetMap;
|
||||
var completions = [];
|
||||
[scope, "_"].forEach(function(scope) {
|
||||
snippetManager.getActiveScopes(editor).forEach(function(scope) {
|
||||
var snippets = snippetMap[scope] || [];
|
||||
for (var i = snippets.length; i--;) {
|
||||
var s = snippets[i];
|
||||
|
|
@ -80,22 +79,39 @@ var expandSnippet = {
|
|||
editor.execCommand("indent");
|
||||
},
|
||||
bindKey: "tab"
|
||||
}
|
||||
};
|
||||
|
||||
var onChangeMode = function(e, editor) {
|
||||
var mode = editor.session.$mode;
|
||||
var id = mode.$id
|
||||
if (!snippetManager.files) snippetManager.files = {};
|
||||
if (id && !snippetManager.files[id]) {
|
||||
var snippetFilePath = id.replace("mode", "snippets");
|
||||
config.loadModule(snippetFilePath, function(m) {
|
||||
if (m) {
|
||||
snippetManager.files[id] = m;
|
||||
m.snippets = snippetManager.parseSnippetFile(m.snippetText);
|
||||
snippetManager.register(m.snippets, m.scope);
|
||||
loadSnippetsForMode(editor.session.$mode);
|
||||
};
|
||||
|
||||
var loadSnippetsForMode = function(mode) {
|
||||
var id = mode.$id;
|
||||
if (!snippetManager.files)
|
||||
snippetManager.files = {};
|
||||
loadSnippetFile(id);
|
||||
if (mode.modes)
|
||||
mode.modes.forEach(loadSnippetsForMode);
|
||||
};
|
||||
|
||||
var loadSnippetFile = function(id) {
|
||||
if (!id || snippetManager.files[id])
|
||||
return;
|
||||
var snippetFilePath = id.replace("mode", "snippets");
|
||||
snippetManager.files[id] = {};
|
||||
config.loadModule(snippetFilePath, function(m) {
|
||||
if (m) {
|
||||
snippetManager.files[id] = m;
|
||||
m.snippets = snippetManager.parseSnippetFile(m.snippetText);
|
||||
snippetManager.register(m.snippets, m.scope);
|
||||
if (m.includeScopes) {
|
||||
snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;
|
||||
m.includeScopes.forEach(function(x) {
|
||||
loadSnippetFile("ace/mode/" + x);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var Editor = require("../editor").Editor;
|
||||
|
|
@ -103,7 +119,7 @@ require("../config").defineOptions(Editor.prototype, "editor", {
|
|||
enableBasicAutocompletion: {
|
||||
set: function(val) {
|
||||
if (val) {
|
||||
this.completers = completers
|
||||
this.completers = completers;
|
||||
this.commands.addCommand(Autocomplete.startCommand);
|
||||
} else {
|
||||
this.commands.removeCommand(Autocomplete.startCommand);
|
||||
|
|
@ -116,7 +132,7 @@ require("../config").defineOptions(Editor.prototype, "editor", {
|
|||
if (val) {
|
||||
this.commands.addCommand(expandSnippet);
|
||||
this.on("changeMode", onChangeMode);
|
||||
onChangeMode(null, this)
|
||||
onChangeMode(null, this);
|
||||
} else {
|
||||
this.commands.removeCommand(expandSnippet);
|
||||
this.off("changeMode", onChangeMode);
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ oop.inherits(Mode, TextMode);
|
|||
}
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/abap";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/actionscript";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
this.lineCommentStart = "--";
|
||||
|
||||
this.$id = "ace/mode/ada";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ oop.inherits(Mode, TextMode);
|
|||
return this.$getIndent(line);
|
||||
}
|
||||
};
|
||||
this.$id = "ace/mode/asciidoc";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
(function() {
|
||||
this.lineCommentStart = ";";
|
||||
this.$id = "ace/mode/assembly_x86";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "/\\*";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/autohotkey";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "::";
|
||||
this.blockComment = "";
|
||||
this.$id = "ace/mode/batchfile";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/c9search";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/c_cpp";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/clojure";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
this.lineCommentStart = "*";
|
||||
|
||||
this.$id = "ace/mode/cobol";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ oop.inherits(Mode, TextMode);
|
|||
return worker;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/coffee";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ oop.inherits(Mode, XmlMode);
|
|||
return this.$getIndent(line);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/coldfusion";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ oop.inherits(Mode, TextMode);
|
|||
return null;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/csharp";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ oop.inherits(Mode, TextMode);
|
|||
return worker;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/css";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ var Mode = function() {
|
|||
oop.inherits(Mode, HtmlMode);
|
||||
|
||||
(function() {
|
||||
this.$id = "ace/mode/curly";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "/\\+";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/d";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ oop.inherits(Mode, CMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/dart";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
(function() {
|
||||
|
||||
this.$id = "ace/mode/diff";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/dot";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ oop.inherits(Mode, HtmlMode);
|
|||
|
||||
(function() {
|
||||
|
||||
this.$id = "ace/mode/ejs";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "%";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/erlang";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "(?<=^|\\s)\\.?\\( [^)]*\\)";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/forth";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
(function() {
|
||||
|
||||
this.$id = "ace/mode/ftl";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/golang";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ oop.inherits(Mode, JavaScriptMode);
|
|||
return null;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/groovy";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = ["//", "#"];
|
||||
|
||||
this.$id = "ace/mode/haml";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ oop.inherits(Mode, HtmlMode);
|
|||
|
||||
(function() {
|
||||
|
||||
this.$id = "ace/mode/handlebars";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "--";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/haskell";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/haxe";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ oop.inherits(Mode, TextMode);
|
|||
return this.$completer.getCompletions(state, session, pos, prefix);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/html";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ oop.inherits(Mode, HtmlMode);
|
|||
|
||||
(function() {
|
||||
|
||||
this.$id = "ace/mode/html_ruby";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = ";";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/ini";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ oop.inherits(Mode, TextMode);
|
|||
};
|
||||
|
||||
|
||||
this.$id = "ace/mode/jack";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
(function() {
|
||||
this.lineCommentStart = "//";
|
||||
this.$id = "ace/mode/jade";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ oop.inherits(Mode, JavaScriptMode);
|
|||
return null;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/java";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ oop.inherits(Mode, TextMode);
|
|||
return worker;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/javascript";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ oop.inherits(Mode, TextMode);
|
|||
};
|
||||
|
||||
|
||||
this.$id = "ace/mode/json";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ oop.inherits(Mode, TextMode);
|
|||
doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
|
||||
}
|
||||
};
|
||||
this.$id = "ace/mode/jsoniq";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
(function() {
|
||||
|
||||
this.$id = "ace/mode/jsp";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/jsx";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "#";
|
||||
this.blockComment = "";
|
||||
this.$id = "ace/mode/julia";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "%";
|
||||
|
||||
this.$id = "ace/mode/latex";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/less";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/liquid";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
this.lineCommentStart = ";";
|
||||
|
||||
this.$id = "ace/mode/lisp";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ oop.inherits(Mode, TextMode);
|
|||
var row = it.getCurrentTokenRow();
|
||||
return new Range(row, col, row, col + tok.value.length);
|
||||
};
|
||||
this.$id = "ace/mode/logiql";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/lsl";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ oop.inherits(Mode, TextMode);
|
|||
return worker;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/lua";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.lineCommentStart = "#";
|
||||
this.$indentWithTabs = true;
|
||||
|
||||
this.$id = "ace/mode/makefile";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ oop.inherits(Mode, TextMode);
|
|||
return this.$getIndent(line);
|
||||
}
|
||||
};
|
||||
this.$id = "ace/mode/markdown";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.lineCommentStart = "%";
|
||||
this.blockComment = {start: "%{", end: "%}"};
|
||||
|
||||
this.$id = "ace/mode/matlab";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ oop.inherits(Mode, TextMode);
|
|||
doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/mushcode";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.lineCommentStart = ["--", "#"]; // todo space
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
|
||||
this.$id = "ace/mode/mysql";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ oop.inherits(Mode, CMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "#";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/nix";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/objectivec";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|with))\s*$/;
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/ocaml";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ oop.inherits(Mode, TextMode);
|
|||
{start: "{", end: "}"}
|
||||
];
|
||||
|
||||
this.$id = "ace/mode/pascal";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/perl";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ oop.inherits(Mode, TextMode);
|
|||
}
|
||||
}
|
||||
|
||||
this.$id = "ace/mode/pgsql";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ oop.inherits(Mode, TextMode);
|
|||
return worker;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/php";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.getNextLineIndent = function(state, line, tab) {
|
||||
return '';
|
||||
};
|
||||
this.$id = "ace/mode/plain_text";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ oop.inherits(Mode, TextMode);
|
|||
return null;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/powershell";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "%";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/prolog";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ oop.inherits(Mode, CMode);
|
|||
// Extra logic goes here.
|
||||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/protobuf";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ oop.inherits(Mode, TextMode);
|
|||
doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/python";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ define(function(require, exports, module) {
|
|||
}
|
||||
return false;
|
||||
};*/
|
||||
this.$id = "ace/mode/r";
|
||||
}).call(Mode.prototype);
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.getNextLineIndent = function(state, line, tab) {
|
||||
return this.$getIndent(line);
|
||||
};
|
||||
this.$id = "ace/mode/rdoc";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ oop.inherits(Mode, HtmlMode);
|
|||
return this.codeModel.getNextLineIndent(row, line, state, tab, tabSize);
|
||||
}; */
|
||||
|
||||
this.$id = "ace/mode/rhtml";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ oop.inherits(Mode, TextMode);
|
|||
doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/ruby";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "/\\*";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/rust";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
(function() {
|
||||
this.lineCommentStart = "//";
|
||||
this.$id = "ace/mode/sass";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/scad";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ oop.inherits(Mode, JavaScriptMode);
|
|||
return null;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/scala";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
this.lineCommentStart = ";";
|
||||
|
||||
this.$id = "ace/mode/scheme";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/scss";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ oop.inherits(Mode, TextMode);
|
|||
doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/sh";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ oop.inherits(Mode, JSMode);
|
|||
this.createWorker = function(session) {
|
||||
return null;
|
||||
}
|
||||
this.$id = "ace/mode/sjs";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
(function() {
|
||||
this.$indentWithTabs = true;
|
||||
this.$id = "ace/mode/snippets";
|
||||
}).call(Mode.prototype);
|
||||
exports.Mode = Mode;
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ oop.inherits(Mode, HtmlMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/soy_template";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ var Mode = function() {
|
|||
oop.inherits(Mode, TextMode);
|
||||
(function() {
|
||||
|
||||
this.$id = "ace/mode/space";
|
||||
}).call(Mode.prototype);
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
this.lineCommentStart = "--";
|
||||
|
||||
this.$id = "ace/mode/sql";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ var Mode = function() {
|
|||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.$id = "ace/mode/stylus";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ oop.inherits(Mode, XmlMode);
|
|||
};
|
||||
|
||||
|
||||
this.$id = "ace/mode/svg";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/tcl";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.allowAutoInsert = function() {
|
||||
return false;
|
||||
};
|
||||
this.$id = "ace/mode/tex";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -378,6 +378,7 @@ var Mode = function() {
|
|||
});
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/text";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/textile";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
(function() {
|
||||
this.lineCommentStart = "#";
|
||||
this.$id = "ace/mode/toml";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
this.$id = "ace/mode/twig";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ oop.inherits(Mode, jsMode);
|
|||
this.createWorker = function(session) {
|
||||
return null;
|
||||
};
|
||||
this.$id = "ace/mode/typescript";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
this.lineCommentStart = ["'", "REM"];
|
||||
|
||||
this.$id = "ace/mode/vbscript";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
this.lineCommentStart = "##";
|
||||
this.blockComment = {start: "#*", end: "*#"};
|
||||
this.$id = "ace/mode/velocity";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
|
||||
this.$id = "ace/mode/verilog";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
this.lineCommentStart = "--";
|
||||
|
||||
this.$id = "ace/mode/vhdl";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
this.blockComment = {start: "<!--", end: "-->"};
|
||||
|
||||
this.$id = "ace/mode/xml";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ oop.inherits(Mode, TextMode);
|
|||
return worker;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/xquery";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ oop.inherits(Mode, TextMode);
|
|||
};
|
||||
|
||||
|
||||
this.$id = "ace/mode/yaml";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -396,16 +396,26 @@ var SnippetManager = function() {
|
|||
return scope;
|
||||
};
|
||||
|
||||
this.getActiveScopes = function(editor) {
|
||||
var scope = this.$getScope(editor);
|
||||
var scopes = [scope];
|
||||
var snippetMap = this.snippetMap;
|
||||
if (snippetMap[scope] && snippetMap[scope].includeScopes) {
|
||||
scopes.push.apply(scopes, snippetMap[scope].includeScopes);
|
||||
}
|
||||
scopes.push("_");
|
||||
return scopes;
|
||||
};
|
||||
|
||||
this.expandWithTab = function(editor) {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = editor.session.getLine(cursor.row);
|
||||
var before = line.substring(0, cursor.column);
|
||||
var after = line.substr(cursor.column);
|
||||
|
||||
var scope = this.$getScope(editor);
|
||||
var snippetMap = this.snippetMap;
|
||||
var snippet;
|
||||
[scope, "_"].some(function(scope) {
|
||||
this.getActiveScopes(editor).some(function(scope) {
|
||||
var snippets = snippetMap[scope];
|
||||
if (snippets)
|
||||
snippet = this.findMatchingSnippet(snippets, before, after);
|
||||
|
|
@ -562,10 +572,9 @@ var SnippetManager = function() {
|
|||
return list;
|
||||
};
|
||||
this.getSnippetByName = function(name, editor) {
|
||||
var scope = editor && this.$getScope(editor);
|
||||
var snippetMap = this.snippetNameMap;
|
||||
var snippet;
|
||||
[scope, "_"].some(function(scope) {
|
||||
this.getActiveScopes(editor).some(function(scope) {
|
||||
var snippets = snippetMap[scope];
|
||||
if (snippets)
|
||||
snippet = snippets[name];
|
||||
|
|
@ -800,6 +809,10 @@ var TabstopManager = function(editor) {
|
|||
this.keyboardHandler = new HashHandler();
|
||||
this.keyboardHandler.bindKeys({
|
||||
"Tab": function(ed) {
|
||||
if (exports.snippetManager && exports.snippetManager.expandWithTab(ed)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ed.tabstopManager.tabNext(1);
|
||||
},
|
||||
"Shift-Tab": function(ed) {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue