diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js index 55dad178..49537452 100644 --- a/demo/kitchen-sink/demo.js +++ b/demo/kitchen-sink/demo.js @@ -120,20 +120,21 @@ env.editor.commands.addCommands([{ editor.gotoLine(line); }, readOnly: true -}/*, { - name: "find", - bindKey: {win: "Ctrl-F", mac: "Command-F"}, +}, { + name: "snippet", + bindKey: {win: "Alt-C", mac: "Command-Alt-C"}, exec: function(editor, needle) { if (typeof needle == "object") { - var arg = this.name + " " + editor.getCopyText(); - editor.cmdLine.setValue(arg, 1); + editor.cmdLine.setValue("snippet ", 1); editor.cmdLine.focus(); return; } - editor.find(needle); + var s = SnippetManager.getSnippetByName(needle, editor); + if (s) + SnippetManager.insertSnippet(editor, s.content); }, readOnly: true -}*/, { +}, { name: "focusCommandLine", bindKey: "shift-esc", exec: function(editor, needle) { editor.cmdLine.focus(); }, @@ -460,4 +461,47 @@ event.addListener(container, "drop", function(e) { var StatusBar = require("./statusbar").StatusBar; new StatusBar(env.editor, cmdLine.container); +require("ace/placeholder").PlaceHolder; + +var SnippetManager = require("ace/snippets").SnippetManager +var jsSnippets = require("ace/snippets/javascript"); +window.SnippetManager = SnippetManager +saveSnippets() + +function saveSnippets() { + jsSnippets.snippets = SnippetManager.parseSnippetFile(jsSnippets.snippetText); + SnippetManager.snipp + SnippetManager.register(jsSnippets.snippets, "javascript") +} + +env.editSnippets = function() { + var sp = env.split; + if (sp.getSplits() == 2) { + sp.setSplits(1); + return; + } + sp.setSplits(1); + sp.setSplits(2); + sp.setOrientation(sp.BESIDE); + var editor = sp.$editors[1] + if (!env.snippetSession) { + var file = jsSnippets.snippetText; + env.snippetSession = doclist.initDoc(file, "", {}); + env.snippetSession.setMode("ace/mode/tmsnippet"); + env.snippetSession.setUseSoftTabs(false); + } + editor.on("blur", function() { + jsSnippets.snippetText = editor.getValue(); + saveSnippets(); + }) + editor.setSession(env.snippetSession, 1); + editor.focus(); +} + +ace.commands.bindKey("Tab", function(editor) { + var success = SnippetManager.expandWithTab(editor); + if (!success) + editor.execCommand("indent"); +}) + }); diff --git a/demo/kitchen-sink/doclist.js b/demo/kitchen-sink/doclist.js index 6fe81002..e4f4833b 100644 --- a/demo/kitchen-sink/doclist.js +++ b/demo/kitchen-sink/doclist.js @@ -54,6 +54,7 @@ function initDoc(file, path, doc) { var mode = modelist.getModeFromPath(path); session.modeName = mode.name; session.setMode(mode.mode); + return session; } diff --git a/demo/kitchen-sink/docs/tmSnippet.tmSnippet b/demo/kitchen-sink/docs/tmSnippet.tmSnippet index 6ea4117f..78282d18 100644 --- a/demo/kitchen-sink/docs/tmSnippet.tmSnippet +++ b/demo/kitchen-sink/docs/tmSnippet.tmSnippet @@ -1,19 +1,26 @@ -$$------------------------------------ -tabTrigger: t -name: Heading 3 -scope: language -content: ----------------------------- -\begin{${1:documnet}} - ${2:$TM_SELECTED_TEXT:some latex} - ${3:$TM_SELECTED_TEXT/a/b/c} - ${4:${TM_SELECTED_TEXT/(.)/\\u$1/g:7}} -\end{$1} -$0\\$$ -$$------------------------------------ -tabTrigger: ^3 -name: Heading 3 -scope: language -content: ----------------------------- - -${TM_CURRENT_LINE/./^/g} -$$------------------------------------ \ No newline at end of file +# Function +snippet fun + function ${1?:function_name}(${2:argument}) { + ${3:// body...} + } +# Anonymous Function +regex /((=)\s*|(:)\s*|(\()|\b)/f/(\))?/ +name f + function${M1?: ${1:functionName}}($2) { + ${0:$TM_SELECTED_TEXT} + }${M2?;}${M3?,}${M4?)} +# Immediate function +trigger \(?f\( +endTrigger \)? +snippet f( + (function(${1}) { + ${0:${TM_SELECTED_TEXT:/* code */}} + }(${1})); +# if +snippet if + if (${1:true}) { + ${0} + } + + + \ No newline at end of file diff --git a/demo/kitchen-sink/modelist.js b/demo/kitchen-sink/modelist.js index 24dfe170..9c693f99 100644 --- a/demo/kitchen-sink/modelist.js +++ b/demo/kitchen-sink/modelist.js @@ -99,7 +99,7 @@ var modesByName = { tex: ["Tex" , "tex"], text: ["Text" , "txt"], textile: ["Textile" , "textile"], - tm_snippet: ["tmSnippet" , "tmSnippet"], + tmsnippet: ["tmSnippet" , "tmSnippet"], toml: ["toml" , "toml"], typescript: ["Typescript" , "typescript|ts|str"], vbscript: ["VBScript" , "vbs"], diff --git a/demo/kitchen-sink/package.json b/demo/kitchen-sink/package.json deleted file mode 100644 index 2345fccd..00000000 --- a/demo/kitchen-sink/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "main": "./demo.js", - "mappings": { - "ace": "../.." - }, - "config": { - "github.com/sourcemint/bundler-js/0/-meta/config/0": { - "adapter": "github.com/sourcemint/sdk-requirejs/0", - "resources": [ - "./icons/*", - "./logo.png", - "./styles.css" - ] - } - } -} \ No newline at end of file diff --git a/kitchen-sink.html b/kitchen-sink.html index 86fd256c..0e91e619 100644 --- a/kitchen-sink.html +++ b/kitchen-sink.html @@ -13,20 +13,20 @@ - +
- +
@@ -152,7 +152,7 @@ - + @@ -274,10 +274,15 @@ + + +
+ +
- +
diff --git a/lib/ace/anchor.js b/lib/ace/anchor.js index e87f4900..d2ffd090 100644 --- a/lib/ace/anchor.js +++ b/lib/ace/anchor.js @@ -3,7 +3,7 @@ * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -14,7 +14,7 @@ * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -35,7 +35,7 @@ var oop = require("./lib/oop"); var EventEmitter = require("./lib/event_emitter").EventEmitter; /** - * + * * Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated. * * @class Anchor @@ -53,7 +53,7 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter; var Anchor = exports.Anchor = function(doc, row, column) { this.document = doc; - + if (typeof column == "undefined") this.setPosition(row.row, row.column); else @@ -66,7 +66,7 @@ var Anchor = exports.Anchor = function(doc, row, column) { (function() { oop.implement(this, EventEmitter); - + /** * Returns an object identifying the `row` and `column` position of the current anchor. * @returns {Object} @@ -75,28 +75,28 @@ var Anchor = exports.Anchor = function(doc, row, column) { this.getPosition = function() { return this.$clipPositionToDocument(this.row, this.column); }; - - /** - * + + /** + * * Returns the current document. * @returns {Document} **/ - + this.getDocument = function() { return this.document; }; - - /** + + /** * Fires whenever the anchor position changes. * * Both of these objects have a `row` and `column` property corresponding to the position. * * Events that can trigger this function include [[Anchor.setPosition `setPosition()`]]. - * - * @event change - * @param {Object} e An object containing information about the anchor position. It has two properties: + * + * @event change + * @param {Object} e An object containing information about the anchor position. It has two properties: * - `old`: An object describing the old Anchor position - * - `value`: An object describing the new Anchor position + * - `value`: An object describing the new Anchor position * * **/ @@ -104,60 +104,57 @@ var Anchor = exports.Anchor = function(doc, row, column) { this.onChange = function(e) { var delta = e.data; var range = delta.range; - + if (range.start.row == range.end.row && range.start.row != this.row) return; - + if (range.start.row > this.row) return; - + if (range.start.row == this.row && range.start.column > this.column) return; - + var row = this.row; var column = this.column; - + var start = range.start; + var end = range.end; + if (delta.action === "insertText") { - if (range.start.row === row && range.start.column <= column) { - if (range.start.row === range.end.row) { - column += range.end.column - range.start.column; + if (start.row === row && start.column <= column) { + if (start.row === end.row) { + column += end.column - start.column; + } else { + column -= start.column; + row += end.row - start.row; } - else { - column -= range.start.column; - row += range.end.row - range.start.row; - } - } - else if (range.start.row !== range.end.row && range.start.row < row) { - row += range.end.row - range.start.row; + } else if (start.row !== end.row && start.row < row) { + row += end.row - start.row; } } else if (delta.action === "insertLines") { - if (range.start.row <= row) { - row += range.end.row - range.start.row; + if (start.row <= row) { + row += end.row - start.row; } - } - else if (delta.action == "removeText") { - if (range.start.row == row && range.start.column < column) { - if (range.end.column >= column) - column = range.start.column; + } else if (delta.action === "removeText") { + if (start.row === row && start.column < column) { + if (end.column >= column) + column = start.column; else - column = Math.max(0, column - (range.end.column - range.start.column)); - - } else if (range.start.row !== range.end.row && range.start.row < row) { - if (range.end.row == row) { - column = Math.max(0, column - range.end.column) + range.start.column; - } - row -= (range.end.row - range.start.row); - } - else if (range.end.row == row) { - row -= range.end.row - range.start.row; - column = Math.max(0, column - range.end.column) + range.start.column; + column = Math.max(0, column - (end.column - start.column)); + + } else if (start.row !== end.row && start.row < row) { + if (end.row === row) + column = Math.max(0, column - end.column) + start.column; + row -= (end.row - start.row); + } else if (end.row === row) { + row -= end.row - start.row; + column = Math.max(0, column - end.column) + start.column; } } else if (delta.action == "removeLines") { - if (range.start.row <= row) { - if (range.end.row <= row) - row -= range.end.row - range.start.row; + if (start.row <= row) { + if (end.row <= row) + row -= end.row - start.row; else { - row = range.start.row; + row = start.row; column = 0; } } @@ -166,13 +163,13 @@ var Anchor = exports.Anchor = function(doc, row, column) { this.setPosition(row, column, true); }; - /** + /** * Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped. * @param {Number} row The row index to move the anchor to * @param {Number} column The column index to move the anchor to * @param {Boolean} noClip Identifies if you want the position to be clipped * - * + * * **/ @@ -183,19 +180,18 @@ var Anchor = exports.Anchor = function(doc, row, column) { row: row, column: column }; - } - else { + } else { pos = this.$clipPositionToDocument(row, column); } - + if (this.row == pos.row && this.column == pos.column) return; - + var old = { row: this.row, column: this.column }; - + this.row = pos.row; this.column = pos.column; this._emit("change", { @@ -203,7 +199,7 @@ var Anchor = exports.Anchor = function(doc, row, column) { value: pos }); }; - + /** * When called, the `'change'` event listener is removed. * @@ -212,18 +208,16 @@ var Anchor = exports.Anchor = function(doc, row, column) { this.detach = function() { this.document.removeEventListener("change", this.$onChange); }; - - /** + + /** * Clips the anchor position to the specified row and column. * @param {Number} row The row index to clip the anchor to * @param {Number} column The column index to clip the anchor to * - * - * **/ this.$clipPositionToDocument = function(row, column) { var pos = {}; - + if (row >= this.document.getLength()) { pos.row = Math.max(0, this.document.getLength() - 1); pos.column = this.document.getLine(pos.row).length; @@ -236,13 +230,13 @@ var Anchor = exports.Anchor = function(doc, row, column) { pos.row = row; pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column)); } - + if (column < 0) pos.column = 0; - + return pos; }; - + }).call(Anchor.prototype); }); diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 6a4545b3..4bab091d 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -161,7 +161,7 @@ var Editor = function(renderer, session) { this.session.removeEventListener("changeAnnotation", this.$onChangeAnnotation); this.session.removeEventListener("changeOverwrite", this.$onCursorChange); this.session.removeEventListener("changeScrollTop", this.$onScrollTopChange); - this.session.removeEventListener("changeLeftTop", this.$onScrollLeftChange); + this.session.removeEventListener("changeScrollLeft", this.$onScrollLeftChange); var selection = this.session.getSelection(); selection.removeEventListener("changeCursor", this.$onCursorChange); @@ -2242,7 +2242,8 @@ config.defineOptions(Editor.prototype, "editor", { useWorker: "session", useSoftTabs: "session", tabSize: "session", - wrap: "session" + wrap: "session", + foldStyle: "session" }); exports.Editor = Editor; diff --git a/lib/ace/mode/_test/tokens_tmsnippet.json b/lib/ace/mode/_test/tokens_tmsnippet.json index 17eaeb47..f695403d 100644 --- a/lib/ace/mode/_test/tokens_tmsnippet.json +++ b/lib/ace/mode/_test/tokens_tmsnippet.json @@ -1,132 +1,209 @@ [[ "start", - ["doc,comment","$$------------------------------------"] + ["comment","# Function"] ],[ "start" ],[ "start", - ["text","tabTrigger: t"] + ["constant.language.escape","snippet"], + ["text"," fun"] ],[ "start" ],[ - "start", - ["text","name: Heading 3"] -],[ - "start" -],[ - "start", - ["text","scope: language"] -],[ - "start" -],[ - "start", - ["text","content: -----------------------------"] -],[ - "start" -],[ - "start", - ["text","\\begin{"], + "sn-start", + ["text","\tfunction "], ["markup.list","${"], ["constant.numeric","1"], - ["punctuation.operator",":"], - ["text","documnet"], + ["text","?:function_name"], ["markup.list","}"], - ["text","}"] -],[ - "start" -],[ - "start", - ["text"," "], + ["text","("], ["markup.list","${"], ["constant.numeric","2"], ["punctuation.operator",":"], - ["keyword","$TM_SELECTED_TEXT"], - ["text",":some latex"], - ["markup.list","}"] + ["text","argument"], + ["markup.list","}"], + ["text",") {"] ],[ "start" ],[ - "start", - ["text"," "], + "sn-start", + ["text","\t\t"], ["markup.list","${"], ["constant.numeric","3"], ["punctuation.operator",":"], + ["text","// body..."], + ["markup.list","}"] +],[ + "start" +],[ + "sn-start", + ["text","\t}"] +],[ + "start" +],[ + "start", + ["comment","# Anonymous Function"] +],[ + "start" +],[ + "start", + ["constant.language.escape","regex "], + ["keyword","/"], + ["text","((=)\\s*|(:)\\s*|(\\()|\\b)"], + ["keyword","/"], + ["text","f"], + ["keyword","/"], + ["text","(\\))?"], + ["keyword","/"] +],[ + "start" +],[ + "start", + ["constant.language.escape","name"], + ["text"," f"] +],[ + "start" +],[ + "sn-start", + ["text","\tfunction"], + ["markup.list","${"], + ["variable","M1"], + ["text","?: "], + ["markup.list","${"], + ["constant.numeric","1"], + ["punctuation.operator",":"], + ["text","functionName"], + ["markup.list","}}"], + ["text","("], + ["variable","$2"], + ["text",") {"] +],[ + "start" +],[ + "sn-start", + ["text","\t\t"], + ["markup.list","${"], + ["constant.numeric","0"], + ["punctuation.operator",":"], ["keyword","$TM_SELECTED_TEXT"], - ["text","/a/b/c"], + ["markup.list","}"] +],[ + "start" +],[ + "sn-start", + ["text","\t}"], + ["markup.list","${"], + ["variable","M2"], + ["text","?;"], + ["markup.list","}${"], + ["variable","M3"], + ["text","?,"], + ["markup.list","}${"], + ["variable","M4"], + ["text","?)"], ["markup.list","}"] ],[ "start" ],[ "start", - ["text"," "], + ["comment","# Immediate function"] +],[ + "start" +],[ + "start", + ["constant.language.escape","trigger"], + ["text"," \\(?f\\("] +],[ + "start" +],[ + "start", + ["constant.language.escape","endTrigger"], + ["text"," \\)?"] +],[ + "start" +],[ + "start", + ["constant.language.escape","snippet"], + ["text"," f("] +],[ + "start" +],[ + "sn-start", + ["text","\t(function("], ["markup.list","${"], - ["constant.numeric","4"], + ["constant.numeric","1"], + ["markup.list","}"], + ["text",") {"] +],[ + "start" +],[ + "sn-start", + ["text","\t\t"], + ["markup.list","${"], + ["constant.numeric","0"], ["punctuation.operator",":"], ["markup.list","${"], ["keyword","TM_SELECTED_TEXT"], - ["string.regex","/(.)/"], - ["string","\\"], - ["keyword","\\u"], - ["variable","$1"], - ["string.regex","/g:"], - ["text","7"], + ["punctuation.operator",":"], + ["text","/* code */"], ["markup.list","}}"] ],[ "start" ],[ - "start", - ["text","\\end{"], - ["variable","$1"], - ["text","}"] -],[ - "start" -],[ - "start", - ["variable","$0"], - ["constant.language.escape","\\\\"], - ["text","$$"] -],[ - "start" -],[ - "start", - ["doc,comment","$$------------------------------------"] -],[ - "start" -],[ - "start", - ["text","tabTrigger: ^3"] -],[ - "start" -],[ - "start", - ["text","name: Heading 3"] -],[ - "start" -],[ - "start", - ["text","scope: language"] -],[ - "start" -],[ - "start", - ["text","content: -----------------------------"] -],[ - "start" -],[ - "start" -],[ - "start" -],[ - "start", + "sn-start", + ["text","\t}("], ["markup.list","${"], - ["keyword","TM_CURRENT_LINE"], - ["string.regex","/./"], - ["string","^"], - ["string.regex","/g"], + ["constant.numeric","1"], + ["markup.list","}"], + ["text","));"] +],[ + "start" +],[ + "start", + ["comment","# if"] +],[ + "start" +],[ + "start", + ["constant.language.escape","snippet"], + ["text"," if"] +],[ + "start" +],[ + "sn-start", + ["text","\tif ("], + ["markup.list","${"], + ["constant.numeric","1"], + ["punctuation.operator",":"], + ["text","true"], + ["markup.list","}"], + ["text",") {"] +],[ + "start" +],[ + "sn-start", + ["text","\t\t"], + ["markup.list","${"], + ["constant.numeric","0"], ["markup.list","}"] ],[ "start" ],[ - "start", - ["doc,comment","$$------------------------------------"] + "sn-start", + ["text","\t}"] +],[ + "start" +],[ + "sn-start", + ["text","\t"] +],[ + "start" +],[ + "sn-start", + ["text","\t"] +],[ + "start" +],[ + "sn-start", + ["text","\t"] ]] \ No newline at end of file diff --git a/lib/ace/mode/tmsnippet.js b/lib/ace/mode/tmsnippet.js index 8f777719..d3e51863 100644 --- a/lib/ace/mode/tmsnippet.js +++ b/lib/ace/mode/tmsnippet.js @@ -20,7 +20,7 @@ var SnippetHighlightRules = function() { if (stack[1]) stack[1]++; else - stack.unshift("start", 1); + stack.unshift(state, 1); return this.tokenName; }, tokenName: "markup.list", regex: "\\${", next: "varDecl"}, {onMatch: function(value, state, stack) { @@ -31,7 +31,7 @@ var SnippetHighlightRules = function() { stack.splice(0,2); return this.tokenName; }, tokenName: "markup.list", regex: "}"}, - {token: "doc,comment", regex:/^\${2}-{5,}$/} + {token: "doc.comment", regex:/^\${2}-{5,}$/} ], "varDecl" : [ {regex: /\d+\b/, token: "constant.numeric"}, @@ -62,15 +62,44 @@ var SnippetHighlightRules = function() { ] }; }; - oop.inherits(SnippetHighlightRules, TextHighlightRules); exports.SnippetHighlightRules = SnippetHighlightRules; +var SnippetGroupHighlightRules = function() { + this.$rules = { + "start" : [ + {token: "text", regex: "^\\t", next: "sn-start"}, + {token:"invalid", regex: /^ \s*/}, + {token:"comment", regex: /^#.*/}, + {token:"constant.language.escape", regex: "^regex ", next: "regex"}, + {token:"constant.language.escape", regex: "^(trigger|endTrigger|name|snippet|guard|endGuard|tabTrigger|key)\\b"} + ], + "regex" : [ + {token:"text", regex: "\\."}, + {token:"keyword", regex: "/"}, + {token:"empty", regex: "$", next: "start"} + ] + }; + this.embedRules(SnippetHighlightRules, "sn-", [ + {token: "text", regex: "^\\t", next: "sn-start"}, + {onMatch: function(value, state, stack) { + stack.splice(stack.length); + return this.tokenName; + }, tokenName: "text", regex: "^(?!\t)", next: "start"}, + ]) + +}; + +oop.inherits(SnippetGroupHighlightRules, TextHighlightRules); + +exports.SnippetGroupHighlightRules = SnippetGroupHighlightRules; + +var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { - var highlighter = new SnippetHighlightRules(); - + var highlighter = new SnippetGroupHighlightRules(); + this.foldingRules = new FoldMode(); this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/range.js b/lib/ace/range.js index 9538531a..26492865 100644 --- a/lib/ace/range.js +++ b/lib/ace/range.js @@ -540,5 +540,10 @@ Range.fromPoints = function(start, end) { }; Range.comparePoints = comparePoints; +Range.comparePoints = function(p1, p2) { + return p1.row - p2.row || p1.column - p2.column; +}; + + exports.Range = Range; }); diff --git a/lib/ace/snippets.js b/lib/ace/snippets.js new file mode 100644 index 00000000..6a78280d --- /dev/null +++ b/lib/ace/snippets.js @@ -0,0 +1,793 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; +var lang = require("./lib/lang") +var Range = require("./range").Range +var HashHandler = require("./keyboard/hash_handler").HashHandler; +var Tokenizer = require("./tokenizer").Tokenizer; +var comparePoints = Range.comparePoints; + +var SnippetManager = function() { + this.snippetMap = {}; + this.snippetNameMap = {}; +}; + +(function() { + this.getTokenizer = function() { + function TabstopToken(str, _, stack) { + str = str.substr(1); + if (/^\d+$/.test(str) && !stack.inFormatString) + return [{tabstopId: parseInt(str, 10)}]; + return [{text: str}] + } + function escape(ch) { + return "(?:[^\\\\" + ch + "]|\\\\.)"; + } + SnippetManager.$tokenizer = new Tokenizer({ + start: [ + {regex: /:/, onMatch: function(val, state, stack) { + if (stack.length && stack[0].expectIf) { + stack[0].expectIf = false; + stack[0].elseBranch = stack[0]; + return [stack[0]]; + } + return ":"; + }}, + {regex: /\\./, onMatch: function(val, state, stack) { + var ch = val[1]; + if (ch == "}" && stack.length) { + val = ch; + }else if ("`$\\".indexOf(ch) != -1) { + val = ch; + } else if (stack.inFormatString) { + if (ch == "n") + val = "\n"; + else if (ch == "t") + val = "\n"; + else if ("ulULE".indexOf(ch) != -1) { + val = {changeCase: ch, local: ch > "a"}; + } + } + + return [val]; + }}, + {regex: /}/, onMatch: function(val, state, stack) { + return [stack.length ? stack.shift() : val]; + }}, + {regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken}, + {regex: /\$\{[\dA-Z_a-z]+/, onMatch: function(str, state, stack) { + var t = TabstopToken(str.substr(1), state, stack); + stack.unshift(t[0]); + return t; + }, next: "snippetVar"}, + {regex: /\n/, token: "newline", merge: false} + ], + snippetVar: [ + {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) { + stack[0].choices = val.slice(1, -1).split(","); + }, next: "start"}, + {regex: "/(" + escape("/") + "+)/(?:(" + escape("/") + "*)/)(\\w*):?", + onMatch: function(val, state, stack) { + val = this.splitRegex.exec(val); + var ts = stack[0]; + ts.guard = val[1]; + ts.fmt = val[2]; + ts.flag = val[3]; + return ""; + }, next: "start"}, + {regex: "`" + escape("`") + "*`", onMatch: function(val, state, stack) { + stack[0].code = val.splice(1, -1); + return ""; + }, next: "start"}, + {regex: "\\?", onMatch: function(val, state, stack) { + if (stack[0]) + stack[0].expectIf = true; + }, next: "start"}, + {regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start"} + ], + formatString: [ + {regex: "/(" + escape("/") + "+)/", token: "regex"}, + {regex: "", onMatch: function(val, state, stack) { + stack.inFormatString = true; + }, next: "start"} + ] + }); + SnippetManager.prototype.getTokenizer = function() { + return SnippetManager.$tokenizer; + } + return SnippetManager.$tokenizer; + }; + + this.tokenizeTmSnippet = function(str, startState) { + return this.getTokenizer().getLineTokens(str, startState).tokens.map(function(x) { + return x.value || x; + }); + }; + + this.$getDefaultValue = function(editor, name) { + if (/^[A-Z]\d+$/.test(name)) { + var i = name.substr(1); + return (this.variables[name[0] + "__"] || {})[i]; + } + if (/^\d+$/.test(name)) { + return (this.variables.__ || {})[name]; + } + name = name.replace(/^TM_/, ""); + + if (!editor) + return; + var s = editor.session; + switch(name) { + case "CURRENT_WORD": + var r = s.getWordRange(); + case "SELECTION": + case "SELECTED_TEXT": + return s.getTextRange(r); + case "CURRENT_LINE": + return s.getLine(e.getCursorPosition().row); + case "LINE_INDEX": + return e.getCursorPosition().column; + case "LINE_NUMBER": + return e.getCursorPosition().row + 1; + case "SOFT_TABS": + return s.getUseSoftTabs() ? "YES" : "NO"; + case "TAB_SIZE": + return s.getTabSize(); + // defult but can't fill :( + case "FILENAME": + case "FILEPATH": + return "ace.ajax.org"; + case "FULLNAME": + return "Ace"; + } + }; + this.variables = {}; + this.getVariableValue = function(editor, varName) { + if (this.variables.hasOwnProperty(varName)) + return this.variables[varName](editor, varName) || ""; + return this.$getDefaultValue(editor, varName) || ""; + }; + + // returns string formatted according to http://manual.macromates.com/en/regular_expressions#replacement_string_syntax_format_strings + this.tmStrFormat = function(str, ch, editor) { + var flag = ch.flag || ""; + var re = ch.guard; + re = new RegExp(re, flag.replace(/[^gi]/, "")); + var fmtTokens = this.tokenizeTmSnippet(ch.fmt, "formatString"); + var _self = this; + var formatted = str.replace(re, function() { + _self.variables.__ = arguments; + var fmtParts = _self.resolveVariables(fmtTokens, editor); + var gChangeCase = "E"; + for (var i = 0; i < fmtParts.length; i++) { + var ch = fmtParts[i]; + if (typeof ch == "object") { + fmtParts[i] = ""; + if (ch.changeCase && ch.local) { + var next = fmtParts[i + 1]; + if (next && typeof next == "string") { + if (ch.changeCase == "u") + fmtParts[i] = next[0].toUpperCase(); + else + fmtParts[i] = next[0].toLowerCase(); + fmtParts[i + 1] = next.substr(1); + } + } else if (ch.changeCase) { + gChangeCase = ch.changeCase; + } + } else if (gChangeCase == "U") { + fmtParts[i] = ch.toUpperCase(); + } else if (gChangeCase == "L") { + fmtParts[i] = ch.toLowerCase(); + } + } + return fmtParts.join(""); + }); + this.variables.__ = null; + return formatted; + }; + + this.resolveVariables = function(snippet, editor) { + var result = []; + for (var i = 0; i < snippet.length; i++) { + var ch = snippet[i]; + if (typeof ch == "string") { + result.push(ch); + } else if (typeof ch != "object") { + continue; + } else if (ch.skip) { + gotoNext(ch); + } else if (ch.processed < i) { + continue; + } else if (ch.text) { + var value = this.getVariableValue(editor, ch.text); + if (value && ch.fmt) + value = this.tmStrFormat(value, ch); + ch.processed = i; + if (ch.expectIf == null) { + if (value) { + result.push(value); + gotoNext(ch); + } + } else { + if (value) { + ch.skip = ch.elseBranch; + } else + gotoNext(ch); + } + } else if (ch.tabstopId != null) { + result.push(ch); + } else if (ch.changeCase != null) { + result.push(ch); + } + } + function gotoNext(ch) { + var i1 = snippet.indexOf(ch, i + 1); + if (i1 != -1) + i = i1; + } + return result; + }; + + this.insertSnippet = function(editor, snippetText) { + var cursor = editor.getCursorPosition(); + var line = editor.session.getLine(cursor.row); + var indentString = line.match(/^\s*/)[0]; + var tabString = editor.session.getTabString(); + + var tokens = this.tokenizeTmSnippet(snippetText); + tokens = this.resolveVariables(tokens, editor); + // indent + tokens = tokens.map(function(x) { + if (x == "\n") + return x + indentString; + if (typeof x == "string") + return x.replace(/\t/g, tabString); + return x; + }); + // tabstop values + var tabstops = []; + tokens.forEach(function(p, i) { + if (typeof p != "object") + return; + var id = p.tabstopId; + if (!tabstops[id]) { + tabstops[id] = []; + tabstops[id].index = id; + tabstops[id].value = ""; + } + if (tabstops[id].indexOf(p) != -1) + return; + tabstops[id].push(p); + var i1 = tokens.indexOf(p, i + 1); + if (i1 == -1) + return; + var value = tokens.slice(i + 1, i1).join(""); + if (value) + tabstops[id].value = value; + }); + + tabstops.forEach(function(ts) { + ts.value && ts.forEach(function(p) { + var i = tokens.indexOf(p); + var i1 = tokens.indexOf(p, i + 1); + if (i1 == -1) + tokens.splice(i + 1, 0, ts.value, p); + else if (i1 == i + 1) + tokens.splice(i + 1, 0, ts.value); + }); + }); + // convert to plain text + var row = 0, column = 0; + var text = ""; + tokens.forEach(function(t) { + if (typeof t == "string") { + if (t[0] == "\n"){ + column = t.length - 1; + row ++; + } else + column += t.length; + text += t; + } else { + if (!t.start) + t.start = {row: row, column: column}; + else + t.end = {row: row, column: column}; + } + }); + var range = editor.getSelectionRange(); + var end = editor.session.replace(range, text); + + var tabstopManager = new TabstopManager(editor); + tabstopManager.addTabstops(tabstops, range.start, end); + tabstopManager.tabNext(); + }; + + this.$getScope = function(editor) { + var scope = editor.session.$mode.$id || ""; + scope = scope.split("/").pop(); + if (editor.session.$mode.$modes) { + var c = editor.getCursorPosition() + var state = editor.session.getState(c.row); + if (state.substring) { + if (state.substring(0, 3) == "js-") + scope = "javascript"; + else if (state.substring(0, 4) == "css-") + scope = "css"; + else if (state.substring(0, 4) == "php-") + scope = "php"; + } + } + return scope; + }; + + 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) { + var snippets = snippetMap[scope]; + if (snippets) + snippet = this.findMatchingSnippet(snippets, before, after); + return !!snippet; + }, this); + if (!snippet) + return false; + + editor.session.doc.removeInLine(cursor.row, + cursor.column - snippet.replaceBefore.length, + cursor.column + snippet.replaceAfter.length + ); + + this.variables.M__ = snippet.matchBefore; + this.variables.T__ = snippet.matchAfter; + this.insertSnippet(editor, snippet.content); + + this.variables.M__ = this.variables.T__ = null; + return true; + }; + + this.findMatchingSnippet = function(snippetList, before, after) { + for (var i = snippetList.length; i--;) { + var s = snippetList[i]; + if (s.startRe && !s.startRe.test(before)) + continue; + if (s.endRe && !s.endRe.test(after)) + continue; + if (!s.startRe && !s.endRe) + continue; + + s.matchBefore = s.startRe ? s.startRe.exec(before) : [""]; + s.matchAfter = s.endRe ? s.endRe.exec(after) : [""]; + s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : ""; + s.replaceAfter = s.endTriggerRe ? s.endTriggerRe.exec(after)[0] : ""; + return s; + } + }; + + this.snippetMap = {}; + this.snippetNameMap = {}; + this.register = function(snippets, scope) { + var snippetMap = this.snippetMap; + var snippetNameMap = this.snippetNameMap; + var self = this; + function wrapRegexp(src) { + if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src)) + src = "(?:" + src + ")" + + return src || ""; + } + function guardedRegexp(re, guard, opening) { + re = wrapRegexp(re); + guard = wrapRegexp(guard); + if (opening) { + re = guard + re; + if (re && re[re.length - 1] != "$") + re = re + "$"; + } else { + re = re + guard; + if (re && re[0] != "^") + re = "^" + re; + } + return new RegExp(re); + } + + function addSnippet(s) { + if (!s.scope) + s.scope = scope || "_"; + scope = s.scope + if (!snippetMap[scope]) { + snippetMap[scope] = []; + snippetNameMap[scope] = {}; + } + + var map = snippetNameMap[scope]; + if (s.name) { + var old = map[s.name]; + if (old) + self.unregister(old); + map[s.name] = s; + } + snippetMap[scope].push(s); + + if (s.tabTrigger && !s.trigger) { + if (!s.guard && /^\w/.test(s.tabTrigger)) + s.guard = "\\b"; + s.trigger = lang.escapeRegExp(s.tabTrigger); + } + + s.startRe = guardedRegexp(s.trigger, s.guard, true); + s.triggerRe = new RegExp(s.trigger, "", true); + + s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true); + s.endTriggerRe = new RegExp(s.endTrigger, "", true); + }; + + if (snippets.content) + addSnippet(snippets); + else if (Array.isArray(snippets)) + snippets.forEach(addSnippet); + }; + this.unregister = function(snippets, scope) { + var snippetMap = this.snippetMap; + var snippetNameMap = this.snippetNameMap; + + function removeSnippet(s) { + var map = snippetNameMap[scope]; + if (map && map[s.name]) { + delete map[s.name]; + map = snippetMap[scope]; + var i = map && map.indexOf(s); + if (i >= 0) + map.splice(i, 1); + } + } + if (snippets.content) + removeSnippet(snippets); + else if (Array.isArray(snippets)) + snippets.forEach(removeSnippet); + }; + this.parseSnippetFile = function(str) { + var list = [], snippet = {}; + var re = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm; + var m; + while (m = re.exec(str)) { + if (m[1]) { + try { + snippet = JSON.parse(m[1]) + list.push(snippet); + } catch (e) {} + } if (m[4]) { + snippet.content = m[4].replace(/^\t/gm, ""); + list.push(snippet); + snippet = {}; + } else { + var key = m[2], val = m[3]; + if (key == "regex") { + val = val.split(/\/((?:[^\/\\]|\\.)*)\/?/); + snippet.guard = val[1]; + snippet.trigger = val[2]; + snippet.endTrigger = val[3]; + snippet.endGuard = val[4]; + } else if (key == "snippet") { + snippet.tabTrigger = val.split(/^(\S*)(?:\s(.*))?$/)[1]; + if (!snippet.name) + snippet.name = val; + } else { + snippet[key] = val; + } + } + } + return list; + }; + this.getSnippetByName = function(name, editor) { + var scope = editor && this.$getScope(editor); + var snippetMap = this.snippetNameMap; + var snippet; + [scope, "_"].some(function(scope) { + var snippets = snippetMap[scope]; + if (snippets) + snippet = snippets[name]; + return !!snippet; + }, this); + return snippet; + }; + +}).call(SnippetManager.prototype); + + + +var TabstopManager = function(editor) { + if (editor.tabstopManager) + return editor.tabstopManager; + editor.tabstopManager = this; + this.$onChange = this.onChange.bind(this); + this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule; + this.$onChangeSession = this.onChangeSession.bind(this); + this.$onAfterExec = this.onAfterExec.bind(this); + this.attach(editor); +}; +(function() { + this.attach = function(editor) { + this.index = -1; + this.ranges = []; + this.tabstops = []; + this.selectedTabstop = null; + + this.editor = editor; + this.editor.on("change", this.$onChange); + this.editor.on("changeSelection", this.$onChangeSelection); + this.editor.on("changeSession", this.$onChangeSession); + this.editor.commands.on("afterExec", this.$onAfterExec); + this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler); + }; + this.detach = function() { + this.tabstops.forEach(this.removeTabstopMarkers, this); + this.ranges = null; + this.tabstops = null; + this.selectedTabstop = null; + this.editor.removeListener("change", this.$onChange); + this.editor.removeListener("changeSelection", this.$onChangeSelection); + this.editor.removeListener("changeSession", this.$onChangeSession); + this.editor.commands.removeListener("afterExec", this.$onAfterExec); + this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler); + this.editor.tabstopManager = null; + this.editor = null; + }; + + this.onChange = function(e) { + var changeRange = e.data.range; + var isRemove = e.data.action[0] == "r"; + var start = changeRange.start; + var end = changeRange.end; + var startRow = start.row; + var endRow = end.row; + var lineDif = endRow - startRow; + var colDiff = end.column - start.column; + + if (isRemove) { + lineDif = -lineDif; + colDiff = -colDiff; + } + if (!this.$inChange && isRemove) { + var ts = this.selectedTabstop; + var changedOutside = !ts.some(function(r) { + return comparePoints(r.start, start) <= 0 && comparePoints(r.end, end) >= 0; + }); + if (changedOutside) + return this.detach(); + } + var ranges = this.ranges; + for (var i = 0; i < ranges.length; i++) { + var r = ranges[i]; + if (r.end.row < start.row) + continue; + + if (comparePoints(start, r.start) < 0 && comparePoints(end, r.end) > 0) { + this.removeRange(r); + i--; + continue; + } + + if (r.start.row == startRow && r.start.column > start.column) + r.start.column += colDiff; + if (r.end.row == startRow && r.end.column >= start.column) + r.end.column += colDiff; + if (r.start.row >= startRow) + r.start.row += lineDif; + if (r.end.row >= startRow) + r.end.row += lineDif; + + if (comparePoints(r.start, r.end) > 0) + this.removeRange(r); + } + if (!ranges.length) + this.detach(); + }; + this.updateLinkedFields = function() { + var ts = this.selectedTabstop; + if (!ts.hasLinkedRanges) + return; + this.$inChange = true; + var session = this.editor.session; + var text = session.getTextRange(ts.firstNonLinked); + for (var i = ts.length; i--;) { + var range = ts[i]; + if (!range.linked) + continue; + var fmt = exports.SnippetManager.tmStrFormat(text, range.original) + session.replace(range, fmt); + } + this.$inChange = false; + }; + this.onAfterExec = function(e) { + if (e.command && !e.command.readOnly) + this.updateLinkedFields(); + }; + this.onChangeSelection = function() { + if (!this.editor) + return + var lead = this.editor.selection.lead; + var anchor = this.editor.selection.anchor; + var isEmpty = this.editor.selection.isEmpty(); + for (var i = this.ranges.length; i--;) { + if (this.ranges[i].linked) + continue; + var containsLead = this.ranges[i].contains(lead.row, lead.column); + var containsAnchor = isEmpty || this.ranges[i].contains(anchor.row, anchor.column); + if (containsLead && containsAnchor) + return; + } + this.detach(); + }; + this.onChangeSession = function() { + this.detach(); + }; + this.tabNext = function(dir) { + var max = this.tabstops.length - 1; + var index = this.index + (dir || 1); + index = Math.min(Math.max(index, 0), max); + this.selectTabstop(index); + if (index == max) + this.detach(); + }; + this.selectTabstop = function(index) { + var ts = this.tabstops[this.index]; + if (ts) + this.addTabstopMarkers(ts); + this.index = index; + ts = this.tabstops[this.index]; + if (!ts || !ts.length) + return; + + this.selectedTabstop = ts; + var sel = this.editor.multiSelect; + sel.toSingleRange(ts.firstNonLinked.clone()); + for (var i = ts.length; i--;) { + if (ts.hasLinkedRanges && ts[i].linked) + continue; + sel.addRange(ts[i].clone(), true); + } + this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler); + }; + this.addTabstops = function(tabstops, start, end) { + // add final tabstop if missing + if (!tabstops[0]) { + var p = Range.fromPoints(end, end); + moveRelative(p.start, start); + moveRelative(p.end, start); + tabstops[0] = [p]; + tabstops[0].index = 0; + } + + var i = this.index; + var arg = [i, 0]; + var ranges = this.ranges; + var editor = this.editor; + tabstops.forEach(function(ts) { + for (var i = ts.length; i--;) { + var p = ts[i]; + var range = Range.fromPoints(p.start, p.end || p.start); + movePoint(range.start, start); + movePoint(range.end, start); + range.original = p; + range.tabstop = ts; + ranges.push(range); + ts[i] = range; + if (p.fmt) { + range.linked = true; + ts.hasLinkedRanges = true; + } else if (!ts.firstNonLinked) + ts.firstNonLinked = range; + } + if (!ts.firstNonLinked) + ts.hasLinkedRanges = false; + arg.push(ts); + this.addTabstopMarkers(ts); + }, this); + // tabstop 0 is the last one + arg.push(arg.splice(2, 1)[0]); + this.tabstops.splice.apply(this.tabstops, arg); + }; + + this.addTabstopMarkers = function(ts) { + var session = this.editor.session; + ts.forEach(function(range) { + if (!range.markerId) + range.markerId = session.addMarker(range, "ace_snippet-marker", "text"); + }); + }; + this.removeTabstopMarkers = function(ts) { + var session = this.editor.session; + ts.forEach(function(range) { + session.removeMarker(range.markerId); + range.markerId = null; + }); + }; + this.removeRange = function(range) { + var i = range.tabstop.indexOf(range); + range.tabstop.splice(i, 1); + i = this.ranges.indexOf(range); + this.ranges.splice(i, 1); + this.editor.session.removeMarker(range.markerId); + }; + + this.keyboardHandler = new HashHandler(); + this.keyboardHandler.bindKeys({ + "Tab": function(ed) { + ed.tabstopManager.tabNext(1); + }, + "Shift-Tab": function(ed) { + ed.tabstopManager.tabNext(-1); + }, + "Esc": function(ed) { + ed.tabstopManager.detach(); + }, + "Return": function(ed) { + //ed.tabstopManager.tabNext(1); + return false; + }, + }); +}).call(TabstopManager.prototype); + + +var movePoint = function(point, diff) { + if (point.row == 0) + point.column += diff.column; + point.row += diff.row; +}; + +var moveRelative = function(point, start) { + if (point.row == start.row) + point.column -= start.column; + point.row -= start.row; +}; + + +require("./lib/dom").importCssString("\ +.ace_snippet-marker {\ + -moz-box-sizing: border-box;\ + box-sizing: border-box;\ + background: rgba(194, 193, 208, 0.09);\ + border: 1px dotted rgba(211, 208, 235, 0.62);\ + position: absolute;\ +}"); + +exports.SnippetManager = new SnippetManager(); + + +}); diff --git a/lib/ace/snippets/_.snippets b/lib/ace/snippets/_.snippets new file mode 100644 index 00000000..d553449d --- /dev/null +++ b/lib/ace/snippets/_.snippets @@ -0,0 +1,240 @@ +# Global snippets + +# (c) holds no legal value ;) +snippet c) + Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved.${2} +snippet date + `strftime("%Y-%m-%d")` +snippet ddate + `strftime("%B %d, %Y")` +snippet time + `strftime("%H:%M")` +snippet lorem + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. +snippet GPL2 + ${1:One line to give the program's name and a brief description.} + Copyright (C) `strftime("%Y")` ${2:copyright holder} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ${3} +snippet LGPL2 + ${1:One line to give the program's name and a brief description.} + Copyright (C) `strftime("%Y")` ${2:copyright holder} + + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ${3} +snippet GPL3 + ${1:one line to give the program's name and a brief description.} + Copyright (C) `strftime("%Y")` ${2:copyright holder} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + ${3} +snippet LGPL3 + ${1:One line to give the program's name and a brief description.} + Copyright (C) `strftime("%Y")` ${2:copyright holder} + + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ${3} +snippet BSD2 + ${1:one line to give the program's name and a brief description} + Copyright (C) `strftime("%Y")` ${2:copyright holder} + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + The views and conclusions contained in the software and documentation + are those of the authors and should not be interpreted as representing + official policies, either expressedor implied, of $2. + + ${4} +snippet BSD3 + ${1:one line to give the program's name and a brief description} + Copyright (C) `strftime("%Y")` ${2:copyright holder} + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the ${3:organization} nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + ${4} +snippet BSD4 + ${1:one line to give the program's name and a brief description} + Copyright (C) `strftime("%Y")` ${2:copyright holder} + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by the ${3:organization}. + 4. Neither the name of the $3 nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + ${4} +snippet MIT + ${1:one line to give the program's name and a brief description} + Copyright (C) `strftime("%Y")` ${2:copyright holder} + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + ${3} +snippet APACHE + ${1:one line to give the program's name and a brief description} + Copyright `strftime("%Y")` ${2:copyright holder} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ${3} +snippet BEERWARE + ${2:one line to give the program's name and a brief description} + Copyright `strftime("%Y")` ${3:copyright holder} + + Licensed under the "THE BEER-WARE LICENSE" (Revision 42): + ${1:`g:snips_author`} wrote this file. As long as you retain this notice you + can do whatever you want with this stuff. If we meet some day, and you think + this stuff is worth it, you can buy me a beer or coffee in return + + ${4} + +snippet WTFPL + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright `strftime("%Y")` ${1:copyright holder} + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION diff --git a/lib/ace/snippets/actionscript.snippets b/lib/ace/snippets/actionscript.snippets new file mode 100644 index 00000000..af9611c3 --- /dev/null +++ b/lib/ace/snippets/actionscript.snippets @@ -0,0 +1,157 @@ +snippet main + package { + import flash.display.*; + import flash.Events.*; + + public class Main extends Sprite { + public function Main ( ) { + trace("start"); + stage.scaleMode = StageScaleMode.NO_SCALE; + stage.addEventListener(Event.RESIZE, resizeListener); + } + + private function resizeListener (e:Event):void { + trace("The application window changed size!"); + trace("New width: " + stage.stageWidth); + trace("New height: " + stage.stageHeight); + } + + } + + } +snippet class + ${1:public|internal} class ${2:name} ${3:extends } { + public function $2 ( ) { + ("start"); + } + } +snippet all + package name { + + ${1:public|internal|final} class ${2:name} ${3:extends } { + private|public| static const FOO = "abc"; + private|public| static var BAR = "abc"; + + // class initializer - no JIT !! one time setup + if Cababilities.os == "Linux|MacOS" { + FOO = "other"; + } + + // constructor: + public function $2 ( ){ + super2(); + trace("start"); + } + public function name (a, b...){ + super.name(..); + lable:break + } + } + } + + function A(){ + // A can only be accessed within this file + } +snippet switch + switch(${1}){ + case ${2}: + ${3} + break; + default: + } +snippet case + case ${1}: + ${2} + break; +snippet package + package ${1:package}{ + ${2} + } +snippet wh + while ${1:cond}{ + ${2} + } +snippet do + do { + ${2} + } while (${1:cond}) +snippet while + while ${1:cond}{ + ${2} + } +snippet for enumerate names + for (${1:var} in ${2:object}){ + ${3} + } +snippet for enumerate values + for each (${1:var} in ${2:object}){ + ${3} + } +snippet get_set + function get ${1:name} { + return ${2} + } + function set $1 (newValue) { + ${3} + } +snippet interface + interface name { + function method(${1}):${2:returntype}; + } +snippet try + try { + ${1} + } catch (error:ErrorType) { + ${2} + } finally { + ${3} + } +# For Loop (same as c.snippet) +snippet for for (..) {..} + for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { + ${4:/* code */} + } +# Custom For Loop +snippet forr + for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { + ${5:/* code */} + } +# If Condition +snippet if + if (${1:/* condition */}) { + ${2:/* code */} + } +snippet el + else { + ${1} + } +# Ternary conditional +snippet t + ${1:/* condition */} ? ${2:a} : ${3:b} +snippet fun + function ${1:function_name}(${2})${3} + { + ${4:/* code */} + } +# FlxSprite (usefull when using the flixel library) +snippet FlxSprite + package + { + import org.flixel.* + + public class ${1:ClassName} extends ${2:FlxSprite} + { + public function $1(${3: X:Number, Y:Number}):void + { + super(X,Y); + ${4: //code...} + } + + override public function update():void + { + super.update(); + ${5: //code...} + } + } + } + diff --git a/lib/ace/snippets/apache.snippets b/lib/ace/snippets/apache.snippets new file mode 100644 index 00000000..a9e53e19 --- /dev/null +++ b/lib/ace/snippets/apache.snippets @@ -0,0 +1,35 @@ +# Snippets for code blocks used oftenly in Apache files. +# +snippet dir + + DirectoryIndex ${2:index.html} + Order Deny,Allow + Deny from All + +# +snippet filesmatch + + ${2} + +# +snippet ifmodule + + ${2} + +# +snippet limitexcept + + ${2} + +# +snippet proxy + + ${2} + +# +snippet virtualhost + + ServerAdmin ${3:webmaster@example.com} + DocumentRoot ${4:/www/example.com} + ServerName ${5:www.example.com} + diff --git a/lib/ace/snippets/autoit.snippets b/lib/ace/snippets/autoit.snippets new file mode 100644 index 00000000..690018ce --- /dev/null +++ b/lib/ace/snippets/autoit.snippets @@ -0,0 +1,66 @@ +snippet if + If ${1:condition} Then + ${2:; True code} + EndIf +snippet el + Else + ${1} +snippet elif + ElseIf ${1:condition} Then + ${2:; True code} +# If/Else block +snippet ifel + If ${1:condition} Then + ${2:; True code} + Else + ${3:; Else code} + EndIf +# If/ElseIf/Else block +snippet ifelif + If ${1:condition 1} Then + ${2:; True code} + ElseIf ${3:condition 2} Then + ${4:; True code} + Else + ${5:; Else code} + EndIf +# Switch block +snippet switch + Switch (${1:condition}) + Case {$2:case1}: + {$3:; Case 1 code} + Case Else: + {$4:; Else code} + EndSwitch +# Select block +snippet select + Select (${1:condition}) + Case {$2:case1}: + {$3:; Case 1 code} + Case Else: + {$4:; Else code} + EndSelect +# While loop +snippet while + While (${1:condition}) + ${2:; code...} + WEnd +# For loop +snippet for + For ${1:n} = ${3:1} to ${2:count} + ${4:; code...} + Next +# New Function +snippet func + Func ${1:fname}(${2:`indent('.') ? 'self' : ''`}): + ${4:Return} + EndFunc +# Message box +snippet msg + MsgBox(${3:MsgType}, ${1:"Title"}, ${2:"Message Text"}) +# Debug Message +snippet debug + MsgBox(0, "Debug", ${1:"Debug Message"}) +# Show Variable Debug Message +snippet showvar + MsgBox(0, "${1:VarName}", $1) diff --git a/lib/ace/snippets/c.snippets b/lib/ace/snippets/c.snippets new file mode 100644 index 00000000..c476de4a --- /dev/null +++ b/lib/ace/snippets/c.snippets @@ -0,0 +1,235 @@ +## Main +# main +snippet main + int main(int argc, const char *argv[]) + { + ${1} + return 0; + } +# main(void) +snippet mainn + int main(void) + { + ${1} + return 0; + } +## +## Preprocessor +# #include <...> +snippet inc + #include <${1:stdio}.h>${2} +# #include "..." +snippet Inc + #include "${1:`Filename("$1.h")`}"${2} +# ifndef...define...endif +snippet ndef + #ifndef $1 + #define ${1:SYMBOL} ${2:value} + #endif${3} +# define +snippet def + #define +# ifdef...endif +snippet ifdef + #ifdef ${1:FOO} + ${2:#define } + #endif${3} +# if +snippet #if + #if ${1:FOO} + ${2} + #endif +# header include guard +snippet once + #ifndef ${1:`toupper(Filename('$1_H', 'UNTITLED_H'))`} + + #define $1 + + ${2} + + #endif /* end of include guard: $1 */ +## +## Control Statements +# if +snippet if + if (${1:/* condition */}) { + ${2:/* code */} + }${3} +# else +snippet el + else { + ${1} + }${3} +# else if +snippet elif + else if (${1:/* condition */}) { + ${2:/* code */} + }${3} +# ternary +snippet t + ${1:/* condition */} ? ${2:a} : ${3:b} +# switch +snippet switch + switch (${1:/* variable */}) { + case ${2:/* variable case */}: + ${3} + ${4:break;}${5} + default: + ${6} + }${7} +# switch without default +snippet switchndef + switch (${1:/* variable */}) { + case ${2:/* variable case */}: + ${3} + ${4:break;}${5} + }${6} +# case +snippet case + case ${1:/* variable case */}: + ${2} + ${3:break;}${4} +## +## Loops +# for +snippet for + for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { + ${4:/* code */} + }${5} +# for (custom) +snippet forr + for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { + ${5:/* code */} + }${6} +# while +snippet wh + while (${1:/* condition */}) { + ${2:/* code */} + }${3} +# do... while +snippet do + do { + ${2:/* code */} + } while (${1:/* condition */});${3} +## +## Functions +# function definition +snippet fun + ${1:void} ${2:function_name}(${3}) + { + ${4:/* code */} + }${5} +# function declaration +snippet fund + ${1:void} ${2:function_name}(${3});${4} +## +## Types +# typedef +snippet td + typedef ${1:int} ${2:MyCustomType};${3} +# struct +snippet st + struct ${1:`Filename('$1_t', 'name')`} { + ${2:/* data */} + }${3: /* optional variable list */};${4} +# typedef struct +snippet tds + typedef struct ${2:_$1 }{ + ${3:/* data */} + } ${1:`Filename('$1_t', 'name')`};${4} +# typedef enum +snippet tde + typedef enum { + ${1:/* data */} + } ${2:foo};${3} +## +## Input/Output +# printf +snippet pr + printf("${1:%s}\n"${2});${3} +# fprintf (again, this isn't as nice as TextMate's version, but it works) +snippet fpr + fprintf(${1:stderr}, "${2:%s}\n"${3});${4} +# getopt +snippet getopt + int choice; + while (1) + { + static struct option long_options[] = + { + /* Use flags like so: + {"verbose", no_argument, &verbose_flag, 'V'}*/ + /* Argument styles: no_argument, required_argument, optional_argument */ + {"version", no_argument, 0, 'v'}, + {"help", no_argument, 0, 'h'}, + ${1} + {0,0,0,0} + }; + + int option_index = 0; + + /* Argument parameters: + no_argument: " " + required_argument: ":" + optional_argument: "::" */ + + choice = getopt_long( argc, argv, "vh", + long_options, &option_index); + + if (choice == -1) + break; + + switch( choice ) + { + case 'v': + ${2} + break; + + case 'h': + ${3} + break; + + case '?': + /* getopt_long will have already printed an error */ + break; + + default: + /* Not sure how to get here... */ + return EXIT_FAILURE; + } + } + + /* Deal with non-option arguments here */ + if ( optind < argc ) + { + while ( optind < argc ) + { + ${4} + } + } +## +## Miscellaneous +# This is kind of convenient +snippet . + [${1}]${2} +# GPL +snippet gpl + /* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Copyright (C) ${1:Author}, `strftime("%Y")` + */ + + ${2} diff --git a/lib/ace/snippets/chef.snippets b/lib/ace/snippets/chef.snippets new file mode 100644 index 00000000..51036135 --- /dev/null +++ b/lib/ace/snippets/chef.snippets @@ -0,0 +1,204 @@ +# Opscode Chef Cookbook Recipe Resources +# Snippet by: Mike Smullin +# Based on: http://wiki.opscode.com/display/chef/Resources + +# @TODO: Include Meta attributes and actions in all snippets +# @TODO: Finish writing snippets for remaining Resources + +snippet cookbook_file + # Cookbook File resource + cookbook_file ${1:"/path/to/file"} do # The remote path where the file will reside + ${2:#}backup ${3} # How many backups of this file to keep. Set to false if you want no backups + ${4:#}group ${5} # The group owner of the file (string or id) + ${6:#}mode ${7} # The octal mode of the file - e.g. 0755 + ${8:#}owner ${9} # The owner for the file + ${10:#}source ${11} # The basename of the source file + ${12:#}cookbook ${13} # The cookbook this file is stored in + + ${14:#}${15: action :create} # Create this file (Default) + ${16:#}${17: action :create_if_missing} # Create only if it doesn't exist yet + ${18:#}${19: action :delete} # Delete this file + end + +snippet execute + # Execute resource + execute ${1:"command to execute"} do # The command to execute + ${2:#}creates ${3:nil} # A file this command creates - if the file exists, the command will not be run. + ${4:#}cwd ${5:nil} # Current working directory to run the command from. + ${6:#}environment ${7:nil} # A hash of environment variables to set before running this command. + ${8:#}group ${9:nil} # A group name or group ID that we should change to before running this command. + ${10:#}path ${11:nil} # An array of paths to use when searching for the command. Nil uses system path. + ${12:#}returns ${13:0} # The return value of the command - this resource raises an exception if the return value does not match. + ${14:#}timeout ${15:nil} # How many seconds to let the command run before timing it out. + ${16:#}user ${17:nil} # A user name or user ID that we should change to before running this command. + ${18:#}umask ${19:nil} # Umask for files created by the command + + ${20:#}${21:action :run} # Run this command (Default) + ${22:#}${23:action :nothing} # Do not run this command + end + +snippet link + # Link resource + link ${1:"/target/file"} do # The file name of the link + ${2:#}to ${3} # The real file you want to link to + ${4:#}link_type ${5:symbolic} # Either :symbolic or :hard + ${6:#}owner ${7} # The owner of the symlink + ${8:#}group ${9} # The group of the symlink + + ${10:#}${11:action :create} # Create a link (Default) + ${12:#}${13:action :delete} # Delete a link + end + +snippet package + # Package resource + package ${1:"package_name"} do # Name of the package to install + ${2:#}version ${3:nil} # The version of the package to install/upgrade + ${4:#}response_file ${5:nil} # An optional response file - used to pre-seed packages (note: the file is fetched by Remote File) + ${6:#}source ${7} # Used to provide an optional package source for providers that use a local file (rubygems, dpkg and rpm) + ${8:#}options ${9:nil} # Add additional options to the underlying package command + ${10:#}gem_binary ${11:gem} # A gem_package attribut to specify a gem binary. Useful for installing ruby 1.9 gems while running chef in ruby 1.8 + + ${12:#}${13:action :install} # Install a package - if version is provided, install that specific version (Default) + ${14:#}${15:action :upgrade} # Upgrade a package - if version is provided, upgrade to that specific version + ${16:#}${17:action :remove} # Remove a package + ${18:#}${19:action :purge} # Purge a package (this usually entails removing configuration files as well as the package itself) + end + +snippet service + # Service resource + service ${1:"service_name"} do # Name of the service + ${2:#}enabled ${3:nil} # Whether the service is enabled at boot time + ${4:#}running ${5:nil} # Make sure the service is running. Start if stopped + ${6:#}pattern ${7} # Pattern to look for in the process table + ${8:#}start_command ${9:nil} # Command used to start this service + ${10:#}stop_command ${11:nil} # Command used to stop this service + ${12:#}status_command ${13:nil} # Command used to check the service run status + ${14:#}restart_command ${15:nil} # Command used to restart this service + ${16:#}reload_command ${17:nil} # Command used to tell this service to reload its configuration + ${18:#}supports ${19:false} # Features this service supports, ie :restart, :reload, :status + + ${20:#}${21:action :enable} # Enable this service + ${22:#}${23:action :disable} # Disable this service + ${24:#}${25:action :nothing} # Don't do anything with this service (Default) + ${26:#}${27:action :start} # Start this service + ${28:#}${29:action :stop} # Stop this service + ${30:#}${31:action :restart} # Restart this service + ${32:#}${33:action :reload} # Reload the configuration for this service + end + +snippet file + # File resource + file ${1:"/path/to/file"} do # Path to the file + ${2:#}backup ${3:5} # How many backups of this file to keep. Set to false if you want no backups. + ${4:#}owner ${5} # The owner for the file + ${6:#}group ${7} # The group owner of the file (string or id) + ${8:#}mode ${9} # The octal mode of the file (4-digit format) + ${10:#}content ${11:nil} # A string to write to the file. This will replace any previous content if set + + ${12:#}${13:action :create} # Create this file (Default) + ${14:#}${15:action :delete} # Delete this file + ${16:#}${17:action :touch} # Touch this file (update the mtime/atime) + end + +snippet directory + # Directory resource + directory ${1:"/path/to/dir"} do # The path to the directory + ${2:#}group ${3} # The group owner of the directory (string or id) + ${4:#}mode ${5} # The octal mode of the directory, eg 0755 + ${6:#}owner ${7} # The owner for the directory + ${10:#}recursive ${11:false} # When deleting the directory, delete it recursively. When creating the directory, create recursively (ie, mkdir -p) + + ${12:#}${13:action :create} # Create this directory (Default) + ${14:#}${15:action :delete} # Delete this directory + end + +snippet template + # Template resource + template ${1:"/path/to/file"} do # Path to the file + ${2:#}cookbook ${3:nil} # Specify the cookbook where the template is located, default is current cookbook + ${4:#}source ${5:nil} # Template source file. Found in templates/default for the cookbook + ${6:#}variables ${7} # Variables to use in the template + ${8:#}local ${9:false} # Is the template already present on the node? + ${10:#}backup ${11:5} # How many backups of this file to keep. Set to false if you want no backups. + ${12:#}owner ${13} # The owner for the file + ${14:#}group ${15} # The group owner of the file (string or id) + ${16:#}mode ${17} # The octal mode of the file (4-digit format) + ${18:#}content ${19:nil} # A string to write to the file. This will replace any previous content if set + + ${20:#}${21:action :create} # Create the file (Default) + ${22:#}${23:action :delete} # Delete this file + ${24:#}${25:action :touch} # Touch this file (update the mtime/atime) + end + +snippet svn + # SCM Resource, Chef::Provider::Subversion + svn ${1:"/destination/path"} do # Path to clone/checkout/export the source to + ${2:#}repository ${3} # URI of the repository + ${4:#}revision ${5:"HEAD"} # revision to checkout. can be symbolic, like "HEAD" or an SCM specific revision id + ${6:#}reference ${7} # (Git only) alias for revision + ${8:#}user ${9:nil} # System user to own the checked out code + ${10:#}group ${11:nil} # System group to own the checked out code + ${12:#}svn_username ${13} # (Subversion only) Username for Subversion operations + ${14:#}svn_password ${15} # (Subversion only) Password for Subversion operations + ${16:#}svn_arguments ${17} # (Subversion only) Extra arguments passed to the subversion command + + ${18:#}${19:action :sync} # Update the source to the specified revision, or get a new checkout (Default) + ${20:#}${21:action :checkout} # Checkout the source. Does nothing if a checkout is available + ${22:#}${23:action :export} # Export the source, excluding or removing any version control artifacts + end + +snippet git + # SCM Resource, Chef::Provider::Git + git ${1:"/destination/path"} do # Path to clone/checkout/export the source to + ${2:#}repository ${3} # URI of the repository + ${4:#}revision ${5:"HEAD"} # revision to checkout. can be symbolic, like "HEAD" or an SCM specific revision id + ${6:#}reference ${7} # (Git only) alias for revision + ${8:#}user ${9:nil} # System user to own the checked out code + ${10:#}group ${11:nil} # System group to own the checked out code + ${12:#}depth ${13:nil} # (Git only) Number of past revisions to include in Git shallow clone + ${14:#}enable_submodules ${15:"false"} # (Git only) performs a submodule init and submodule update + ${16:#}remote ${17:"origin"} # (Git only) remote repository to use for syncing an existing clone + ${18:#}ssh_wrapper ${19} # (Git only) path to a wrapper script for running SSH with git. GIT_SSH environment variable is set to this. + + ${20:#}${21:action :sync} # Update the source to the specified revision, or get a new clone (Default) + ${22:#}${23:action :checkout} # Clone the source. Does nothing if a checkout is available + ${24:#}${25:action :export} # Export the source, excluding or removing any version control artifacts + end + +snippet deploy + # Deploy resource + deploy ${1:"/deploy/dir/"} do # Path to deploy to + ${2:#}deploy_to ${3} # The "meta root" for your application. + ${4:#}repository ${5} # URI of the repository + ${6:#}repo ${7} # alias for repository + ${8:#}revision ${9:"HEAD"} # revision to checkout. can be symbolic, like "HEAD" or an SCM specific revision id + ${10:#}branch ${11} # alias for revision + ${12:#}user ${13:nil} # System user to run the deploy as + ${14:#}group ${15:nil} # System group to run the deploy as + ${16:#}svn_username ${17} # (Subversion only) Username for Subversion operations} + ${18:#}svn_password ${19} # (Subversion only) Password for Subversion operations} + ${20:#}svn_arguments ${21} # (Subversion only) Extra arguments passed to the subversion command} + ${22:#}shallow_clone ${23:nil} # (Git only) boolean, true sets clone depth to 5 + ${24:#}enable_submodules ${25:false} # (Git only) performs a submodule init and submodule update + ${26:#}remote ${27:"origin"} # (Git only) remote repository to use for syncing an existing clone + ${28:#}ssh_wrapper ${29} # (Git only) path to a wrapper script for running SSH with git. GIT_SSH environment variable is set to this. + ${30:#}git_ssh_wrapper ${31} # alias for ssh_wrapper + ${32:#}scm_provider ${33:Chef::Provider::Git} # SCM Provider to use. + ${34:#}repository_cache ${35: "cached-copy"} # Name of the subdirectory where the pristine copy of your app's source is kept + ${36:#}environment ${37} # A hash of the form {"ENV_VARIABLE"=>"VALUE"}} + ${38:#}purge_before_symlink ${39:%w(log tmp/pids public/system)} # An array of paths, relative to app root, to be removed from a checkout before symlinking + ${40:#}create_dirs_before_symlink ${41:%w(tmp public config)} # Directories to create before symlinking. Runs after purge_before_symlink + ${42:#}symlinks ${43:"system" => "public/system", "pids" => "tmp/pids", "log" => "log"} # A hash that maps files in the shared directory to their paths in the current release + ${44:#}symlink_before_migrate ${45:"config/database.yml" => "config/database.yml"} # A hash that maps files in the shared directory into the current release. Runs before migration + ${46:#}migrate ${47:false} # Should the migration command be executed? (true or false) + ${48:#}migration_command ${49} # A string containing a shell command to execute to run the migration + ${50:#}restart_command ${51:nil} # A code block to evaluate or a string containing a shell command + ${52:#}before_migrate ${53:"deploy/before_migrate.rb"} # A block or path to a file containing chef code to run before migrating + ${54:#}before_symlink ${55:"deploy/before_symlink.rb"} # A block or path to a file containing chef code to run before symlinking + ${56:#}before_restart ${57:"deploy/before_restart.rb"} # A block or path to a file containing chef code to run before restarting + ${58:#}after_restart ${59:"deploy/after_restart.rb"} # A block or path to a file containing chef code to run after restarting + + ${60:#}${61::deploy} # Deploy the application (Default) + ${62:#}${63::force_deploy} # For the revision deploy strategy, this removes any existing release of the same code version and re-deploys in its place + ${64:#}${65::rollback} # Rollback the application to the previous release + end diff --git a/lib/ace/snippets/clojure.snippets b/lib/ace/snippets/clojure.snippets new file mode 100644 index 00000000..e247debf --- /dev/null +++ b/lib/ace/snippets/clojure.snippets @@ -0,0 +1,90 @@ +snippet comm + (comment + ${1} + ) +snippet condp + (condp ${1:pred} ${2:expr} + ${3}) +snippet def + (def ${1}) +snippet defm + (defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}] + ${5}) +snippet defmm + (defmulti ${1:name} "${2:doc-string}" ${3:dispatch-fn}) +snippet defma + (defmacro ${1:name} "${2:doc-string}" ${3:dispatch-fn}) +snippet defn + (defn ${1:name} "${2:doc-string}" [${3:arg-list}] + ${4}) +snippet defp + (defprotocol ${1:name} + ${2}) +snippet defr + (defrecord ${1:name} [${2:fields}] + ${3:protocol} + ${4}) +snippet deft + (deftest ${1:name} + (is (= ${2:assertion}))) + ${3}) +snippet is + (is (= ${1} ${2})) +snippet defty + (deftype ${1:Name} [${2:fields}] + ${3:Protocol} + ${4}) +snippet doseq + (doseq [${1:elem} ${2:coll}] + ${3}) +snippet fn + (fn [${1:arg-list}] ${2}) +snippet if + (if ${1:test-expr} + ${2:then-expr} + ${3:else-expr}) +snippet if-let + (if-let [${1:result} ${2:test-expr}] + (${3:then-expr} $1) + (${4:else-expr})) +snippet imp + (:import [${1:package}]) + & {:keys [${1:keys}] :or {${2:defaults}}} +snippet let + (let [${1:name} ${2:expr}] + ${3}) +snippet letfn + (letfn [(${1:name) [${2:args}] + ${3})]) +snippet map + (map ${1:func} ${2:coll}) +snippet mapl + (map #(${1:lambda}) ${2:coll}) +snippet met + (${1:name} [${2:this} ${3:args}] + ${4}) +snippet ns + (ns ${1:name} + ${2}) +snippet dotimes + (dotimes [_ 10] + (time + (dotimes [_ ${1:times}] + ${2}))) +snippet pmethod + (${1:name} [${2:this} ${3:args}]) +snippet refer + (:refer-clojure :exclude [${1}]) +snippet require + (:require [${1:namespace} :as [${2}]]) +snippet use + (:use [${1:namespace} :only [${2}]]) +snippet print + (println ${1}) +snippet reduce + (reduce ${1:(fn [p n] ${3})} ${2}) +snippet when + (when ${1:test} ${2:body}) +snippet when-let + (when-let [${1:result} ${2:test}] + ${3:body}) diff --git a/lib/ace/snippets/cmake.snippets b/lib/ace/snippets/cmake.snippets new file mode 100644 index 00000000..26aa9ac9 --- /dev/null +++ b/lib/ace/snippets/cmake.snippets @@ -0,0 +1,58 @@ +snippet cmake + CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + PROJECT(${1:ProjectName}) + + FIND_PACKAGE(${2:LIBRARY}) + + INCLUDE_DIRECTORIES( + ${$2_INCLUDE_DIR} + ) + + ADD_SUBDIRECTORY(${3:src}) + + ADD_EXECUTABLE($1) + + TARGET_LINK_LIBRARIES($1 + ${$2_LIBRARIES} + ) + +snippet include + INCLUDE_DIRECTORIES( + ${${1:INCLUDE_DIR}} + ) + +snippet find + FIND_PACKAGE(${1:LIBRARY}) + +snippet glob + FILE(GLOB ${1:SRCS} *.${2:cpp}) + +snippet subdir + ADD_SUBDIRECTORY(${1:src}) + +snippet lib + ADD_LIBRARY(${1:lib} ${2:STATIC} + ${${3:SRCS}} + ) + +snippet link + TARGET_LINK_LIBRARIES(${1:bin} + ${2:somelib} + ) + +snippet bin + ADD_EXECUTABLE(${1:bin}) + +snippet set + SET(${1:var} ${2:val}) + +snippet dep + ADD_DEPENDENCIES(${1:target} + ${2:dep} + ) + +snippet props + SET_TARGET_PROPERTIES(${1:target} + ${2:PROPERTIES} ${3:COMPILE_FLAGS} + ${4:"-O3 -Wall -pedantic"} + ) diff --git a/lib/ace/snippets/coffee.snippets b/lib/ace/snippets/coffee.snippets new file mode 100644 index 00000000..83b77eba --- /dev/null +++ b/lib/ace/snippets/coffee.snippets @@ -0,0 +1,95 @@ +# Closure loop +snippet forindo + for ${1:name} in ${2:array} + do ($1) -> + ${3:// body} +# Array comprehension +snippet fora + for ${1:name} in ${2:array} + ${3:// body...} +# Object comprehension +snippet foro + for ${1:key}, ${2:value} of ${3:object} + ${4:// body...} +# Range comprehension (inclusive) +snippet forr + for ${1:name} in [${2:start}..${3:finish}] + ${4:// body...} +snippet forrb + for ${1:name} in [${2:start}..${3:finish}] by ${4:step} + ${5:// body...} +# Range comprehension (exclusive) +snippet forrex + for ${1:name} in [${2:start}...${3:finish}] + ${4:// body...} +snippet forrexb + for ${1:name} in [${2:start}...${3:finish}] by ${4:step} + ${5:// body...} +# Function +snippet fun + (${1:args}) -> + ${2:// body...} +# Function (bound) +snippet bfun + (${1:args}) => + ${2:// body...} +# Class +snippet cla class .. + class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} + ${2} +snippet cla class .. constructor: .. + class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} + constructor: (${2:args}) -> + ${3} + + ${4} +snippet cla class .. extends .. + class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} + ${3} +snippet cla class .. extends .. constructor: .. + class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} + constructor: (${3:args}) -> + ${4} + + ${5} +# If +snippet if + if ${1:condition} + ${2:// body...} +# If __ Else +snippet ife + if ${1:condition} + ${2:// body...} + else + ${3:// body...} +# Else if +snippet elif + else if ${1:condition} + ${2:// body...} +# Ternary If +snippet ifte + if ${1:condition} then ${2:value} else ${3:other} +# Unless +snippet unl + ${1:action} unless ${2:condition} +# Switch +snippet swi + switch ${1:object} + when ${2:value} + ${3:// body...} + +# Log +snippet log + console.log ${1} +# Try __ Catch +snippet try + try + ${1} + catch ${2:error} + ${3} +# Require +snippet req + ${2:$1} = require '${1:sys}'${3} +# Export +snippet exp + ${1:root} = exports ? this diff --git a/lib/ace/snippets/cpp.snippets b/lib/ace/snippets/cpp.snippets new file mode 100644 index 00000000..c3e19fe9 --- /dev/null +++ b/lib/ace/snippets/cpp.snippets @@ -0,0 +1,131 @@ +## STL Collections +# std::array +snippet array + std::array<${1:T}, ${2:N}> ${3};${4} +# std::vector +snippet vector + std::vector<${1:T}> ${2};${3} +# std::deque +snippet deque + std::deque<${1:T}> ${2};${3} +# std::forward_list +snippet flist + std::forward_list<${1:T}> ${2};${3} +# std::list +snippet list + std::list<${1:T}> ${2};${3} +# std::set +snippet set + std::set<${1:T}> ${2};${3} +# std::map +snippet map + std::map<${1:Key}, ${2:T}> ${3};${4} +# std::multiset +snippet mset + std::multiset<${1:T}> ${2};${3} +# std::multimap +snippet mmap + std::multimap<${1:Key}, ${2:T}> ${3};${4} +# std::unordered_set +snippet uset + std::unordered_set<${1:T}> ${2};${3} +# std::unordered_map +snippet umap + std::unordered_map<${1:Key}, ${2:T}> ${3};${4} +# std::unordered_multiset +snippet umset + std::unordered_multiset<${1:T}> ${2};${3} +# std::unordered_multimap +snippet ummap + std::unordered_multimap<${1:Key}, ${2:T}> ${3};${4} +# std::stack +snippet stack + std::stack<${1:T}> ${2};${3} +# std::queue +snippet queue + std::queue<${1:T}> ${2};${3} +# std::priority_queue +snippet pqueue + std::priority_queue<${1:T}> ${2};${3} +## +## Access Modifiers +# private +snippet pri + private +# protected +snippet pro + protected +# public +snippet pub + public +# friend +snippet fr + friend +# mutable +snippet mu + mutable +## +## Class +# class +snippet cl + class ${1:`Filename('$1', 'name')`} + { + public: + $1(${2}); + ~$1(); + + private: + ${3:/* data */} + }; +# member function implementation +snippet mfun + ${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { + ${5:/* code */} + } +# namespace +snippet ns + namespace ${1:`Filename('', 'my')`} { + ${2} + } /* namespace $1 */ +## +## Input/Output +# std::cout +snippet cout + std::cout << ${1} << std::endl;${2} +# std::cin +snippet cin + std::cin >> ${1};${2} +## +## Iteration +# for i +snippet fori + for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { + ${4:/* code */} + }${5} + +# foreach +snippet fore + for (${1:auto} ${2:i} : ${3:container}) { + ${4:/* code */} + }${5} +# iterator +snippet iter + for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) { + ${6} + }${7} + +# auto iterator +snippet itera + for (auto ${1:i} = $1.begin(); $1 != $1.end(); ++$1) { + ${2:std::cout << *$1 << std::endl;} + }${3} +## +## Lambdas +# lamda (one line) +snippet ld + [${1}](${2}){${3:/* code */}}${4} +# lambda (multi-line) +snippet lld + [${1}](${2}){ + ${3:/* code */} + }${4} diff --git a/lib/ace/snippets/cs.snippets b/lib/ace/snippets/cs.snippets new file mode 100644 index 00000000..725f8b7d --- /dev/null +++ b/lib/ace/snippets/cs.snippets @@ -0,0 +1,374 @@ +# cs.snippets +# =========== +# +# Standard C-Sharp snippets for snipmate. +# +# Largely ported over from Visual Studio 2010 snippets plus +# a few snippets from Resharper plus a few widely known snippets. +# +# Most snippets on elements (i.e. classes, properties) +# follow suffix conventions. The order of suffixes to a snippet +# is fixed. +# +# Snippet Suffix Order +# -------------------- +# 1. Access Modifiers +# 2. Class Modifiers +# +# Access Modifier Suffix Table +# ---------------------------- +# + = public +# & = internal +# | = protected +# - = private +# +# Example: `cls&` expands to `internal class $1`. +# Access modifiers might be doubled to indicate +# different modifiers for get/set on properties. +# Example: `pb+-` expands to `public bool $1 { get; private set; }` +# +# Class Modifier Table +# -------------------- +# ^ = static +# % = abstract +# +# Example: `cls|%` expands to `protected abstract class $1` +# +# On method and property snippets, you can directly set +# one of the common types int, string and bool, if desired, +# just by appending the type modifier. +# +# Type Modifier Table +# ------------------- +# i = integer +# s = string +# b = bool +# +# Example: `pi+&` expands to `public int $1 { get; internal set; }` +# +# I'll most propably add more stuff in here like +# * List/Array constructio +# * Mostly used generics +# * Linq +# * Funcs, Actions, Predicates +# * Lambda +# * Events +# +# Feedback is welcome! +# +# entry point +snippet sim + public static int Main(string[] args) { + ${1} + return 0; + } +snippet simc + public class Application { + public static int Main(string[] args) { + ${1} + return 0; + } + } +# if condition +snippet if + if (${1}) { + ${2} + } +snippet el + else { + ${1} + } +snippet ifs + if (${1}) + ${2} +# ternary conditional +snippet t + ${1} ? ${2} : ${3} +snippet ? + ${1} ? ${2} : ${3} +# do while loop +snippet do + do { + ${2} + } while (${1}); +# while loop +snippet wh + while (${1}) { + ${2} + } +# for loop +snippet for + for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++}) { + ${4} + } +# foreach +snippet fore + foreach (var ${1:entry} in ${2}) { + ${3} + } +snippet foreach + foreach (var ${1:entry} in ${2}) { + ${3} + } +snippet each + foreach (var ${1:entry} in ${2}) { + ${3} + } +# interfaces +snippet interface + public interface ${1:`Filename()`} { + ${2} + } +snippet if+ + public interface ${1:`Filename()`} { + ${2} + } +# class bodies +snippet class + public class ${1:`Filename()`} { + ${2} + } +snippet cls + ${2:public} class ${1:`Filename()`} { + ${3} + } +snippet cls+ + public class ${1:`Filename()`} { + ${2} + } +snippet cls+^ + public static class ${1:`Filename()`} { + ${2} + } +snippet cls& + internal class ${1:`Filename()`} { + ${2} + } +snippet cls&^ + internal static class ${1:`Filename()`} { + ${2} + } +snippet cls| + protected class ${1:`Filename()`} { + ${2} + } +snippet cls|% + protected abstract class ${1:`Filename()`} { + ${2} + } +# constructor +snippet ctor + public ${1:`Filename()`}() { + ${2} + } +# properties - auto properties by default. +# default type is int with layout get / set. +snippet prop + ${1:public} ${2:int} ${3:} { get; set; }${4} +snippet p + ${1:public} ${2:int} ${3:} { get; set; }${4} +snippet p+ + public ${1:int} ${2:} { get; set; }${3} +snippet p+& + public ${1:int} ${2:} { get; internal set; }${3} +snippet p+| + public ${1:int} ${2:} { get; protected set; }${3} +snippet p+- + public ${1:int} ${2:} { get; private set; }${3} +snippet p& + internal ${1:int} ${2:} { get; set; }${3} +snippet p&| + internal ${1:int} ${2:} { get; protected set; }${3} +snippet p&- + internal ${1:int} ${2:} { get; private set; }${3} +snippet p| + protected ${1:int} ${2:} { get; set; }${3} +snippet p|- + protected ${1:int} ${2:} { get; private set; }${3} +snippet p- + private ${1:int} ${2:} { get; set; }${3} +# property - bool +snippet pi + ${1:public} int ${2:} { get; set; }${3} +snippet pi+ + public int ${1} { get; set; }${2} +snippet pi+& + public int ${1} { get; internal set; }${2} +snippet pi+| + public int ${1} { get; protected set; }${2} +snippet pi+- + public int ${1} { get; private set; }${2} +snippet pi& + internal int ${1} { get; set; }${2} +snippet pi&| + internal int ${1} { get; protected set; }${2} +snippet pi&- + internal int ${1} { get; private set; }${2} +snippet pi| + protected int ${1} { get; set; }${2} +snippet pi|- + protected int ${1} { get; private set; }${2} +snippet pi- + private int ${1} { get; set; }${2} +# property - bool +snippet pb + ${1:public} bool ${2:} { get; set; }${3} +snippet pb+ + public bool ${1} { get; set; }${2} +snippet pb+& + public bool ${1} { get; internal set; }${2} +snippet pb+| + public bool ${1} { get; protected set; }${2} +snippet pb+- + public bool ${1} { get; private set; }${2} +snippet pb& + internal bool ${1} { get; set; }${2} +snippet pb&| + internal bool ${1} { get; protected set; }${2} +snippet pb&- + internal bool ${1} { get; private set; }${2} +snippet pb| + protected bool ${1} { get; set; }${2} +snippet pb|- + protected bool ${1} { get; private set; }${2} +snippet pb- + private bool ${1} { get; set; }${2} +# property - string +snippet ps + ${1:public} string ${2:} { get; set; }${3} +snippet ps+ + public string ${1} { get; set; }${2} +snippet ps+& + public string ${1} { get; internal set; }${2} +snippet ps+| + public string ${1} { get; protected set; }${2} +snippet ps+- + public string ${1} { get; private set; }${2} +snippet ps& + internal string ${1} { get; set; }${2} +snippet ps&| + internal string ${1} { get; protected set; }${2} +snippet ps&- + internal string ${1} { get; private set; }${2} +snippet ps| + protected string ${1} { get; set; }${2} +snippet ps|- + protected string ${1} { get; private set; }${2} +snippet ps- + private string ${1} { get; set; }${2} +# members - void +snippet m + ${1:public} ${2:void} ${3:}(${4:}) { + ${5:} + } +snippet m+ + public ${1:void} ${2:}(${3:}) { + ${4:} + } +snippet m& + internal ${1:void} ${2:}(${3:}) { + ${4:} + } +snippet m| + protected ${1:void} ${2:}(${3:}) { + ${4:} + } +snippet m- + private ${1:void} ${2:}(${3:}) { + ${4:} + } +# members - int +snippet mi + ${1:public} int ${2:}(${3:}) { + ${4:return 0;} + } +snippet mi+ + public int ${1:}(${2:}) { + ${3:return 0;} + } +snippet mi& + internal int ${1:}(${2:}) { + ${3:return 0;} + } +snippet mi| + protected int ${1:}(${2:}) { + ${3:return 0;} + } +snippet mi- + private int ${1:}(${2:}) { + ${3:return 0;} + } +# members - bool +snippet mb + ${1:public} bool ${2:}(${3:}) { + ${4:return false;} + } +snippet mb+ + public bool ${1:}(${2:}) { + ${3:return false;} + } +snippet mb& + internal bool ${1:}(${2:}) { + ${3:return false;} + } +snippet mb| + protected bool ${1:}(${2:}) { + ${3:return false;} + } +snippet mb- + private bool ${1:}(${2:}) { + ${3:return false;} + } +# members - string +snippet ms + ${1:public} string ${2:}(${3:}) { + ${4:return "";} + } +snippet ms+ + public string ${1:}(${2:}) { + ${3:return "";} + } +snippet ms& + internal string ${1:}(${2:}) { + ${3:return "";} + } +snippet ms| + protected string ${1:}(${2:}) { + ${3:return "";} + } +snippet ms- + private string ${1:}(${2:}) { + ${3:return "";} + } +# structure +snippet struct + public struct ${1:`Filename()`} { + ${2} + } +# enumeration +snippet enum + public enum ${1} { + ${2} + } +# preprocessor directives +snippet #if + #if + ${1} + #endif +# inline xml documentation +snippet /// + /// + /// ${1} + /// +snippet

${2:$1}${3} +snippet ${2}${3} +snippet ${1}{${2} +snippet ${2} +snippet ${1}${2} +snippet ${1}${2} diff --git a/lib/ace/snippets/css.snippets b/lib/ace/snippets/css.snippets new file mode 100644 index 00000000..72212d2d --- /dev/null +++ b/lib/ace/snippets/css.snippets @@ -0,0 +1,967 @@ +snippet . + ${1} { + ${2} + } +snippet ! + !important +snippet bdi:m+ + -moz-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch}; +snippet bdi:m + -moz-border-image: ${1}; +snippet bdrz:m + -moz-border-radius: ${1}; +snippet bxsh:m+ + -moz-box-shadow: ${1:0} ${2:0} ${3:0} #${4:000}; +snippet bxsh:m + -moz-box-shadow: ${1}; +snippet bdi:w+ + -webkit-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch}; +snippet bdi:w + -webkit-border-image: ${1}; +snippet bdrz:w + -webkit-border-radius: ${1}; +snippet bxsh:w+ + -webkit-box-shadow: ${1:0} ${2:0} ${3:0} #${4:000}; +snippet bxsh:w + -webkit-box-shadow: ${1}; +snippet @f + @font-face { + font-family: ${1}; + src: url(${2}); + } +snippet @i + @import url(${1}); +snippet @m + @media ${1:print} { + ${2} + } +snippet bg+ + background: #${1:FFF} url(${2}) ${3:0} ${4:0} ${5:no-repeat}; +snippet bga + background-attachment: ${1}; +snippet bga:f + background-attachment: fixed; +snippet bga:s + background-attachment: scroll; +snippet bgbk + background-break: ${1}; +snippet bgbk:bb + background-break: bounding-box; +snippet bgbk:c + background-break: continuous; +snippet bgbk:eb + background-break: each-box; +snippet bgcp + background-clip: ${1}; +snippet bgcp:bb + background-clip: border-box; +snippet bgcp:cb + background-clip: content-box; +snippet bgcp:nc + background-clip: no-clip; +snippet bgcp:pb + background-clip: padding-box; +snippet bgc + background-color: #${1:FFF}; +snippet bgc:t + background-color: transparent; +snippet bgi + background-image: url(${1}); +snippet bgi:n + background-image: none; +snippet bgo + background-origin: ${1}; +snippet bgo:bb + background-origin: border-box; +snippet bgo:cb + background-origin: content-box; +snippet bgo:pb + background-origin: padding-box; +snippet bgpx + background-position-x: ${1}; +snippet bgpy + background-position-y: ${1}; +snippet bgp + background-position: ${1:0} ${2:0}; +snippet bgr + background-repeat: ${1}; +snippet bgr:n + background-repeat: no-repeat; +snippet bgr:x + background-repeat: repeat-x; +snippet bgr:y + background-repeat: repeat-y; +snippet bgr:r + background-repeat: repeat; +snippet bgz + background-size: ${1}; +snippet bgz:a + background-size: auto; +snippet bgz:ct + background-size: contain; +snippet bgz:cv + background-size: cover; +snippet bg + background: ${1}; +snippet bg:ie + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1}',sizingMethod='${2:crop}'); +snippet bg:n + background: none; +snippet bd+ + border: ${1:1px} ${2:solid} #${3:000}; +snippet bdb+ + border-bottom: ${1:1px} ${2:solid} #${3:000}; +snippet bdbc + border-bottom-color: #${1:000}; +snippet bdbi + border-bottom-image: url(${1}); +snippet bdbi:n + border-bottom-image: none; +snippet bdbli + border-bottom-left-image: url(${1}); +snippet bdbli:c + border-bottom-left-image: continue; +snippet bdbli:n + border-bottom-left-image: none; +snippet bdblrz + border-bottom-left-radius: ${1}; +snippet bdbri + border-bottom-right-image: url(${1}); +snippet bdbri:c + border-bottom-right-image: continue; +snippet bdbri:n + border-bottom-right-image: none; +snippet bdbrrz + border-bottom-right-radius: ${1}; +snippet bdbs + border-bottom-style: ${1}; +snippet bdbs:n + border-bottom-style: none; +snippet bdbw + border-bottom-width: ${1}; +snippet bdb + border-bottom: ${1}; +snippet bdb:n + border-bottom: none; +snippet bdbk + border-break: ${1}; +snippet bdbk:c + border-break: close; +snippet bdcl + border-collapse: ${1}; +snippet bdcl:c + border-collapse: collapse; +snippet bdcl:s + border-collapse: separate; +snippet bdc + border-color: #${1:000}; +snippet bdci + border-corner-image: url(${1}); +snippet bdci:c + border-corner-image: continue; +snippet bdci:n + border-corner-image: none; +snippet bdf + border-fit: ${1}; +snippet bdf:c + border-fit: clip; +snippet bdf:of + border-fit: overwrite; +snippet bdf:ow + border-fit: overwrite; +snippet bdf:r + border-fit: repeat; +snippet bdf:sc + border-fit: scale; +snippet bdf:sp + border-fit: space; +snippet bdf:st + border-fit: stretch; +snippet bdi + border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch}; +snippet bdi:n + border-image: none; +snippet bdl+ + border-left: ${1:1px} ${2:solid} #${3:000}; +snippet bdlc + border-left-color: #${1:000}; +snippet bdli + border-left-image: url(${1}); +snippet bdli:n + border-left-image: none; +snippet bdls + border-left-style: ${1}; +snippet bdls:n + border-left-style: none; +snippet bdlw + border-left-width: ${1}; +snippet bdl + border-left: ${1}; +snippet bdl:n + border-left: none; +snippet bdlt + border-length: ${1}; +snippet bdlt:a + border-length: auto; +snippet bdrz + border-radius: ${1}; +snippet bdr+ + border-right: ${1:1px} ${2:solid} #${3:000}; +snippet bdrc + border-right-color: #${1:000}; +snippet bdri + border-right-image: url(${1}); +snippet bdri:n + border-right-image: none; +snippet bdrs + border-right-style: ${1}; +snippet bdrs:n + border-right-style: none; +snippet bdrw + border-right-width: ${1}; +snippet bdr + border-right: ${1}; +snippet bdr:n + border-right: none; +snippet bdsp + border-spacing: ${1}; +snippet bds + border-style: ${1}; +snippet bds:ds + border-style: dashed; +snippet bds:dtds + border-style: dot-dash; +snippet bds:dtdtds + border-style: dot-dot-dash; +snippet bds:dt + border-style: dotted; +snippet bds:db + border-style: double; +snippet bds:g + border-style: groove; +snippet bds:h + border-style: hidden; +snippet bds:i + border-style: inset; +snippet bds:n + border-style: none; +snippet bds:o + border-style: outset; +snippet bds:r + border-style: ridge; +snippet bds:s + border-style: solid; +snippet bds:w + border-style: wave; +snippet bdt+ + border-top: ${1:1px} ${2:solid} #${3:000}; +snippet bdtc + border-top-color: #${1:000}; +snippet bdti + border-top-image: url(${1}); +snippet bdti:n + border-top-image: none; +snippet bdtli + border-top-left-image: url(${1}); +snippet bdtli:c + border-corner-image: continue; +snippet bdtli:n + border-corner-image: none; +snippet bdtlrz + border-top-left-radius: ${1}; +snippet bdtri + border-top-right-image: url(${1}); +snippet bdtri:c + border-top-right-image: continue; +snippet bdtri:n + border-top-right-image: none; +snippet bdtrrz + border-top-right-radius: ${1}; +snippet bdts + border-top-style: ${1}; +snippet bdts:n + border-top-style: none; +snippet bdtw + border-top-width: ${1}; +snippet bdt + border-top: ${1}; +snippet bdt:n + border-top: none; +snippet bdw + border-width: ${1}; +snippet bd + border: ${1}; +snippet bd:n + border: none; +snippet b + bottom: ${1}; +snippet b:a + bottom: auto; +snippet bxsh+ + box-shadow: ${1:0} ${2:0} ${3:0} #${4:000}; +snippet bxsh + box-shadow: ${1}; +snippet bxsh:n + box-shadow: none; +snippet bxz + box-sizing: ${1}; +snippet bxz:bb + box-sizing: border-box; +snippet bxz:cb + box-sizing: content-box; +snippet cps + caption-side: ${1}; +snippet cps:b + caption-side: bottom; +snippet cps:t + caption-side: top; +snippet cl + clear: ${1}; +snippet cl:b + clear: both; +snippet cl:l + clear: left; +snippet cl:n + clear: none; +snippet cl:r + clear: right; +snippet cp + clip: ${1}; +snippet cp:a + clip: auto; +snippet cp:r + clip: rect(${1:0} ${2:0} ${3:0} ${4:0}); +snippet c + color: #${1:000}; +snippet ct + content: ${1}; +snippet ct:a + content: attr(${1}); +snippet ct:cq + content: close-quote; +snippet ct:c + content: counter(${1}); +snippet ct:cs + content: counters(${1}); +snippet ct:ncq + content: no-close-quote; +snippet ct:noq + content: no-open-quote; +snippet ct:n + content: normal; +snippet ct:oq + content: open-quote; +snippet coi + counter-increment: ${1}; +snippet cor + counter-reset: ${1}; +snippet cur + cursor: ${1}; +snippet cur:a + cursor: auto; +snippet cur:c + cursor: crosshair; +snippet cur:d + cursor: default; +snippet cur:ha + cursor: hand; +snippet cur:he + cursor: help; +snippet cur:m + cursor: move; +snippet cur:p + cursor: pointer; +snippet cur:t + cursor: text; +snippet d + display: ${1}; +snippet d:mib + display: -moz-inline-box; +snippet d:mis + display: -moz-inline-stack; +snippet d:b + display: block; +snippet d:cp + display: compact; +snippet d:ib + display: inline-block; +snippet d:itb + display: inline-table; +snippet d:i + display: inline; +snippet d:li + display: list-item; +snippet d:n + display: none; +snippet d:ri + display: run-in; +snippet d:tbcp + display: table-caption; +snippet d:tbc + display: table-cell; +snippet d:tbclg + display: table-column-group; +snippet d:tbcl + display: table-column; +snippet d:tbfg + display: table-footer-group; +snippet d:tbhg + display: table-header-group; +snippet d:tbrg + display: table-row-group; +snippet d:tbr + display: table-row; +snippet d:tb + display: table; +snippet ec + empty-cells: ${1}; +snippet ec:h + empty-cells: hide; +snippet ec:s + empty-cells: show; +snippet exp + expression() +snippet fl + float: ${1}; +snippet fl:l + float: left; +snippet fl:n + float: none; +snippet fl:r + float: right; +snippet f+ + font: ${1:1em} ${2:Arial},${3:sans-serif}; +snippet fef + font-effect: ${1}; +snippet fef:eb + font-effect: emboss; +snippet fef:eg + font-effect: engrave; +snippet fef:n + font-effect: none; +snippet fef:o + font-effect: outline; +snippet femp + font-emphasize-position: ${1}; +snippet femp:a + font-emphasize-position: after; +snippet femp:b + font-emphasize-position: before; +snippet fems + font-emphasize-style: ${1}; +snippet fems:ac + font-emphasize-style: accent; +snippet fems:c + font-emphasize-style: circle; +snippet fems:ds + font-emphasize-style: disc; +snippet fems:dt + font-emphasize-style: dot; +snippet fems:n + font-emphasize-style: none; +snippet fem + font-emphasize: ${1}; +snippet ff + font-family: ${1}; +snippet ff:c + font-family: ${1:'Monotype Corsiva','Comic Sans MS'},cursive; +snippet ff:f + font-family: ${1:Capitals,Impact},fantasy; +snippet ff:m + font-family: ${1:Monaco,'Courier New'},monospace; +snippet ff:ss + font-family: ${1:Helvetica,Arial},sans-serif; +snippet ff:s + font-family: ${1:Georgia,'Times New Roman'},serif; +snippet fza + font-size-adjust: ${1}; +snippet fza:n + font-size-adjust: none; +snippet fz + font-size: ${1}; +snippet fsm + font-smooth: ${1}; +snippet fsm:aw + font-smooth: always; +snippet fsm:a + font-smooth: auto; +snippet fsm:n + font-smooth: never; +snippet fst + font-stretch: ${1}; +snippet fst:c + font-stretch: condensed; +snippet fst:e + font-stretch: expanded; +snippet fst:ec + font-stretch: extra-condensed; +snippet fst:ee + font-stretch: extra-expanded; +snippet fst:n + font-stretch: normal; +snippet fst:sc + font-stretch: semi-condensed; +snippet fst:se + font-stretch: semi-expanded; +snippet fst:uc + font-stretch: ultra-condensed; +snippet fst:ue + font-stretch: ultra-expanded; +snippet fs + font-style: ${1}; +snippet fs:i + font-style: italic; +snippet fs:n + font-style: normal; +snippet fs:o + font-style: oblique; +snippet fv + font-variant: ${1}; +snippet fv:n + font-variant: normal; +snippet fv:sc + font-variant: small-caps; +snippet fw + font-weight: ${1}; +snippet fw:b + font-weight: bold; +snippet fw:br + font-weight: bolder; +snippet fw:lr + font-weight: lighter; +snippet fw:n + font-weight: normal; +snippet f + font: ${1}; +snippet h + height: ${1}; +snippet h:a + height: auto; +snippet l + left: ${1}; +snippet l:a + left: auto; +snippet lts + letter-spacing: ${1}; +snippet lh + line-height: ${1}; +snippet lisi + list-style-image: url(${1}); +snippet lisi:n + list-style-image: none; +snippet lisp + list-style-position: ${1}; +snippet lisp:i + list-style-position: inside; +snippet lisp:o + list-style-position: outside; +snippet list + list-style-type: ${1}; +snippet list:c + list-style-type: circle; +snippet list:dclz + list-style-type: decimal-leading-zero; +snippet list:dc + list-style-type: decimal; +snippet list:d + list-style-type: disc; +snippet list:lr + list-style-type: lower-roman; +snippet list:n + list-style-type: none; +snippet list:s + list-style-type: square; +snippet list:ur + list-style-type: upper-roman; +snippet lis + list-style: ${1}; +snippet lis:n + list-style: none; +snippet mb + margin-bottom: ${1}; +snippet mb:a + margin-bottom: auto; +snippet ml + margin-left: ${1}; +snippet ml:a + margin-left: auto; +snippet mr + margin-right: ${1}; +snippet mr:a + margin-right: auto; +snippet mt + margin-top: ${1}; +snippet mt:a + margin-top: auto; +snippet m + margin: ${1}; +snippet m:4 + margin: ${1:0} ${2:0} ${3:0} ${4:0}; +snippet m:3 + margin: ${1:0} ${2:0} ${3:0}; +snippet m:2 + margin: ${1:0} ${2:0}; +snippet m:0 + margin: 0; +snippet m:a + margin: auto; +snippet mah + max-height: ${1}; +snippet mah:n + max-height: none; +snippet maw + max-width: ${1}; +snippet maw:n + max-width: none; +snippet mih + min-height: ${1}; +snippet miw + min-width: ${1}; +snippet op + opacity: ${1}; +snippet op:ie + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=${1:100}); +snippet op:ms + -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=${1:100})'; +snippet orp + orphans: ${1}; +snippet o+ + outline: ${1:1px} ${2:solid} #${3:000}; +snippet oc + outline-color: ${1:#000}; +snippet oc:i + outline-color: invert; +snippet oo + outline-offset: ${1}; +snippet os + outline-style: ${1}; +snippet ow + outline-width: ${1}; +snippet o + outline: ${1}; +snippet o:n + outline: none; +snippet ovs + overflow-style: ${1}; +snippet ovs:a + overflow-style: auto; +snippet ovs:mq + overflow-style: marquee; +snippet ovs:mv + overflow-style: move; +snippet ovs:p + overflow-style: panner; +snippet ovs:s + overflow-style: scrollbar; +snippet ovx + overflow-x: ${1}; +snippet ovx:a + overflow-x: auto; +snippet ovx:h + overflow-x: hidden; +snippet ovx:s + overflow-x: scroll; +snippet ovx:v + overflow-x: visible; +snippet ovy + overflow-y: ${1}; +snippet ovy:a + overflow-y: auto; +snippet ovy:h + overflow-y: hidden; +snippet ovy:s + overflow-y: scroll; +snippet ovy:v + overflow-y: visible; +snippet ov + overflow: ${1}; +snippet ov:a + overflow: auto; +snippet ov:h + overflow: hidden; +snippet ov:s + overflow: scroll; +snippet ov:v + overflow: visible; +snippet pb + padding-bottom: ${1}; +snippet pl + padding-left: ${1}; +snippet pr + padding-right: ${1}; +snippet pt + padding-top: ${1}; +snippet p + padding: ${1}; +snippet p:4 + padding: ${1:0} ${2:0} ${3:0} ${4:0}; +snippet p:3 + padding: ${1:0} ${2:0} ${3:0}; +snippet p:2 + padding: ${1:0} ${2:0}; +snippet p:0 + padding: 0; +snippet pgba + page-break-after: ${1}; +snippet pgba:aw + page-break-after: always; +snippet pgba:a + page-break-after: auto; +snippet pgba:l + page-break-after: left; +snippet pgba:r + page-break-after: right; +snippet pgbb + page-break-before: ${1}; +snippet pgbb:aw + page-break-before: always; +snippet pgbb:a + page-break-before: auto; +snippet pgbb:l + page-break-before: left; +snippet pgbb:r + page-break-before: right; +snippet pgbi + page-break-inside: ${1}; +snippet pgbi:a + page-break-inside: auto; +snippet pgbi:av + page-break-inside: avoid; +snippet pos + position: ${1}; +snippet pos:a + position: absolute; +snippet pos:f + position: fixed; +snippet pos:r + position: relative; +snippet pos:s + position: static; +snippet q + quotes: ${1}; +snippet q:en + quotes: '\201C' '\201D' '\2018' '\2019'; +snippet q:n + quotes: none; +snippet q:ru + quotes: '\00AB' '\00BB' '\201E' '\201C'; +snippet rz + resize: ${1}; +snippet rz:b + resize: both; +snippet rz:h + resize: horizontal; +snippet rz:n + resize: none; +snippet rz:v + resize: vertical; +snippet r + right: ${1}; +snippet r:a + right: auto; +snippet tbl + table-layout: ${1}; +snippet tbl:a + table-layout: auto; +snippet tbl:f + table-layout: fixed; +snippet tal + text-align-last: ${1}; +snippet tal:a + text-align-last: auto; +snippet tal:c + text-align-last: center; +snippet tal:l + text-align-last: left; +snippet tal:r + text-align-last: right; +snippet ta + text-align: ${1}; +snippet ta:c + text-align: center; +snippet ta:l + text-align: left; +snippet ta:r + text-align: right; +snippet td + text-decoration: ${1}; +snippet td:l + text-decoration: line-through; +snippet td:n + text-decoration: none; +snippet td:o + text-decoration: overline; +snippet td:u + text-decoration: underline; +snippet te + text-emphasis: ${1}; +snippet te:ac + text-emphasis: accent; +snippet te:a + text-emphasis: after; +snippet te:b + text-emphasis: before; +snippet te:c + text-emphasis: circle; +snippet te:ds + text-emphasis: disc; +snippet te:dt + text-emphasis: dot; +snippet te:n + text-emphasis: none; +snippet th + text-height: ${1}; +snippet th:a + text-height: auto; +snippet th:f + text-height: font-size; +snippet th:m + text-height: max-size; +snippet th:t + text-height: text-size; +snippet ti + text-indent: ${1}; +snippet ti:- + text-indent: -9999px; +snippet tj + text-justify: ${1}; +snippet tj:a + text-justify: auto; +snippet tj:d + text-justify: distribute; +snippet tj:ic + text-justify: inter-cluster; +snippet tj:ii + text-justify: inter-ideograph; +snippet tj:iw + text-justify: inter-word; +snippet tj:k + text-justify: kashida; +snippet tj:t + text-justify: tibetan; +snippet to+ + text-outline: ${1:0} ${2:0} #${3:000}; +snippet to + text-outline: ${1}; +snippet to:n + text-outline: none; +snippet tr + text-replace: ${1}; +snippet tr:n + text-replace: none; +snippet tsh+ + text-shadow: ${1:0} ${2:0} ${3:0} #${4:000}; +snippet tsh + text-shadow: ${1}; +snippet tsh:n + text-shadow: none; +snippet tt + text-transform: ${1}; +snippet tt:c + text-transform: capitalize; +snippet tt:l + text-transform: lowercase; +snippet tt:n + text-transform: none; +snippet tt:u + text-transform: uppercase; +snippet tw + text-wrap: ${1}; +snippet tw:no + text-wrap: none; +snippet tw:n + text-wrap: normal; +snippet tw:s + text-wrap: suppress; +snippet tw:u + text-wrap: unrestricted; +snippet t + top: ${1}; +snippet t:a + top: auto; +snippet va + vertical-align: ${1}; +snippet va:bl + vertical-align: baseline; +snippet va:b + vertical-align: bottom; +snippet va:m + vertical-align: middle; +snippet va:sub + vertical-align: sub; +snippet va:sup + vertical-align: super; +snippet va:tb + vertical-align: text-bottom; +snippet va:tt + vertical-align: text-top; +snippet va:t + vertical-align: top; +snippet v + visibility: ${1}; +snippet v:c + visibility: collapse; +snippet v:h + visibility: hidden; +snippet v:v + visibility: visible; +snippet whsc + white-space-collapse: ${1}; +snippet whsc:ba + white-space-collapse: break-all; +snippet whsc:bs + white-space-collapse: break-strict; +snippet whsc:k + white-space-collapse: keep-all; +snippet whsc:l + white-space-collapse: loose; +snippet whsc:n + white-space-collapse: normal; +snippet whs + white-space: ${1}; +snippet whs:n + white-space: normal; +snippet whs:nw + white-space: nowrap; +snippet whs:pl + white-space: pre-line; +snippet whs:pw + white-space: pre-wrap; +snippet whs:p + white-space: pre; +snippet wid + widows: ${1}; +snippet w + width: ${1}; +snippet w:a + width: auto; +snippet wob + word-break: ${1}; +snippet wob:ba + word-break: break-all; +snippet wob:bs + word-break: break-strict; +snippet wob:k + word-break: keep-all; +snippet wob:l + word-break: loose; +snippet wob:n + word-break: normal; +snippet wos + word-spacing: ${1}; +snippet wow + word-wrap: ${1}; +snippet wow:no + word-wrap: none; +snippet wow:n + word-wrap: normal; +snippet wow:s + word-wrap: suppress; +snippet wow:u + word-wrap: unrestricted; +snippet z + z-index: ${1}; +snippet z:a + z-index: auto; +snippet zoo + zoom: 1; diff --git a/lib/ace/snippets/dart.snippets b/lib/ace/snippets/dart.snippets new file mode 100644 index 00000000..6f0b8ac5 --- /dev/null +++ b/lib/ace/snippets/dart.snippets @@ -0,0 +1,82 @@ +snippet lib + #library('${1}'); + ${2} +snippet im + #import('${1}'); + ${2} +snippet so + #source('${1}'); + ${2} +snippet main + static void main() { + ${1:/* code */} + } +snippet st + static ${1} +snippet fi + final ${1} +snippet re + return ${1} +snippet br + break; +snippet th + throw ${1} +snippet cl + class ${1:`Filename("", "untitled")`} ${2} +snippet in + interface ${1:`Filename("", "untitled")`} ${2} +snippet imp + implements ${1} +snippet ext + extends ${1} +snippet if + if (${1:true}) { + ${2} + } +snippet ife + if (${1:true}) { + ${2} + } else { + ${3} + } +snippet el + else +snippet sw + switch (${1}) { + ${2} + } +snippet cs + case ${1}: + ${2} +snippet de + default: + ${1} +snippet for + for (var ${2:i} = 0, len = ${1:things}.length; $2 < len; ${3:++}$2) { + ${4:$1[$2]} + } +snippet fore + for (final ${2:item} in ${1:itemList}) { + ${3:/* code */} + } +snippet wh + while (${1:/* condition */}) { + ${2:/* code */} + } +snippet dowh + do { + ${2:/* code */} + } while (${1:/* condition */}); +snippet as + assert(${1:/* condition */}); +snippet try + try { + ${2} + } catch (${1:Exception e}) { + } +snippet tryf + try { + ${2} + } catch (${1:Exception e}) { + } finally { + } diff --git a/lib/ace/snippets/diff.snippets b/lib/ace/snippets/diff.snippets new file mode 100644 index 00000000..7ba288de --- /dev/null +++ b/lib/ace/snippets/diff.snippets @@ -0,0 +1,11 @@ +# DEP-3 (http://dep.debian.net/deps/dep3/) style patch header +snippet header DEP-3 style header + Description: ${1} + Origin: ${2:vendor|upstream|other}, ${3:url of the original patch} + Bug: ${4:url in upstream bugtracker} + Forwarded: ${5:no|not-needed|url} + Author: ${6:`g:snips_author`} + Reviewed-by: ${7:name and email} + Last-Update: ${8:`strftime("%Y-%m-%d")`} + Applied-Upstream: ${9:upstream version|url|commit} + diff --git a/lib/ace/snippets/django.snippets b/lib/ace/snippets/django.snippets new file mode 100644 index 00000000..8296cce2 --- /dev/null +++ b/lib/ace/snippets/django.snippets @@ -0,0 +1,108 @@ +# Model Fields + +# Note: Optional arguments are using defaults that match what Django will use +# as a default, e.g. with max_length fields. Doing this as a form of self +# documentation and to make it easy to know whether you should override the +# default or not. + +# Note: Optional arguments that are booleans will use the opposite since you +# can either not specify them, or override them, e.g. auto_now_add=False. + +snippet auto + ${1:FIELDNAME} = models.AutoField(${2}) +snippet bool + ${1:FIELDNAME} = models.BooleanField(${2:default=True}) +snippet char + ${1:FIELDNAME} = models.CharField(max_length=${2}${3:, blank=True}) +snippet comma + ${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=${2}${3:, blank=True}) +snippet date + ${1:FIELDNAME} = models.DateField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True}) +snippet datetime + ${1:FIELDNAME} = models.DateTimeField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True}) +snippet decimal + ${1:FIELDNAME} = models.DecimalField(max_digits=${2}, decimal_places=${3}) +snippet email + ${1:FIELDNAME} = models.EmailField(max_length=${2:75}${3:, blank=True}) +snippet file + ${1:FIELDNAME} = models.FileField(upload_to=${2:path/for/upload}${3:, max_length=100}) +snippet filepath + ${1:FIELDNAME} = models.FilePathField(path=${2:"/abs/path/to/dir"}${3:, max_length=100}${4:, match="*.ext"}${5:, recursive=True}${6:, blank=True, }) +snippet float + ${1:FIELDNAME} = models.FloatField(${2}) +snippet image + ${1:FIELDNAME} = models.ImageField(upload_to=${2:path/for/upload}${3:, height_field=height, width_field=width}${4:, max_length=100}) +snippet int + ${1:FIELDNAME} = models.IntegerField(${2}) +snippet ip + ${1:FIELDNAME} = models.IPAddressField(${2}) +snippet nullbool + ${1:FIELDNAME} = models.NullBooleanField(${2}) +snippet posint + ${1:FIELDNAME} = models.PositiveIntegerField(${2}) +snippet possmallint + ${1:FIELDNAME} = models.PositiveSmallIntegerField(${2}) +snippet slug + ${1:FIELDNAME} = models.SlugField(max_length=${2:50}${3:, blank=True}) +snippet smallint + ${1:FIELDNAME} = models.SmallIntegerField(${2}) +snippet text + ${1:FIELDNAME} = models.TextField(${2:blank=True}) +snippet time + ${1:FIELDNAME} = models.TimeField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True}) +snippet url + ${1:FIELDNAME} = models.URLField(${2:verify_exists=False}${3:, max_length=200}${4:, blank=True}) +snippet xml + ${1:FIELDNAME} = models.XMLField(schema_path=${2:None}${3:, blank=True}) +# Relational Fields +snippet fk + ${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, to_field=''}) +snippet m2m + ${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, symmetrical=False}${6:, through=''}${7:, db_table=''}) +snippet o2o + ${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}${3:, parent_link=True}${4:, related_name=''}${5:, limit_choices_to=}${6:, to_field=''}) + +# Code Skeletons + +snippet form + class ${1:FormName}(forms.Form): + """${2:docstring}""" + ${3} + +snippet model + class ${1:ModelName}(models.Model): + """${2:docstring}""" + ${3} + + class Meta: + ${4} + + def __unicode__(self): + ${5} + + def save(self, force_insert=False, force_update=False): + ${6} + + @models.permalink + def get_absolute_url(self): + return ('${7:view_or_url_name}' ${8}) + +snippet modeladmin + class ${1:ModelName}Admin(admin.ModelAdmin): + ${2} + + admin.site.register($1, $1Admin) + +snippet tabularinline + class ${1:ModelName}Inline(admin.TabularInline): + model = $1 + +snippet stackedinline + class ${1:ModelName}Inline(admin.StackedInline): + model = $1 + +snippet r2r + return render_to_response('${1:template.html}', { + ${2} + }${3:, context_instance=RequestContext(request)} + ) diff --git a/lib/ace/snippets/erlang.snippets b/lib/ace/snippets/erlang.snippets new file mode 100644 index 00000000..acc6fd19 --- /dev/null +++ b/lib/ace/snippets/erlang.snippets @@ -0,0 +1,160 @@ +# module and export all +snippet mod + -module(${1:`Filename('', 'my')`}). + + -compile([export_all]). + + start() -> + ${2} + + stop() -> + ok. +# define directive +snippet def + -define(${1:macro}, ${2:body}).${3} +# export directive +snippet exp + -export([${1:function}/${2:arity}]). +# include directive +snippet inc + -include("${1:file}").${2} +# behavior directive +snippet beh + -behaviour(${1:behaviour}).${2} +# if expression +snippet if + if + ${1:guard} -> + ${2:body} + end +# case expression +snippet case + case ${1:expression} of + ${2:pattern} -> + ${3:body}; + end +# anonymous function +snippet fun + fun (${1:Parameters}) -> ${2:body} end${3} +# try...catch +snippet try + try + ${1} + catch + ${2:_:_} -> ${3:got_some_exception} + end +# record directive +snippet rec + -record(${1:record}, { + ${2:field}=${3:value}}).${4} +# todo comment +snippet todo + %% TODO: ${1} +## Snippets below (starting with '%') are in EDoc format. +## See http://www.erlang.org/doc/apps/edoc/chapter.html#id56887 for more details +# doc comment +snippet %d + %% @doc ${1} +# end of doc comment +snippet %e + %% @end +# specification comment +snippet %s + %% @spec ${1} +# private function marker +snippet %p + %% @private +# OTP application +snippet application + -module(${1:`Filename('', 'my')`}). + + -behaviour(application). + + -export([start/2, stop/1]). + + start(_Type, _StartArgs) -> + case ${2:root_supervisor}:start_link() of + {ok, Pid} -> + {ok, Pid}; + Other -> + {error, Other} + end. + + stop(_State) -> + ok. +# OTP supervisor +snippet supervisor + -module(${1:`Filename('', 'my')`}). + + -behaviour(supervisor). + + %% API + -export([start_link/0]). + + %% Supervisor callbacks + -export([init/1]). + + -define(SERVER, ?MODULE). + + start_link() -> + supervisor:start_link({local, ?SERVER}, ?MODULE, []). + + init([]) -> + Server = {${2:my_server}, {$2, start_link, []}, + permanent, 2000, worker, [$2]}, + Children = [Server], + RestartStrategy = {one_for_one, 0, 1}, + {ok, {RestartStrategy, Children}}. +# OTP gen_server +snippet gen_server + -module(${1:`Filename('', 'my')`}). + + -behaviour(gen_server). + + %% API + -export([ + start_link/0 + ]). + + %% gen_server callbacks + -export([init/1, handle_call/3, handle_cast/2, handle_info/2, + terminate/2, code_change/3]). + + -define(SERVER, ?MODULE). + + -record(state, {}). + + %%%=================================================================== + %%% API + %%%=================================================================== + + start_link() -> + gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). + + %%%=================================================================== + %%% gen_server callbacks + %%%=================================================================== + + init([]) -> + {ok, #state{}}. + + handle_call(_Request, _From, State) -> + Reply = ok, + {reply, Reply, State}. + + handle_cast(_Msg, State) -> + {noreply, State}. + + handle_info(_Info, State) -> + {noreply, State}. + + terminate(_Reason, _State) -> + ok. + + code_change(_OldVsn, State, _Extra) -> + {ok, State}. + + %%%=================================================================== + %%% Internal functions + %%%=================================================================== + diff --git a/lib/ace/snippets/eruby.snippets b/lib/ace/snippets/eruby.snippets new file mode 100644 index 00000000..f96ca846 --- /dev/null +++ b/lib/ace/snippets/eruby.snippets @@ -0,0 +1,113 @@ +# .erb and .rhmtl files + +# Includes html.snippets + +# Rails ***************************** +snippet rc + <% ${1} %> +snippet rce + <%= ${1} %>${2} +snippet % + <% ${1} %> +snippet = + <%= ${1} %>${2} +snippet end + <% end %>${1} +snippet ead + <% ${1}.each do |${2}| %> + ${3} + <% end %> +snippet for + <% for ${2:item} in ${1} %> + ${3} + <% end %> +snippet rp + <%= render :partial => '${1:item}' %> +snippet rpl + <%= render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'$4 } %> +snippet rps + <%= render :partial => '${1:item}', :status => ${2:500} %> +snippet rpc + <%= render :partial => '${1:item}', :collection => ${2:items} %> +snippet lia + <%= link_to '${1:link text...}', :action => '${2:index}' %> +snippet liai + <%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${3:@item} %> +snippet lic + <%= link_to '${1:link text...}', :controller => '${2:items}' %> +snippet lica + <%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:index}' %> +snippet licai + <%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${4:@item} %> +snippet yield + <%= yield ${1::content_symbol} %>${2} +snippet conf + <% content_for :${1:head} do %> + ${2} + <% end %> +snippet cs + <%= collection_select <+object+>, <+method+>, <+collection+>, <+value_method+>, <+text_method+><+, <+[options]+>, <+[html_options]+>+> %> +snippet ct + <%= content_tag '${1:DIV}', ${2:content}${3:,options} %> +snippet ff + <% form_for @${1:model} do |f| %> + ${2} + <% end %> +snippet ffcb + <%= ${1:f}.check_box :${2:attribute} %> +snippet ffe + <% error_messages_for :${1:model} %> + + <% form_for @${2:model} do |f| %> + ${3} + <% end %> +snippet ffff + <%= ${1:f}.file_field :${2:attribute} %> +snippet ffhf + <%= ${1:f}.hidden_field :${2:attribute} %> +snippet ffl + <%= ${1:f}.label :${2:attribute}, '${3:$2}' %> +snippet ffpf + <%= ${1:f}.password_field :${2:attribute} %> +snippet ffrb + <%= ${1:f}.radio_button :${2:attribute}, :${3:tag_value} %> +snippet ffs + <%= ${1:f}.submit "${2:submit}" %> +snippet ffta + <%= ${1:f}.text_area :${2:attribute} %> +snippet fftf + <%= ${1:f}.text_field :${2:attribute} %> +snippet fields + <% fields_for :${1:model}, @$1 do |${2:f}| %> + ${3} + <% end %> +snippet i18 + I18n.t('${1:type.key}')${2} +snippet it + <%= image_tag "${1}"${2} %> +snippet jit + <%= javascript_include_tag ${1::all} %> +snippet jsit + <%= javascript_include_tag "${1}" %> +snippet lim + <%= link_to ${1:model}.${2:name}, ${3:$1}_path(${4:$1}) %> +snippet linp + <%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}, ${5:@$3}) %> +snippet linpp + <%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}) %> +snippet lip + <%= link_to "${1:Link text...}", ${2:model}_path(${3:@$2}) %> +snippet lipp + <%= link_to "${1:Link text...}", ${2:model}s_path %> +snippet lt + <%= link_to "${1:name}", ${2:dest} %> +snippet ofcfs + <%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${4:selected_value} %> +snippet rf + <%= render :file => "${1:file}"${2} %> +snippet rt + <%= render :template => "${1:file}"${2} %> +snippet slt + <%= stylesheet_link_tag ${1::all}, :cache => ${2:true} %> +snippet sslt + <%= stylesheet_link_tag "${1}" %> diff --git a/lib/ace/snippets/falcon.snippets b/lib/ace/snippets/falcon.snippets new file mode 100644 index 00000000..85fb918d --- /dev/null +++ b/lib/ace/snippets/falcon.snippets @@ -0,0 +1,71 @@ +snippet #! + #!/usr/bin/env falcon + +# Import +snippet imp + import ${1:module} + +# Function +snippet fun + function ${2:function_name}(${3}) + ${4:/* code */} + end + +# Class +snippet class + class ${1:class_name}(${2:class_params}) + ${3:/* members/methods */} + end + +# If +snippet if + if ${1:condition} + ${2:/* code */} + end + +# If else +snippet ife + if ${1:condition} + ${2:/* code */} + else + ${1} + end + +# If else if +snippet elif + elif ${1:condition} + ${2:/* code */} + +# Switch case +snippet switch + switch ${1:expression} + case ${2:item} + case ${3:item} + default + end + +# Select +snippet select + select ${1:variable} + case ${2:TypeSpec} + case ${3:TypeSpec} + default + end + +# For/in Loop +snippet forin + for ${1:element} in ${2:container} + ${3:/* code */} + end + +# For/to Loop +snippet forto + for ${1:lowerbound} to ${2:upperbound} + ${3:/* code */} + end + +# While Loop +snippet while + while ${1:conidition} + ${2:/* code */} + end diff --git a/lib/ace/snippets/go.snippets b/lib/ace/snippets/go.snippets new file mode 100644 index 00000000..0e4fe61d --- /dev/null +++ b/lib/ace/snippets/go.snippets @@ -0,0 +1,201 @@ +# append +snippet ap + append(${1:slice}, ${2:value}) +# bool +snippet bl + bool +# byte +snippet bt + byte +# break +snippet br + break +# channel +snippet ch + chan ${1:int} +# case +snippet cs + case ${1:value}: + ${2:/* code */} +# const +snippet c + const ${1:NAME} = ${2:0} +# constants with iota +snippet co + const ( + ${1:NAME1} = iota + ${2:NAME2} + ) +# continue +snippet cn + continue +# defer +snippet df + defer ${1:func}() +# defer recover +snippet dfr + defer func() { + if err := recover(); err != nil { + ${1:/* code */} + } + }() +# gpl +snippet gpl + /* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Copyright (C) ${1:Author}, `strftime("%Y")` + */ + + ${2} +# int +snippet i + int +# import +snippet im + import ( + "${1:package}" + ) +# interface +snippet in + interface{} +# full interface snippet +snippet inf + interface ${1:name} { + ${2:/* methods */} + }${3} +# if condition +snippet if + if ${1:/* condition */} { + ${2:/* code */} + } +# else snippet +snippet el + else { + ${1} + } +# error snippet +snippet ir + if err != nil { + return err + } + ${1} +# false +snippet f + false +# fallthrough +snippet ft + fallthrough +# float +snippet fl + float32 +# float32 +snippet f3 + float32 +# float64 +snippet f6 + float64 +# if else +snippet ie + if ${1:/* condition */} { + ${2:/* code */} + } else { + ${3} + } +# for loop +snippet fo + for ${2:i} = 0; $2 < ${1:count}; $2${3:++} { + ${4:/* code */} + } +# for range loop +snippet fr + for ${1:k}, ${2:v} := range ${3} { + ${4:/* code */} + } +# function simple +snippet fun + func ${1:funcName}(${2}) ${3:os.Error} { + ${4:/* code */} + } +# function on receiver +snippet fum + func (self ${1:type}) ${2:funcName}(${3}) ${4:os.Error} { + ${5:/* code */} + } +# make +snippet mk + make(${1:[]string}, ${2:0}) +# map +snippet mp + map[${1:string}]${2:int} +# main() +snippet main + func main() { + ${1:/* code */} + } +# new +snippet nw + new(${1:type}) +# panic +snippet pn + panic("${1:msg}") +# print +snippet pr + fmt.Printf("${1:%s}\n", ${2:var})${3} +# range +snippet rn + range ${1} +# return +snippet rt + return ${1} +# result +snippet rs + result +# select +snippet sl + select { + case ${1:v1} := <-${2:chan1} + ${3:/* code */} + case ${4:v2} := <-${5:chan2} + ${6:/* code */} + default: + ${7:/* code */} + } +# string +snippet sr + string +# struct +snippet st + struct ${1:name} { + ${2:/* data */} + }${4} +# switch +snippet sw + switch ${1:var} { + case ${2:value1}: + ${3:/* code */} + case ${4:value2}: + ${5:/* code */} + default: + ${6:/* code */} + } +snippet sp + fmt.Sprintf("${1:%s}", ${2:var})${3} +# true +snippet t + true +# variable declaration +snippet v + var ${1:t} ${2:string} diff --git a/lib/ace/snippets/haml.snippets b/lib/ace/snippets/haml.snippets new file mode 100644 index 00000000..61e9cf28 --- /dev/null +++ b/lib/ace/snippets/haml.snippets @@ -0,0 +1,20 @@ +snippet t + %table + %tr + %th + ${1:headers} + %tr + %td + ${2:headers} +snippet ul + %ul + %li + ${1:item} + %li +snippet =rp + = render :partial => '${1:partial}' +snippet =rpl + = render :partial => '${1:partial}', :locals => {} +snippet =rpc + = render :partial => '${1:partial}', :collection => @$1 + diff --git a/lib/ace/snippets/haskell.snippets b/lib/ace/snippets/haskell.snippets new file mode 100644 index 00000000..bcda8a5b --- /dev/null +++ b/lib/ace/snippets/haskell.snippets @@ -0,0 +1,82 @@ +snippet lang + {-# LANGUAGE ${1:OverloadedStrings} #-} +snippet info + -- | + -- Module : ${1:Module.Namespace} + -- Copyright : ${2:Author} ${3:2011-2012} + -- License : ${4:BSD3} + -- + -- Maintainer : ${5:email@something.com} + -- Stability : ${6:experimental} + -- Portability : ${7:unknown} + -- + -- ${8:Description} + -- +snippet import + import ${1:Data.Text} +snippet import2 + import ${1:Data.Text} (${2:head}) +snippet importq + import qualified ${1:Data.Text} as ${2:T} +snippet inst + instance ${1:Monoid} ${2:Type} where + ${3} +snippet type + type ${1:Type} = ${2:Type} +snippet data + data ${1:Type} = ${2:$1} ${3:Int} +snippet newtype + newtype ${1:Type} = ${2:$1} ${3:Int} +snippet class + class ${1:Class} a where + ${2} +snippet module + module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` ( + ) where + `expand('%') =~ 'Main' ? "\n\nmain = do\n print \"hello world\"" : ""` + +snippet const + ${1:name} :: ${2:a} + $1 = ${3:undefined} +snippet fn + ${1:fn} :: ${2:a} -> ${3:a} + $1 ${4} = ${5:undefined} +snippet fn2 + ${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} + $1 ${5} = ${6:undefined} +snippet ap + ${1:map} ${2:fn} ${3:list} +snippet do + do + +snippet λ + \${1:x} -> ${2} +snippet \ + \${1:x} -> ${2} +snippet <- + ${1:a} <- ${2:m a} +snippet ← + ${1:a} <- ${2:m a} +snippet -> + ${1:m a} -> ${2:a} +snippet → + ${1:m a} -> ${2:a} +snippet tup + (${1:a}, ${2:b}) +snippet tup2 + (${1:a}, ${2:b}, ${3:c}) +snippet tup3 + (${1:a}, ${2:b}, ${3:c}, ${4:d}) +snippet rec + ${1:Record} { ${2:recFieldA} = ${3:undefined} + , ${4:recFieldB} = ${5:undefined} + } +snippet case + case ${1:something} of + ${2} -> ${3} +snippet let + let ${1} = ${2} + in ${3} +snippet where + where + ${1:fn} = ${2:undefined} diff --git a/lib/ace/snippets/html.snippets b/lib/ace/snippets/html.snippets new file mode 100644 index 00000000..0f75efd0 --- /dev/null +++ b/lib/ace/snippets/html.snippets @@ -0,0 +1,828 @@ +# Some useful Unicode entities +# Non-Breaking Space +snippet nbs +   +# ← +snippet left + ← +# → +snippet right + → +# ↑ +snippet up + ↑ +# ↓ +snippet down + ↓ +# ↩ +snippet return + ↩ +# ⇤ +snippet backtab + ⇤ +# ⇥ +snippet tab + ⇥ +# ⇧ +snippet shift + ⇧ +# ⌃ +snippet ctrl + ⌃ +# ⌅ +snippet enter + ⌅ +# ⌘ +snippet cmd + ⌘ +# ⌥ +snippet option + ⌥ +# ⌦ +snippet delete + ⌦ +# ⌫ +snippet backspace + ⌫ +# ⎋ +snippet esc + ⎋ +# Generic Doctype +snippet doctype HTML 4.01 Strict + +snippet doctype HTML 4.01 Transitional + +snippet doctype HTML 5 + +snippet doctype XHTML 1.0 Frameset + +snippet doctype XHTML 1.0 Strict + +snippet doctype XHTML 1.0 Transitional + +snippet doctype XHTML 1.1 + +# HTML Doctype 4.01 Strict +snippet docts + +# HTML Doctype 4.01 Transitional +snippet doct + +# HTML Doctype 5 +snippet doct5 + +# XHTML Doctype 1.0 Frameset +snippet docxf + +# XHTML Doctype 1.0 Strict +snippet docxs + +# XHTML Doctype 1.0 Transitional +snippet docxt + +# XHTML Doctype 1.1 +snippet docx + +# Attributes +snippet attr + ${1:attribute}="${2:property}" +snippet attr+ + ${1:attribute}="${2:property}" attr+${3} +snippet . + class="${1}"${2} +snippet # + id="${1}"${2} +snippet alt + alt="${1}"${2} +snippet charset + charset="${1:utf-8}"${2} +snippet data + data-${1}="${2:$1}"${3} +snippet for + for="${1}"${2} +snippet height + height="${1}"${2} +snippet href + href="${1:#}"${2} +snippet lang + lang="${1:en}"${2} +snippet media + media="${1}"${2} +snippet name + name="${1}"${2} +snippet rel + rel="${1}"${2} +snippet scope + scope="${1:row}"${2} +snippet src + src="${1}"${2} +snippet title= + title="${1}"${2} +snippet type + type="${1}"${2} +snippet value + value="${1}"${2} +snippet width + width="${1}"${2} +# Elements +snippet a + ${2:$1} +snippet a. + ${3:$1} +snippet a# + ${3:$1} +snippet a:ext + ${2:$1} +snippet a:mail + ${3:email me} +snippet abbr + ${2} +snippet address +

+ ${1} +
+snippet area + ${4} +snippet area+ + ${4} + area+${5} +snippet area:c + ${3} +snippet area:d + ${3} +snippet area:p + ${3} +snippet area:r + ${3} +snippet article +
+ ${1} +
+snippet article. +
+ ${2} +
+snippet article# +
+ ${2} +
+snippet aside + +snippet aside. + +snippet aside# + +snippet audio +