Merge pull request #1192 from ajaxorg/tmSnippets
Add support for TextMate snippets
This commit is contained in:
commit
dd5c9954db
64 changed files with 9881 additions and 215 deletions
|
|
@ -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");
|
||||
})
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ function initDoc(file, path, doc) {
|
|||
var mode = modelist.getModeFromPath(path);
|
||||
session.modeName = mode.name;
|
||||
session.setMode(mode.mode);
|
||||
return session;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
$$------------------------------------
|
||||
# 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}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -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"],
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,20 +13,20 @@
|
|||
|
||||
<!--DEVEL-->
|
||||
<link rel="stylesheet" href="demo/kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8">
|
||||
<script async="true" src="http://use.edgefonts.net/source-code-pro.js"></script>
|
||||
<script async="true" src="http://use.edgefonts.net/source-code-pro.js"></script>
|
||||
<!--DEVEL-->
|
||||
|
||||
<link href="./doc/site/images/favicon.ico" rel="icon" type="image/x-icon">
|
||||
<!--PACKAGE
|
||||
<link rel="stylesheet" href="kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8">
|
||||
<script async="true" src="http://use.edgefonts.net/source-code-pro.js"></script>
|
||||
<script async="true" src="http://use.edgefonts.net/source-code-pro.js"></script>
|
||||
PACKAGE-->
|
||||
</head>
|
||||
<body>
|
||||
<div id="optionsPanel" style="position:absolute;height:100%;width:260px">
|
||||
<a href="http://ajaxorg.github.com/ace/" >
|
||||
<img id="logo" src="demo/kitchen-sink/logo.png">
|
||||
</a>
|
||||
</a>
|
||||
<div style="position: absolute; overflow: hidden; top:80px; bottom:0">
|
||||
<div style="width: 120%; height:100%; overflow-y: scroll">
|
||||
|
||||
|
|
@ -152,7 +152,7 @@
|
|||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr><td colspan="2">
|
||||
<table id="more-controls">
|
||||
<tr>
|
||||
|
|
@ -274,10 +274,15 @@
|
|||
<input type="checkbox" id="read_only">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="button" value="Edit Snippets", onclick="env.editSnippets()">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
]]
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
|
|
|
|||
793
lib/ace/snippets.js
Normal file
793
lib/ace/snippets.js
Normal file
|
|
@ -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();
|
||||
|
||||
|
||||
});
|
||||
240
lib/ace/snippets/_.snippets
Normal file
240
lib/ace/snippets/_.snippets
Normal file
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
${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
|
||||
157
lib/ace/snippets/actionscript.snippets
Normal file
157
lib/ace/snippets/actionscript.snippets
Normal file
|
|
@ -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...}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
35
lib/ace/snippets/apache.snippets
Normal file
35
lib/ace/snippets/apache.snippets
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# Snippets for code blocks used oftenly in Apache files.
|
||||
# <Directory>
|
||||
snippet dir
|
||||
<Directory ${1:/}>
|
||||
DirectoryIndex ${2:index.html}
|
||||
Order Deny,Allow
|
||||
Deny from All
|
||||
</Directory>
|
||||
# <FilesMatch>
|
||||
snippet filesmatch
|
||||
<FilesMatch "${1:regex}">
|
||||
${2}
|
||||
</FilesMatch>
|
||||
# <IfModule>
|
||||
snippet ifmodule
|
||||
<IfModule ${1:mod_example.c}>
|
||||
${2}
|
||||
</IfModule>
|
||||
# <LimitExcept>
|
||||
snippet limitexcept
|
||||
<LimitExcept ${1:POST GET}>
|
||||
${2}
|
||||
</LimitExcept>
|
||||
# <Proxy>
|
||||
snippet proxy
|
||||
<Proxy ${1:*}>
|
||||
${2}
|
||||
</Proxy>
|
||||
# <VirtualHost>
|
||||
snippet virtualhost
|
||||
<VirtualHost ${1:*}:${2:80}>
|
||||
ServerAdmin ${3:webmaster@example.com}
|
||||
DocumentRoot ${4:/www/example.com}
|
||||
ServerName ${5:www.example.com}
|
||||
</VirtualHost>
|
||||
66
lib/ace/snippets/autoit.snippets
Normal file
66
lib/ace/snippets/autoit.snippets
Normal file
|
|
@ -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)
|
||||
235
lib/ace/snippets/c.snippets
Normal file
235
lib/ace/snippets/c.snippets
Normal file
|
|
@ -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}
|
||||
204
lib/ace/snippets/chef.snippets
Normal file
204
lib/ace/snippets/chef.snippets
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
# Opscode Chef Cookbook Recipe Resources
|
||||
# Snippet by: Mike Smullin <mike@smullindesign.com>
|
||||
# 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
|
||||
90
lib/ace/snippets/clojure.snippets
Normal file
90
lib/ace/snippets/clojure.snippets
Normal file
|
|
@ -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})
|
||||
58
lib/ace/snippets/cmake.snippets
Normal file
58
lib/ace/snippets/cmake.snippets
Normal file
|
|
@ -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"}
|
||||
)
|
||||
95
lib/ace/snippets/coffee.snippets
Normal file
95
lib/ace/snippets/coffee.snippets
Normal file
|
|
@ -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
|
||||
131
lib/ace/snippets/cpp.snippets
Normal file
131
lib/ace/snippets/cpp.snippets
Normal file
|
|
@ -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}
|
||||
374
lib/ace/snippets/cs.snippets
Normal file
374
lib/ace/snippets/cs.snippets
Normal file
|
|
@ -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 ///
|
||||
/// <summary>
|
||||
/// ${1}
|
||||
/// </summary>
|
||||
snippet <p
|
||||
<param name="${1}">${2:$1}</param>${3}
|
||||
snippet <ex
|
||||
<exception cref="${1:System.Exception}">${2}</exception>${3}
|
||||
snippet <r
|
||||
<returns>${1}</returns>{${2}
|
||||
snippet <s
|
||||
<see cref="${1}"/>${2}
|
||||
snippet <rem
|
||||
<remarks>${1}</remarks>${2}
|
||||
snippet <c
|
||||
<code>${1}</code>${2}
|
||||
967
lib/ace/snippets/css.snippets
Normal file
967
lib/ace/snippets/css.snippets
Normal file
|
|
@ -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;
|
||||
82
lib/ace/snippets/dart.snippets
Normal file
82
lib/ace/snippets/dart.snippets
Normal file
|
|
@ -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 {
|
||||
}
|
||||
11
lib/ace/snippets/diff.snippets
Normal file
11
lib/ace/snippets/diff.snippets
Normal file
|
|
@ -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}
|
||||
|
||||
108
lib/ace/snippets/django.snippets
Normal file
108
lib/ace/snippets/django.snippets
Normal file
|
|
@ -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)}
|
||||
)
|
||||
160
lib/ace/snippets/erlang.snippets
Normal file
160
lib/ace/snippets/erlang.snippets
Normal file
|
|
@ -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
|
||||
%%%===================================================================
|
||||
|
||||
113
lib/ace/snippets/eruby.snippets
Normal file
113
lib/ace/snippets/eruby.snippets
Normal file
|
|
@ -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}" %>
|
||||
71
lib/ace/snippets/falcon.snippets
Normal file
71
lib/ace/snippets/falcon.snippets
Normal file
|
|
@ -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
|
||||
201
lib/ace/snippets/go.snippets
Normal file
201
lib/ace/snippets/go.snippets
Normal file
|
|
@ -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}
|
||||
20
lib/ace/snippets/haml.snippets
Normal file
20
lib/ace/snippets/haml.snippets
Normal file
|
|
@ -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
|
||||
|
||||
82
lib/ace/snippets/haskell.snippets
Normal file
82
lib/ace/snippets/haskell.snippets
Normal file
|
|
@ -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}
|
||||
828
lib/ace/snippets/html.snippets
Normal file
828
lib/ace/snippets/html.snippets
Normal file
|
|
@ -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
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
snippet doctype HTML 4.01 Transitional
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
snippet doctype HTML 5
|
||||
<!DOCTYPE HTML>
|
||||
snippet doctype XHTML 1.0 Frameset
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
snippet doctype XHTML 1.0 Strict
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
snippet doctype XHTML 1.0 Transitional
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
snippet doctype XHTML 1.1
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
# HTML Doctype 4.01 Strict
|
||||
snippet docts
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
# HTML Doctype 4.01 Transitional
|
||||
snippet doct
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
# HTML Doctype 5
|
||||
snippet doct5
|
||||
<!DOCTYPE HTML>
|
||||
# XHTML Doctype 1.0 Frameset
|
||||
snippet docxf
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
||||
# XHTML Doctype 1.0 Strict
|
||||
snippet docxs
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
# XHTML Doctype 1.0 Transitional
|
||||
snippet docxt
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
# XHTML Doctype 1.1
|
||||
snippet docx
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
# 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
|
||||
<a href="${1:#}">${2:$1}</a>
|
||||
snippet a.
|
||||
<a class="${1}" href="${2:#}">${3:$1}</a>
|
||||
snippet a#
|
||||
<a id="${1}" href="${2:#}">${3:$1}</a>
|
||||
snippet a:ext
|
||||
<a href="http://${1:example.com}">${2:$1}</a>
|
||||
snippet a:mail
|
||||
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
|
||||
snippet abbr
|
||||
<abbr title="${1}">${2}</abbr>
|
||||
snippet address
|
||||
<address>
|
||||
${1}
|
||||
</address>
|
||||
snippet area
|
||||
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}" />
|
||||
snippet area+
|
||||
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}" />
|
||||
area+${5}
|
||||
snippet area:c
|
||||
<area shape="circle" coords="${1}" href="${2}" alt="${3}" />
|
||||
snippet area:d
|
||||
<area shape="default" coords="${1}" href="${2}" alt="${3}" />
|
||||
snippet area:p
|
||||
<area shape="poly" coords="${1}" href="${2}" alt="${3}" />
|
||||
snippet area:r
|
||||
<area shape="rect" coords="${1}" href="${2}" alt="${3}" />
|
||||
snippet article
|
||||
<article>
|
||||
${1}
|
||||
</article>
|
||||
snippet article.
|
||||
<article class="${1}">
|
||||
${2}
|
||||
</article>
|
||||
snippet article#
|
||||
<article id="${1}">
|
||||
${2}
|
||||
</article>
|
||||
snippet aside
|
||||
<aside>
|
||||
${1}
|
||||
</aside>
|
||||
snippet aside.
|
||||
<aside class="${1}">
|
||||
${2}
|
||||
</aside>
|
||||
snippet aside#
|
||||
<aside id="${1}">
|
||||
${2}
|
||||
</aside>
|
||||
snippet audio
|
||||
<audio src="${1}>${2}</audio>
|
||||
snippet b
|
||||
<b>${1}</b>
|
||||
snippet base
|
||||
<base href="${1}" target="${2}" />
|
||||
snippet bdi
|
||||
<bdi>${1}</bdo>
|
||||
snippet bdo
|
||||
<bdo dir="${1}">${2}</bdo>
|
||||
snippet bdo:l
|
||||
<bdo dir="ltr">${1}</bdo>
|
||||
snippet bdo:r
|
||||
<bdo dir="rtl">${1}</bdo>
|
||||
snippet blockquote
|
||||
<blockquote>
|
||||
${1}
|
||||
</blockquote>
|
||||
snippet body
|
||||
<body>
|
||||
${1}
|
||||
</body>
|
||||
snippet br
|
||||
<br />${1}
|
||||
snippet button
|
||||
<button type="${1:submit}">${2}</button>
|
||||
snippet button.
|
||||
<button class="${1:button}" type="${2:submit}">${3}</button>
|
||||
snippet button#
|
||||
<button id="${1}" type="${2:submit}">${3}</button>
|
||||
snippet button:s
|
||||
<button type="submit">${1}</button>
|
||||
snippet button:r
|
||||
<button type="reset">${1}</button>
|
||||
snippet canvas
|
||||
<canvas>
|
||||
${1}
|
||||
</canvas>
|
||||
snippet caption
|
||||
<caption>${1}</caption>
|
||||
snippet cite
|
||||
<cite>${1}</cite>
|
||||
snippet code
|
||||
<code>${1}</code>
|
||||
snippet col
|
||||
<col />${1}
|
||||
snippet col+
|
||||
<col />
|
||||
col+${1}
|
||||
snippet colgroup
|
||||
<colgroup>
|
||||
${1}
|
||||
</colgroup>
|
||||
snippet colgroup+
|
||||
<colgroup>
|
||||
<col />
|
||||
col+${1}
|
||||
</colgroup>
|
||||
snippet command
|
||||
<command type="command" label="${1}" icon="${2}" />
|
||||
snippet command:c
|
||||
<command type="checkbox" label="${1}" icon="${2}" />
|
||||
snippet command:r
|
||||
<command type="radio" radiogroup="${1}" label="${2}" icon="${3}" />
|
||||
snippet datagrid
|
||||
<datagrid>
|
||||
${1}
|
||||
</datagrid>
|
||||
snippet datalist
|
||||
<datalist>
|
||||
${1}
|
||||
</datalist>
|
||||
snippet datatemplate
|
||||
<datatemplate>
|
||||
${1}
|
||||
</datatemplate>
|
||||
snippet dd
|
||||
<dd>${1}</dd>
|
||||
snippet dd.
|
||||
<dd class="${1}">${2}</dd>
|
||||
snippet dd#
|
||||
<dd id="${1}">${2}</dd>
|
||||
snippet del
|
||||
<del>${1}</del>
|
||||
snippet details
|
||||
<details>${1}</details>
|
||||
snippet dfn
|
||||
<dfn>${1}</dfn>
|
||||
snippet dialog
|
||||
<dialog>
|
||||
${1}
|
||||
</dialog>
|
||||
snippet div
|
||||
<div>
|
||||
${1}
|
||||
</div>
|
||||
snippet div.
|
||||
<div class="${1}">
|
||||
${2}
|
||||
</div>
|
||||
snippet div#
|
||||
<div id="${1}">
|
||||
${2}
|
||||
</div>
|
||||
snippet dl
|
||||
<dl>
|
||||
${1}
|
||||
</dl>
|
||||
snippet dl.
|
||||
<dl class="${1}">
|
||||
${2}
|
||||
</dl>
|
||||
snippet dl#
|
||||
<dl id="${1}">
|
||||
${2}
|
||||
</dl>
|
||||
snippet dl+
|
||||
<dl>
|
||||
<dt>${1}</dt>
|
||||
<dd>${2}</dd>
|
||||
dt+${3}
|
||||
</dl>
|
||||
snippet dt
|
||||
<dt>${1}</dt>
|
||||
snippet dt.
|
||||
<dt class="${1}">${2}</dt>
|
||||
snippet dt#
|
||||
<dt id="${1}">${2}</dt>
|
||||
snippet dt+
|
||||
<dt>${1}</dt>
|
||||
<dd>${2}</dd>
|
||||
dt+${3}
|
||||
snippet em
|
||||
<em>${1}</em>
|
||||
snippet embed
|
||||
<embed src=${1} type="${2} />
|
||||
snippet fieldset
|
||||
<fieldset>
|
||||
${1}
|
||||
</fieldset>
|
||||
snippet fieldset.
|
||||
<fieldset class="${1}">
|
||||
${2}
|
||||
</fieldset>
|
||||
snippet fieldset#
|
||||
<fieldset id="${1}">
|
||||
${2}
|
||||
</fieldset>
|
||||
snippet fieldset+
|
||||
<fieldset>
|
||||
<legend><span>${1}</span></legend>
|
||||
${2}
|
||||
</fieldset>
|
||||
fieldset+${3}
|
||||
snippet figcaption
|
||||
<figcaption>${1}</figcaption>
|
||||
snippet figure
|
||||
<figure>${1}</figure>
|
||||
snippet footer
|
||||
<footer>
|
||||
${1}
|
||||
</footer>
|
||||
snippet footer.
|
||||
<footer class="${1}">
|
||||
${2}
|
||||
</footer>
|
||||
snippet footer#
|
||||
<footer id="${1}">
|
||||
${2}
|
||||
</footer>
|
||||
snippet form
|
||||
<form action="${1}" method="${2:get}" accept-charset="utf-8">
|
||||
${3}
|
||||
</form>
|
||||
snippet form.
|
||||
<form class="${1}" action="${2}" method="${3:get}" accept-charset="utf-8">
|
||||
${4}
|
||||
</form>
|
||||
snippet form#
|
||||
<form id="${1}" action="${2}" method="${3:get}" accept-charset="utf-8">
|
||||
${4}
|
||||
</form>
|
||||
snippet h1
|
||||
<h1>${1}</h1>
|
||||
snippet h1.
|
||||
<h1 class="${1}">${2}</h1>
|
||||
snippet h1#
|
||||
<h1 id="${1}">${2}</h1>
|
||||
snippet h2
|
||||
<h2>${1}</h2>
|
||||
snippet h2.
|
||||
<h2 class="${1}">${2}</h2>
|
||||
snippet h2#
|
||||
<h2 id="${1}">${2}</h2>
|
||||
snippet h3
|
||||
<h3>${1}</h3>
|
||||
snippet h3.
|
||||
<h3 class="${1}">${2}</h3>
|
||||
snippet h3#
|
||||
<h3 id="${1}">${2}</h3>
|
||||
snippet h4
|
||||
<h4>${1}</h4>
|
||||
snippet h4.
|
||||
<h4 class="${1}">${2}</h4>
|
||||
snippet h4#
|
||||
<h4 id="${1}">${2}</h4>
|
||||
snippet h5
|
||||
<h5>${1}</h5>
|
||||
snippet h5.
|
||||
<h5 class="${1}">${2}</h5>
|
||||
snippet h5#
|
||||
<h5 id="${1}">${2}</h5>
|
||||
snippet h6
|
||||
<h6>${1}</h6>
|
||||
snippet h6.
|
||||
<h6 class="${1}">${2}</h6>
|
||||
snippet h6#
|
||||
<h6 id="${1}">${2}</h6>
|
||||
snippet head
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
${2}
|
||||
</head>
|
||||
snippet header
|
||||
<header>
|
||||
${1}
|
||||
</header>
|
||||
snippet header.
|
||||
<header class="${1}">
|
||||
${2}
|
||||
</header>
|
||||
snippet header#
|
||||
<header id="${1}">
|
||||
${2}
|
||||
</header>
|
||||
snippet hgroup
|
||||
<hgroup>
|
||||
${1}
|
||||
</hgroup>
|
||||
snippet hgroup.
|
||||
<hgroup class="${1}>
|
||||
${2}
|
||||
</hgroup>
|
||||
snippet hr
|
||||
<hr />${1}
|
||||
snippet html
|
||||
<html>
|
||||
${1}
|
||||
</html>
|
||||
snippet xhtml
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
${1}
|
||||
</html>
|
||||
snippet html5
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
${2:meta}
|
||||
</head>
|
||||
<body>
|
||||
${3:body}
|
||||
</body>
|
||||
</html>
|
||||
snippet i
|
||||
<i>${1}</i>
|
||||
snippet iframe
|
||||
<iframe src="${1}" frameborder="0"></iframe>${2}
|
||||
snippet iframe.
|
||||
<iframe class="${1}" src="${2}" frameborder="0"></iframe>${3}
|
||||
snippet iframe#
|
||||
<iframe id="${1}" src="${2}" frameborder="0"></iframe>${3}
|
||||
snippet img
|
||||
<img src="${1}" alt="${2}" />${3}
|
||||
snippet img.
|
||||
<img class="${1}" src="${2}" alt="${3}" />${4}
|
||||
snippet img#
|
||||
<img id="${1}" src="${2}" alt="${3}" />${4}
|
||||
snippet input
|
||||
<input type="${1:text/submit/hidden/button/image}" name="${2}" id="${3:$2}" value="${4}" />${5}
|
||||
snippet input.
|
||||
<input class="${1}" type="${2:text/submit/hidden/button/image}" name="${3}" id="${4:$3}" value="${5}" />${6}
|
||||
snippet input:text
|
||||
<input type="text" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:submit
|
||||
<input type="submit" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:hidden
|
||||
<input type="hidden" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:button
|
||||
<input type="button" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:image
|
||||
<input type="image" name="${1}" id="${2:$1}" src="${3}" alt="${4}" />${5}
|
||||
snippet input:checkbox
|
||||
<input type="checkbox" name="${1}" id="${2:$1}" />${3}
|
||||
snippet input:radio
|
||||
<input type="radio" name="${1}" id="${2:$1}" />${3}
|
||||
snippet input:color
|
||||
<input type="color" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:date
|
||||
<input type="date" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:datetime
|
||||
<input type="datetime" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:datetime-local
|
||||
<input type="datetime-local" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:email
|
||||
<input type="email" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:file
|
||||
<input type="file" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:month
|
||||
<input type="month" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:number
|
||||
<input type="number" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:password
|
||||
<input type="password" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:range
|
||||
<input type="range" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:reset
|
||||
<input type="reset" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:search
|
||||
<input type="search" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:time
|
||||
<input type="time" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:url
|
||||
<input type="url" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet input:week
|
||||
<input type="week" name="${1}" id="${2:$1}" value="${3}" />${4}
|
||||
snippet ins
|
||||
<ins>${1}</ins>
|
||||
snippet kbd
|
||||
<kbd>${1}</kbd>
|
||||
snippet keygen
|
||||
<keygen>${1}</keygen>
|
||||
snippet label
|
||||
<label for="${2:$1}">${1}</label>
|
||||
snippet label:i
|
||||
<label for="${2:$1}">${1}</label>
|
||||
<input type="${3:text/submit/hidden/button}" name="${4:$2}" id="${5:$2}" value="${6}" />${7}
|
||||
snippet label:s
|
||||
<label for="${2:$1}">${1}</label>
|
||||
<select name="${3:$2}" id="${4:$2}">
|
||||
<option value="${5}">${6:$5}</option>
|
||||
</select>
|
||||
snippet legend
|
||||
<legend>${1}</legend>
|
||||
snippet legend+
|
||||
<legend><span>${1}</span></legend>
|
||||
snippet li
|
||||
<li>${1}</li>
|
||||
snippet li.
|
||||
<li class="${1}">${2}</li>
|
||||
snippet li+
|
||||
<li>${1}</li>
|
||||
li+${2}
|
||||
snippet lia
|
||||
<li><a href="${2:#}">${1}</a></li>
|
||||
snippet lia+
|
||||
<li><a href="${2:#}">${1}</a></li>
|
||||
lia+${3}
|
||||
snippet link
|
||||
<link rel="${1}" href="${2}" title="${3}" type="${4}" />${5}
|
||||
snippet link:atom
|
||||
<link rel="alternate" href="${1:atom.xml}" title="Atom" type="application/atom+xml" />${2}
|
||||
snippet link:css
|
||||
<link rel="stylesheet" href="${2:style.css}" type="text/css" media="${3:all}" />${4}
|
||||
snippet link:favicon
|
||||
<link rel="shortcut icon" href="${1:favicon.ico}" type="image/x-icon" />${2}
|
||||
snippet link:rss
|
||||
<link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml" />${2}
|
||||
snippet link:touch
|
||||
<link rel="apple-touch-icon" href="${1:favicon.png}" />${2}
|
||||
snippet map
|
||||
<map name="${1}">
|
||||
${2}
|
||||
</map>
|
||||
snippet map.
|
||||
<map class="${1}" name="${2}">
|
||||
${3}
|
||||
</map>
|
||||
snippet map#
|
||||
<map name="${1}" id="${2:$1}>
|
||||
${3}
|
||||
</map>
|
||||
snippet map+
|
||||
<map name="${1}">
|
||||
<area shape="${2}" coords="${3}" href="${4}" alt="${5}" />${6}
|
||||
</map>${7}
|
||||
snippet mark
|
||||
<mark>${1}</mark>
|
||||
snippet menu
|
||||
<menu>
|
||||
${1}
|
||||
</menu>
|
||||
snippet menu:c
|
||||
<menu type="context">
|
||||
${1}
|
||||
</menu>
|
||||
snippet menu:t
|
||||
<menu type="toolbar">
|
||||
${1}
|
||||
</menu>
|
||||
snippet meta
|
||||
<meta http-equiv="${1}" content="${2}" />${3}
|
||||
snippet meta:compat
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}" />${3}
|
||||
snippet meta:refresh
|
||||
<meta http-equiv="refresh" content="text/html;charset=UTF-8" />${3}
|
||||
snippet meta:utf
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />${3}
|
||||
snippet meter
|
||||
<meter>${1}</meter>
|
||||
snippet nav
|
||||
<nav>
|
||||
${1}
|
||||
</nav>
|
||||
snippet nav.
|
||||
<nav class="${1}">
|
||||
${2}
|
||||
</nav>
|
||||
snippet nav#
|
||||
<nav id="${1}">
|
||||
${2}
|
||||
</nav>
|
||||
snippet noscript
|
||||
<noscript>
|
||||
${1}
|
||||
</noscript>
|
||||
snippet object
|
||||
<object data="${1}" type="${2}">
|
||||
${3}
|
||||
</object>${4}
|
||||
# Embed QT Movie
|
||||
snippet movie
|
||||
<object width="$2" height="$3" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
|
||||
codebase="http://www.apple.com/qtactivex/qtplugin.cab">
|
||||
<param name="src" value="$1" />
|
||||
<param name="controller" value="$4" />
|
||||
<param name="autoplay" value="$5" />
|
||||
<embed src="${1:movie.mov}"
|
||||
width="${2:320}" height="${3:240}"
|
||||
controller="${4:true}" autoplay="${5:true}"
|
||||
scale="tofit" cache="true"
|
||||
pluginspage="http://www.apple.com/quicktime/download/" />
|
||||
</object>${6}
|
||||
snippet ol
|
||||
<ol>
|
||||
${1}
|
||||
</ol>
|
||||
snippet ol.
|
||||
<ol class="${1}>
|
||||
${2}
|
||||
</ol>
|
||||
snippet ol#
|
||||
<ol id="${1}>
|
||||
${2}
|
||||
</ol>
|
||||
snippet ol+
|
||||
<ol>
|
||||
<li>${1}</li>
|
||||
li+${2}
|
||||
</ol>
|
||||
snippet opt
|
||||
<option value="${1}">${2:$1}</option>
|
||||
snippet opt+
|
||||
<option value="${1}">${2:$1}</option>
|
||||
opt+${3}
|
||||
snippet optt
|
||||
<option>${1}</option>
|
||||
snippet optgroup
|
||||
<optgroup>
|
||||
<option value="${1}">${2:$1}</option>
|
||||
opt+${3}
|
||||
</optgroup>
|
||||
snippet output
|
||||
<output>${1}</output>
|
||||
snippet p
|
||||
<p>${1}</p>
|
||||
snippet param
|
||||
<param name="${1}" value="${2}" />${3}
|
||||
snippet pre
|
||||
<pre>
|
||||
${1}
|
||||
</pre>
|
||||
snippet progress
|
||||
<progress>${1}</progress>
|
||||
snippet q
|
||||
<q>${1}</q>
|
||||
snippet rp
|
||||
<rp>${1}</rp>
|
||||
snippet rt
|
||||
<rt>${1}</rt>
|
||||
snippet ruby
|
||||
<ruby>
|
||||
<rp><rt>${1}</rt></rp>
|
||||
</ruby>
|
||||
snippet s
|
||||
<s>${1}</s>
|
||||
snippet samp
|
||||
<samp>
|
||||
${1}
|
||||
</samp>
|
||||
snippet script
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
${1}
|
||||
</script>
|
||||
snippet scriptsrc
|
||||
<script src="${1}.js" type="text/javascript" charset="utf-8"></script>
|
||||
snippet section
|
||||
<section>
|
||||
${1}
|
||||
</section>
|
||||
snippet section.
|
||||
<section class="${1}">
|
||||
${2}
|
||||
</section>
|
||||
snippet section#
|
||||
<section id="${1}">
|
||||
${2}
|
||||
</section>
|
||||
snippet select
|
||||
<select name="${1}" id="${2:$1}">
|
||||
${3}
|
||||
</select>
|
||||
snippet select.
|
||||
<select name="${1}" id="${2:$1}" class="${3}>
|
||||
${4}
|
||||
</select>
|
||||
snippet select+
|
||||
<select name="${1}" id="${2:$1}">
|
||||
<option value="${3}">${4:$3}</option>
|
||||
opt+${5}
|
||||
</select>
|
||||
snippet small
|
||||
<small>${1}</small>
|
||||
snippet source
|
||||
<source src="${1}" type="${2}" media="${3}" />
|
||||
snippet span
|
||||
<span>${1}</span>
|
||||
snippet strong
|
||||
<strong>${1}</strong>
|
||||
snippet style
|
||||
<style type="text/css" media="${1:all}">
|
||||
${2}
|
||||
</style>
|
||||
snippet sub
|
||||
<sub>${1}</sub>
|
||||
snippet summary
|
||||
<summary>
|
||||
${1}
|
||||
</summary>
|
||||
snippet sup
|
||||
<sup>${1}</sup>
|
||||
snippet table
|
||||
<table border="${1:0}">
|
||||
${2}
|
||||
</table>
|
||||
snippet table.
|
||||
<table class="${1}" border="${2:0}">
|
||||
${3}
|
||||
</table>
|
||||
snippet table#
|
||||
<table id="${1}" border="${2:0}">
|
||||
${3}
|
||||
</table>
|
||||
snippet tbody
|
||||
<tbody>
|
||||
${1}
|
||||
</tbody>
|
||||
snippet td
|
||||
<td>${1}</td>
|
||||
snippet td.
|
||||
<td class="${1}">${2}</td>
|
||||
snippet td#
|
||||
<td id="${1}">${2}</td>
|
||||
snippet td+
|
||||
<td>${1}</td>
|
||||
td+${2}
|
||||
snippet textarea
|
||||
<textarea name="${1}" id=${2:$1} rows="${3:8}" cols="${4:40}">${5}</textarea>${6}
|
||||
snippet tfoot
|
||||
<tfoot>
|
||||
${1}
|
||||
</tfoot>
|
||||
snippet th
|
||||
<th>${1}</th>
|
||||
snippet th.
|
||||
<th class="${1}">${2}</th>
|
||||
snippet th#
|
||||
<th id="${1}">${2}</th>
|
||||
snippet th+
|
||||
<th>${1}</th>
|
||||
th+${2}
|
||||
snippet thead
|
||||
<thead>
|
||||
${1}
|
||||
</thead>
|
||||
snippet time
|
||||
<time datetime="${1}" pubdate="${2:$1}>${3:$1}</time>
|
||||
snippet title
|
||||
<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
snippet tr
|
||||
<tr>
|
||||
${1}
|
||||
</tr>
|
||||
snippet tr+
|
||||
<tr>
|
||||
<td>${1}</td>
|
||||
td+${2}
|
||||
</tr>
|
||||
snippet track
|
||||
<track src="${1}" srclang="${2}" label="${3}" default="${4:default}>${5}</track>${6}
|
||||
snippet ul
|
||||
<ul>
|
||||
${1}
|
||||
</ul>
|
||||
snippet ul.
|
||||
<ul class="${1}">
|
||||
${2}
|
||||
</ul>
|
||||
snippet ul#
|
||||
<ul id="${1}">
|
||||
${2}
|
||||
</ul>
|
||||
snippet ul+
|
||||
<ul>
|
||||
<li>${1}</li>
|
||||
li+${2}
|
||||
</ul>
|
||||
snippet var
|
||||
<var>${1}</var>
|
||||
snippet video
|
||||
<video src="${1} height="${2}" width="${3}" preload="${5:none}" autoplay="${6:autoplay}>${7}</video>${8}
|
||||
snippet wbr
|
||||
<wbr />${1}
|
||||
136
lib/ace/snippets/htmldjango.snippets
Normal file
136
lib/ace/snippets/htmldjango.snippets
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
# Generic tags
|
||||
|
||||
snippet %
|
||||
{% ${1} %}${2}
|
||||
snippet %%
|
||||
{% ${1:tag_name} %}
|
||||
${2}
|
||||
{% end$1 %}
|
||||
snippet {
|
||||
{{ ${1} }}${2}
|
||||
# Template Tags
|
||||
|
||||
snippet autoescape
|
||||
{% autoescape ${1:off} %}
|
||||
${2}
|
||||
{% endautoescape %}
|
||||
snippet block
|
||||
{% block ${1} %}
|
||||
${2}
|
||||
{% endblock %}
|
||||
snippet #
|
||||
{# ${1:comment} #}
|
||||
snippet comment
|
||||
{% comment %}
|
||||
${1}
|
||||
{% endcomment %}
|
||||
snippet cycle
|
||||
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
|
||||
snippet debug
|
||||
{% debug %}
|
||||
snippet extends
|
||||
{% extends "${1:base.html}" %}
|
||||
snippet filter
|
||||
{% filter ${1} %}
|
||||
${2}
|
||||
{% endfilter %}
|
||||
snippet firstof
|
||||
{% firstof ${1} %}
|
||||
snippet for
|
||||
{% for ${1} in ${2} %}
|
||||
${3}
|
||||
{% endfor %}
|
||||
snippet empty
|
||||
{% empty %}
|
||||
${1}
|
||||
snippet if
|
||||
{% if ${1} %}
|
||||
${2}
|
||||
{% endif %}
|
||||
snippet else
|
||||
{% else %}
|
||||
${1}
|
||||
snippet ifchanged
|
||||
{% ifchanged %}${1}{% endifchanged %}
|
||||
snippet ifequal
|
||||
{% ifequal ${1} ${2} %}
|
||||
${3}
|
||||
{% endifequal %}
|
||||
snippet ifnotequal
|
||||
{% ifnotequal ${1} ${2} %}
|
||||
${3}
|
||||
{% endifnotequal %}
|
||||
snippet include
|
||||
{% include "${1}" %}
|
||||
snippet load
|
||||
{% load ${1} %}
|
||||
snippet now
|
||||
{% now "${1:jS F Y H:i}" %}
|
||||
snippet regroup
|
||||
{% regroup ${1} by ${2} as ${3} %}
|
||||
snippet spaceless
|
||||
{% spaceless %}${1}{% endspaceless %}
|
||||
snippet ssi
|
||||
{% ssi ${1} %}
|
||||
snippet trans
|
||||
{% trans "${1:string}" %}
|
||||
snippet url
|
||||
{% url ${1} as ${2} %}
|
||||
snippet widthratio
|
||||
{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}
|
||||
snippet with
|
||||
{% with ${1} as ${2} %}
|
||||
|
||||
# Template Filters
|
||||
|
||||
# Note: Since SnipMate can't determine which template filter you are
|
||||
# expanding without the "|" character, these do not add the "|"
|
||||
# character. These save a few keystrokes still.
|
||||
|
||||
# Note: Template tags that take no arguments are not implemented.
|
||||
|
||||
snippet add
|
||||
add:"${1}"
|
||||
snippet center
|
||||
center:"${1}"
|
||||
snippet cut
|
||||
cut:"${1}"
|
||||
snippet date
|
||||
date:"${1}"
|
||||
snippet default
|
||||
default:"${1}"
|
||||
snippet defaultifnone
|
||||
default_if_none:"${1}"
|
||||
snippet dictsort
|
||||
dictsort:"${1}"
|
||||
snippet dictsortrev
|
||||
dictsortreversed:"${1}"
|
||||
snippet divisibleby
|
||||
divisibleby:"${1}"
|
||||
snippet floatformat
|
||||
floatformat:"${1}"
|
||||
snippet getdigit
|
||||
get_digit:"${1}"
|
||||
snippet join
|
||||
join:"${1}"
|
||||
snippet lengthis
|
||||
length_is:"${1}"
|
||||
snippet pluralize
|
||||
pluralize:"${1}"
|
||||
snippet removetags
|
||||
removetags:"${1}"
|
||||
snippet slice
|
||||
slice:"${1}"
|
||||
snippet stringformat
|
||||
stringformat:"${1}"
|
||||
snippet time
|
||||
time:"${1}"
|
||||
snippet truncatewords
|
||||
truncatewords:${1}
|
||||
snippet truncatewordshtml
|
||||
truncatewords_html:${1}
|
||||
snippet urlizetrunc
|
||||
urlizetrunc:${1}
|
||||
snippet wordwrap
|
||||
wordwrap:${1}
|
||||
|
||||
55
lib/ace/snippets/htmltornado.snippets
Normal file
55
lib/ace/snippets/htmltornado.snippets
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# Generic tags
|
||||
|
||||
snippet {
|
||||
{{ ${1} }}
|
||||
|
||||
# Template tags
|
||||
|
||||
snippet extends
|
||||
{% extends "${1:base.html}" %}
|
||||
snippet autoescape
|
||||
{% autoescape ${1:xhtml_escape | None} %}
|
||||
snippet apply
|
||||
{% apply ${1:function} %}
|
||||
${2}
|
||||
{% end %}
|
||||
snippet block
|
||||
{% block ${1} %}
|
||||
${2}
|
||||
{% end %}
|
||||
snippet for
|
||||
{% for ${1:item} in ${2} %}
|
||||
${3}
|
||||
{% end %}
|
||||
snippet from
|
||||
{% from ${1:x} import ${2:y} %}
|
||||
snippet if
|
||||
{% if ${1:condition} %}
|
||||
${2}
|
||||
{% end %}
|
||||
snippet elif
|
||||
{% elif ${1:condition} %}
|
||||
snippet else
|
||||
{% else %}
|
||||
snippet import
|
||||
{% import ${1:module} %}
|
||||
snippet include
|
||||
{% include "${1:filename}" %}
|
||||
snippet module
|
||||
{% module ${1:expression} %}
|
||||
snippet raw
|
||||
{% raw ${1:expression} %}
|
||||
snippet set
|
||||
{% set ${1:x} = ${2:y} %}
|
||||
snippet try
|
||||
{% try %}
|
||||
${1}
|
||||
{% except %}
|
||||
${2}
|
||||
{% finallly %}
|
||||
${3}
|
||||
{% end %}
|
||||
snippet while
|
||||
{% while ${1:condition} %}
|
||||
${2}
|
||||
{% end %}
|
||||
240
lib/ace/snippets/java.snippets
Normal file
240
lib/ace/snippets/java.snippets
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
## Access Modifiers
|
||||
snippet po
|
||||
protected
|
||||
snippet pu
|
||||
public
|
||||
snippet pr
|
||||
private
|
||||
##
|
||||
## Annotations
|
||||
snippet before
|
||||
@Before
|
||||
static void ${1:intercept}(${2:args}) { ${3} }
|
||||
snippet mm
|
||||
@ManyToMany
|
||||
${1}
|
||||
snippet mo
|
||||
@ManyToOne
|
||||
${1}
|
||||
snippet om
|
||||
@OneToMany${1:(cascade=CascadeType.ALL)}
|
||||
${2}
|
||||
snippet oo
|
||||
@OneToOne
|
||||
${1}
|
||||
##
|
||||
## Basic Java packages and import
|
||||
snippet im
|
||||
import
|
||||
snippet j.b
|
||||
java.beans.
|
||||
snippet j.i
|
||||
java.io.
|
||||
snippet j.m
|
||||
java.math.
|
||||
snippet j.n
|
||||
java.net.
|
||||
snippet j.u
|
||||
java.util.
|
||||
##
|
||||
## Class
|
||||
snippet cl
|
||||
class ${1:`Filename("", "untitled")`} ${2}
|
||||
snippet in
|
||||
interface ${1:`Filename("", "untitled")`} ${2:extends Parent}${3}
|
||||
snippet tc
|
||||
public class ${1:`Filename()`} extends ${2:TestCase}
|
||||
##
|
||||
## Class Enhancements
|
||||
snippet ext
|
||||
extends
|
||||
snippet imp
|
||||
implements
|
||||
##
|
||||
## Comments
|
||||
snippet /*
|
||||
/*
|
||||
* ${1}
|
||||
*/
|
||||
##
|
||||
## Constants
|
||||
snippet co
|
||||
static public final ${1:String} ${2:var} = ${3};${4}
|
||||
snippet cos
|
||||
static public final String ${1:var} = "${2}";${3}
|
||||
##
|
||||
## Control Statements
|
||||
snippet case
|
||||
case ${1}:
|
||||
${2}
|
||||
snippet def
|
||||
default:
|
||||
${2}
|
||||
snippet el
|
||||
else
|
||||
snippet elif
|
||||
else if (${1}) ${2}
|
||||
snippet if
|
||||
if (${1}) ${2}
|
||||
snippet sw
|
||||
switch (${1}) {
|
||||
${2}
|
||||
}
|
||||
##
|
||||
## Create a Method
|
||||
snippet m
|
||||
${1:void} ${2:method}(${3}) ${4:throws }${5}
|
||||
##
|
||||
## Create a Variable
|
||||
snippet v
|
||||
${1:String} ${2:var}${3: = null}${4};${5}
|
||||
##
|
||||
## Enhancements to Methods, variables, classes, etc.
|
||||
snippet ab
|
||||
abstract
|
||||
snippet fi
|
||||
final
|
||||
snippet st
|
||||
static
|
||||
snippet sy
|
||||
synchronized
|
||||
##
|
||||
## Error Methods
|
||||
snippet err
|
||||
System.err.print("${1:Message}");
|
||||
snippet errf
|
||||
System.err.printf("${1:Message}", ${2:exception});
|
||||
snippet errln
|
||||
System.err.println("${1:Message}");
|
||||
##
|
||||
## Exception Handling
|
||||
snippet as
|
||||
assert ${1:test} : "${2:Failure message}";${3}
|
||||
snippet ca
|
||||
catch(${1:Exception} ${2:e}) ${3}
|
||||
snippet thr
|
||||
throw
|
||||
snippet ths
|
||||
throws
|
||||
snippet try
|
||||
try {
|
||||
${3}
|
||||
} catch(${1:Exception} ${2:e}) {
|
||||
}
|
||||
snippet tryf
|
||||
try {
|
||||
${3}
|
||||
} catch(${1:Exception} ${2:e}) {
|
||||
} finally {
|
||||
}
|
||||
##
|
||||
## Find Methods
|
||||
snippet findall
|
||||
List<${1:listName}> ${2:items} = ${1}.findAll();${3}
|
||||
snippet findbyid
|
||||
${1:var} ${2:item} = ${1}.findById(${3});${4}
|
||||
##
|
||||
## Javadocs
|
||||
snippet /**
|
||||
/**
|
||||
* ${1}
|
||||
*/
|
||||
snippet @au
|
||||
@author `system("grep \`id -un\` /etc/passwd | cut -d \":\" -f5 | cut -d \",\" -f1")`
|
||||
snippet @br
|
||||
@brief ${1:Description}
|
||||
snippet @fi
|
||||
@file ${1:`Filename()`}.java
|
||||
snippet @pa
|
||||
@param ${1:param}
|
||||
snippet @re
|
||||
@return ${1:param}
|
||||
##
|
||||
## Logger Methods
|
||||
snippet debug
|
||||
Logger.debug(${1:param});${2}
|
||||
snippet error
|
||||
Logger.error(${1:param});${2}
|
||||
snippet info
|
||||
Logger.info(${1:param});${2}
|
||||
snippet warn
|
||||
Logger.warn(${1:param});${2}
|
||||
##
|
||||
## Loops
|
||||
snippet enfor
|
||||
for (${1} : ${2}) ${3}
|
||||
snippet for
|
||||
for (${1}; ${2}; ${3}) ${4}
|
||||
snippet wh
|
||||
while (${1}) ${2}
|
||||
##
|
||||
## Main method
|
||||
snippet main
|
||||
public static void main (String[] args) {
|
||||
${1:/* code */}
|
||||
}
|
||||
##
|
||||
## Print Methods
|
||||
snippet print
|
||||
System.out.print("${1:Message}");
|
||||
snippet printf
|
||||
System.out.printf("${1:Message}", ${2:args});
|
||||
snippet println
|
||||
System.out.println(${1});
|
||||
##
|
||||
## Render Methods
|
||||
snippet ren
|
||||
render(${1:param});${2}
|
||||
snippet rena
|
||||
renderArgs.put("${1}", ${2});${3}
|
||||
snippet renb
|
||||
renderBinary(${1:param});${2}
|
||||
snippet renj
|
||||
renderJSON(${1:param});${2}
|
||||
snippet renx
|
||||
renderXml(${1:param});${2}
|
||||
##
|
||||
## Setter and Getter Methods
|
||||
snippet set
|
||||
${1:public} void set${3:}(${2:String} ${4:}){
|
||||
this.$4 = $4;
|
||||
}
|
||||
snippet get
|
||||
${1:public} ${2:String} get${3:}(){
|
||||
return this.${4:};
|
||||
}
|
||||
##
|
||||
## Terminate Methods or Loops
|
||||
snippet re
|
||||
return
|
||||
snippet br
|
||||
break;
|
||||
##
|
||||
## Test Methods
|
||||
snippet t
|
||||
public void test${1:Name}() throws Exception {
|
||||
${2}
|
||||
}
|
||||
snippet test
|
||||
@Test
|
||||
public void test${1:Name}() throws Exception {
|
||||
${2}
|
||||
}
|
||||
##
|
||||
## Utils
|
||||
snippet Sc
|
||||
Scanner
|
||||
##
|
||||
## Miscellaneous
|
||||
snippet action
|
||||
public static void ${1:index}(${2:args}) { ${3} }
|
||||
snippet rnf
|
||||
notFound(${1:param});${2}
|
||||
snippet rnfin
|
||||
notFoundIfNull(${1:param});${2}
|
||||
snippet rr
|
||||
redirect(${1:param});${2}
|
||||
snippet ru
|
||||
unauthorized(${1:param});${2}
|
||||
snippet unless
|
||||
(unless=${1:param});${2}
|
||||
589
lib/ace/snippets/javascript-jquery.snippets
Normal file
589
lib/ace/snippets/javascript-jquery.snippets
Normal file
|
|
@ -0,0 +1,589 @@
|
|||
snippet add
|
||||
${1:obj}.add('${2:selector expression}')${3}
|
||||
snippet addClass
|
||||
${1:obj}.addClass('${2:class name}')${3}
|
||||
snippet after
|
||||
${1:obj}.after('${2:Some text <b>and bold!</b>}')${3}
|
||||
snippet ajax
|
||||
$.ajax({
|
||||
url: '${1:mydomain.com/url}',
|
||||
type: '${2:POST}',
|
||||
dataType: '${3:xml/html/script/json}',
|
||||
data: $.param( $('${4:Element or Expression}') ),
|
||||
complete: function (jqXHR, textStatus) {
|
||||
${5:// callback}
|
||||
},
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
${6:// success callback}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
${7:// error callback}
|
||||
}
|
||||
});
|
||||
snippet ajaxcomplete
|
||||
${1:obj}.ajaxComplete(function (${1:e}, xhr, settings) {
|
||||
${2:// callback}
|
||||
});
|
||||
snippet ajaxerror
|
||||
${1:obj}.ajaxError(function (${1:e}, xhr, settings, thrownError) {
|
||||
${2:// error callback}
|
||||
});
|
||||
${3}
|
||||
snippet ajaxget
|
||||
$.get('${1:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
function (data, textStatus, jqXHR) {
|
||||
${3:// success callback}
|
||||
}
|
||||
);
|
||||
snippet ajaxpost
|
||||
$.post('${1:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
function (data, textStatus, jqXHR) {
|
||||
${3:// success callback}
|
||||
}
|
||||
);
|
||||
snippet ajaxprefilter
|
||||
$.ajaxPrefilter(function (${1:options}, ${2:originalOptions}, jqXHR) {
|
||||
${3: // Modify options, control originalOptions, store jqXHR, etc}
|
||||
});
|
||||
snippet ajaxsend
|
||||
${1:obj}.ajaxSend(function (${1:request, settings}) {
|
||||
${2:// error callback}
|
||||
});
|
||||
${3}
|
||||
snippet ajaxsetup
|
||||
$.ajaxSetup({
|
||||
url: "${1:mydomain.com/url}",
|
||||
type: "${2:POST}",
|
||||
dataType: "${3:xml/html/script/json}",
|
||||
data: $.param( $("${4:Element or Expression}") ),
|
||||
complete: function (jqXHR, textStatus) {
|
||||
${5:// callback}
|
||||
},
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
${6:// success callback}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
${7:// error callback}
|
||||
}
|
||||
});
|
||||
snippet ajaxstart
|
||||
$.ajaxStart(function () {
|
||||
${1:// handler for when an AJAX call is started and no other AJAX calls are in progress};
|
||||
});
|
||||
${2}
|
||||
snippet ajaxstop
|
||||
$.ajaxStop(function () {
|
||||
${1:// handler for when all AJAX calls have been completed};
|
||||
});
|
||||
${2}
|
||||
snippet ajaxsuccess
|
||||
$.ajaxSuccess(function (${1:e}, xhr, settings) {
|
||||
${2:// handler for when any AJAX call is successfully completed};
|
||||
});
|
||||
${2}
|
||||
snippet andself
|
||||
${1:obj}.andSelf()${2}
|
||||
snippet animate
|
||||
${1:obj}.animate({${2:param1: value1, param2: value2}}, ${3:speed})${4}
|
||||
snippet append
|
||||
${1:obj}.append('${2:Some text <b>and bold!</b>}')${3}
|
||||
snippet appendTo
|
||||
${1:obj}.appendTo('${2:selector expression}')${3}
|
||||
snippet attr
|
||||
${1:obj}.attr('${2:attribute}', '${3:value}')${4}
|
||||
snippet attrm
|
||||
${1:obj}.attr({'${2:attr1}': '${3:value1}', '${4:attr2}': '${5:value2}'})${6}
|
||||
snippet before
|
||||
${1:obj}.before('${2:Some text <b>and bold!</b>}')${3}
|
||||
snippet bind
|
||||
${1:obj}.bind('${2:event name}', function (${3:e}) {
|
||||
${4:// event handler}
|
||||
});
|
||||
snippet blur
|
||||
${1:obj}.blur(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet C
|
||||
$.Callbacks()${1}
|
||||
snippet Cadd
|
||||
${1:callbacks}.add(${2:callbacks})${3}
|
||||
snippet Cdis
|
||||
${1:callbacks}.disable()${2}
|
||||
snippet Cempty
|
||||
${1:callbacks}.empty()${2}
|
||||
snippet Cfire
|
||||
${1:callbacks}.fire(${2:args})${3}
|
||||
snippet Cfired
|
||||
${1:callbacks}.fired()${2}
|
||||
snippet Cfirew
|
||||
${1:callbacks}.fireWith(${2:this}, ${3:args})${4}
|
||||
snippet Chas
|
||||
${1:callbacks}.has(${2:callback})${3}
|
||||
snippet Clock
|
||||
${1:callbacks}.lock()${2}
|
||||
snippet Clocked
|
||||
${1:callbacks}.locked()${2}
|
||||
snippet Crem
|
||||
${1:callbacks}.remove(${2:callbacks})${3}
|
||||
snippet change
|
||||
${1:obj}.change(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet children
|
||||
${1:obj}.children('${2:selector expression}')${3}
|
||||
snippet clearq
|
||||
${1:obj}.clearQueue(${2:'queue name'})${3}
|
||||
snippet click
|
||||
${1:obj}.click(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet clone
|
||||
${1:obj}.clone()${2}
|
||||
snippet contains
|
||||
$.contains(${1:container}, ${2:contents});
|
||||
snippet css
|
||||
${1:obj}.css('${2:attribute}', '${3:value}')${4}
|
||||
snippet csshooks
|
||||
$.cssHooks['${1:CSS prop}'] = {
|
||||
get: function (elem, computed, extra) {
|
||||
${2: // handle getting the CSS property}
|
||||
},
|
||||
set: function (elem, value) {
|
||||
${3: // handle setting the CSS value}
|
||||
}
|
||||
};
|
||||
snippet cssm
|
||||
${1:obj}.css({${2:attribute1}: '${3:value1}', ${4:attribute2}: '${5:value2}'})${6}
|
||||
snippet D
|
||||
$.Deferred()${1}
|
||||
snippet Dalways
|
||||
${1:deferred}.always(${2:callbacks})${3}
|
||||
snippet Ddone
|
||||
${1:deferred}.done(${2:callbacks})${3}
|
||||
snippet Dfail
|
||||
${1:deferred}.fail(${2:callbacks})${3}
|
||||
snippet Disrej
|
||||
${1:deferred}.isRejected()${2}
|
||||
snippet Disres
|
||||
${1:deferred}.isResolved()${2}
|
||||
snippet Dnotify
|
||||
${1:deferred}.notify(${2:args})${3}
|
||||
snippet Dnotifyw
|
||||
${1:deferred}.notifyWith(${2:this}, ${3:args})${4}
|
||||
snippet Dpipe
|
||||
${1:deferred}.then(${2:doneFilter}, ${3:failFilter}, ${4:progressFilter})${5}
|
||||
snippet Dprog
|
||||
${1:deferred}.progress(${2:callbacks})${3}
|
||||
snippet Dprom
|
||||
${1:deferred}.promise(${2:target})${3}
|
||||
snippet Drej
|
||||
${1:deferred}.reject(${2:args})${3}
|
||||
snippet Drejw
|
||||
${1:deferred}.rejectWith(${2:this}, ${3:args})${4}
|
||||
snippet Dres
|
||||
${1:deferred}.resolve(${2:args})${3}
|
||||
snippet Dresw
|
||||
${1:deferred}.resolveWith(${2:this}, ${3:args})${4}
|
||||
snippet Dstate
|
||||
${1:deferred}.state()${2}
|
||||
snippet Dthen
|
||||
${1:deferred}.then(${2:doneCallbacks}, ${3:failCallbacks}, ${4:progressCallbacks})${5}
|
||||
snippet Dwhen
|
||||
$.when(${1:deferreds})${2}
|
||||
snippet data
|
||||
${1:obj}.data(${2:obj})${3}
|
||||
snippet dataa
|
||||
$.data('${1:selector expression}', '${2:key}'${3:, 'value'})${4}
|
||||
snippet dblclick
|
||||
${1:obj}.dblclick(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet delay
|
||||
${1:obj}.delay('${2:slow/400/fast}'${3:, 'queue name'})${4}
|
||||
snippet dele
|
||||
${1:obj}.delegate('${2:selector expression}', '${3:event name}', function (${4:e}) {
|
||||
${5:// event handler}
|
||||
});
|
||||
snippet deq
|
||||
${1:obj}.dequeue(${2:'queue name'})${3}
|
||||
snippet deqq
|
||||
$.dequeue('${1:selector expression}'${2:, 'queue name'})${3}
|
||||
snippet detach
|
||||
${1:obj}.detach('${2:selector expression}')${3}
|
||||
snippet die
|
||||
${1:obj}.die(${2:event}, ${3:handler})${4}
|
||||
snippet each
|
||||
${1:obj}.each(function (index) {
|
||||
${2:this.innerHTML = this + " is the element, " + index + " is the position";}
|
||||
});
|
||||
snippet el
|
||||
$('<${1}/>'${2:, {}})${3}
|
||||
snippet eltrim
|
||||
$.trim('${1:string}')${2}
|
||||
snippet empty
|
||||
${1:obj}.empty()${2}
|
||||
snippet end
|
||||
${1:obj}.end()${2}
|
||||
snippet eq
|
||||
${1:obj}.eq(${2:element index})${3}
|
||||
snippet error
|
||||
${1:obj}.error(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet eventsmap
|
||||
{
|
||||
:f${1}
|
||||
}
|
||||
snippet extend
|
||||
$.extend(${1:true, }${2:target}, ${3:obj})${4}
|
||||
snippet fadein
|
||||
${1:obj}.fadeIn('${2:slow/400/fast}')${3}
|
||||
snippet fadeinc
|
||||
${1:obj}.fadeIn('slow/400/fast', function () {
|
||||
${2:// callback};
|
||||
});
|
||||
snippet fadeout
|
||||
${1:obj}.fadeOut('${2:slow/400/fast}')${3}
|
||||
snippet fadeoutc
|
||||
${1:obj}.fadeOut('slow/400/fast', function () {
|
||||
${2:// callback};
|
||||
});
|
||||
snippet fadeto
|
||||
${1:obj}.fadeTo('${2:slow/400/fast}', ${3:0.5})${4}
|
||||
snippet fadetoc
|
||||
${1:obj}.fadeTo('slow/400/fast', ${2:0.5}, function () {
|
||||
${3:// callback};
|
||||
});
|
||||
snippet filter
|
||||
${1:obj}.filter('${2:selector expression}')${3}
|
||||
snippet filtert
|
||||
${1:obj}.filter(function (${2:index}) {
|
||||
${3:// test code}
|
||||
})${4}
|
||||
snippet find
|
||||
${1:obj}.find('${2:selector expression}')${3}
|
||||
snippet focus
|
||||
${1:obj}.focus(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet focusin
|
||||
${1:obj}.focusIn(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet focusout
|
||||
${1:obj}.focusOut(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet get
|
||||
${1:obj}.get(${2:element index})${3}
|
||||
snippet getjson
|
||||
$.getJSON('${1:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
function (data, textStatus, jqXHR) {
|
||||
${3:// success callback}
|
||||
}
|
||||
);
|
||||
snippet getscript
|
||||
$.getScript('${1:mydomain.com/url}', function (script, textStatus, jqXHR) {
|
||||
${2:// callback}
|
||||
});
|
||||
snippet grep
|
||||
$.grep(${1:array}, function (item, index) {
|
||||
${2:// test code}
|
||||
}${3:, true});
|
||||
snippet hasc
|
||||
${1:obj}.hasClass('${2:className}')${3}
|
||||
snippet hasd
|
||||
$.hasData('${1:selector expression}');
|
||||
snippet height
|
||||
${1:obj}.height(${2:integer})${3}
|
||||
snippet hide
|
||||
${1:obj}.hide('${2:slow/400/fast}')${3}
|
||||
snippet hidec
|
||||
${1:obj}.hide('${2:slow/400/fast}', function () {
|
||||
${3:// callback}
|
||||
});
|
||||
snippet hover
|
||||
${1:obj}.hover(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
}, function ($2) {
|
||||
${4:// event handler}
|
||||
});${5}
|
||||
snippet html
|
||||
${1:obj}.html('${2:Some text <b>and bold!</b>}')${3}
|
||||
snippet inarr
|
||||
$.inArray(${1:value}, ${2:array});
|
||||
snippet insa
|
||||
${1:obj}.insertAfter('${2:selector expression}')${3}
|
||||
snippet insb
|
||||
${1:obj}.insertBefore('${2:selector expression}')${3}
|
||||
snippet is
|
||||
${1:obj}.is('${2:selector expression}')${3}
|
||||
snippet isarr
|
||||
$.isArray(${1:obj})${2}
|
||||
snippet isempty
|
||||
$.isEmptyObject(${1:obj})${2}
|
||||
snippet isfunc
|
||||
$.isFunction(${1:obj})${2}
|
||||
snippet isnum
|
||||
$.isNumeric(${1:value})${2}
|
||||
snippet isobj
|
||||
$.isPlainObject(${1:obj})${2}
|
||||
snippet iswin
|
||||
$.isWindow(${1:obj})${2}
|
||||
snippet isxml
|
||||
$.isXMLDoc(${1:node})${2}
|
||||
snippet jj
|
||||
$('${1:selector}')${2}
|
||||
snippet kdown
|
||||
${1:obj}.keydown(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet kpress
|
||||
${1:obj}.keypress(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet kup
|
||||
${1:obj}.keyup(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet last
|
||||
${1:obj}.last('${1:selector expression}')${3}
|
||||
snippet live
|
||||
${1:obj}.live('${2:events}', function (${3:e}) {
|
||||
${4:// event handler}
|
||||
});
|
||||
snippet load
|
||||
${1:obj}.load(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet loadf
|
||||
${1:obj}.load('${2:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
function (responseText, textStatus, xhr) {
|
||||
${3:// success callback}
|
||||
}
|
||||
});
|
||||
snippet makearray
|
||||
$.makeArray(${1:obj});
|
||||
snippet map
|
||||
${1:obj}.map(function (${2:index}, ${3:element}) {
|
||||
${4:// callback}
|
||||
});
|
||||
snippet mapp
|
||||
$.map(${1:arrayOrObject}, function (${2:value}, ${3:indexOrKey}) {
|
||||
${4:// callback}
|
||||
});
|
||||
snippet merge
|
||||
$.merge(${1:target}, ${2:original});
|
||||
snippet mdown
|
||||
${1:obj}.mousedown(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet menter
|
||||
${1:obj}.mouseenter(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet mleave
|
||||
${1:obj}.mouseleave(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet mmove
|
||||
${1:obj}.mousemove(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet mout
|
||||
${1:obj}.mouseout(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet mover
|
||||
${1:obj}.mouseover(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet mup
|
||||
${1:obj}.mouseup(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet next
|
||||
${1:obj}.next('${2:selector expression}')${3}
|
||||
snippet nexta
|
||||
${1:obj}.nextAll('${2:selector expression}')${3}
|
||||
snippet nextu
|
||||
${1:obj}.nextUntil('${2:selector expression}'${3:, 'filter expression'})${4}
|
||||
snippet not
|
||||
${1:obj}.not('${2:selector expression}')${3}
|
||||
snippet off
|
||||
${1:obj}.off('${2:events}', '${3:selector expression}'${4:, handler})${5}
|
||||
snippet offset
|
||||
${1:obj}.offset()${2}
|
||||
snippet offsetp
|
||||
${1:obj}.offsetParent()${2}
|
||||
snippet on
|
||||
${1:obj}.on('${2:events}', '${3:selector expression}', function (${4:e}) {
|
||||
${5:// event handler}
|
||||
});
|
||||
snippet one
|
||||
${1:obj}.one('${2:event name}', function (${3:e}) {
|
||||
${4:// event handler}
|
||||
});
|
||||
snippet outerh
|
||||
${1:obj}.outerHeight()${2}
|
||||
snippet outerw
|
||||
${1:obj}.outerWidth()${2}
|
||||
snippet param
|
||||
$.param(${1:obj})${2}
|
||||
snippet parent
|
||||
${1:obj}.parent('${2:selector expression}')${3}
|
||||
snippet parents
|
||||
${1:obj}.parents('${2:selector expression}')${3}
|
||||
snippet parentsu
|
||||
${1:obj}.parentsUntil('${2:selector expression}'${3:, 'filter expression'})${4}
|
||||
snippet parsejson
|
||||
$.parseJSON(${1:data})${2}
|
||||
snippet parsexml
|
||||
$.parseXML(${1:data})${2}
|
||||
snippet pos
|
||||
${1:obj}.position()${2}
|
||||
snippet prepend
|
||||
${1:obj}.prepend('${2:Some text <b>and bold!</b>}')${3}
|
||||
snippet prependto
|
||||
${1:obj}.prependTo('${2:selector expression}')${3}
|
||||
snippet prev
|
||||
${1:obj}.prev('${2:selector expression}')${3}
|
||||
snippet preva
|
||||
${1:obj}.prevAll('${2:selector expression}')${3}
|
||||
snippet prevu
|
||||
${1:obj}.prevUntil('${2:selector expression}'${3:, 'filter expression'})${4}
|
||||
snippet promise
|
||||
${1:obj}.promise(${2:'fx'}, ${3:target})${4}
|
||||
snippet prop
|
||||
${1:obj}.prop('${2:property name}')${3}
|
||||
snippet proxy
|
||||
$.proxy(${1:function}, ${2:this})${3}
|
||||
snippet pushstack
|
||||
${1:obj}.pushStack(${2:elements})${3}
|
||||
snippet queue
|
||||
${1:obj}.queue(${2:name}${3:, newQueue})${4}
|
||||
snippet queuee
|
||||
$.queue(${1:element}${2:, name}${3:, newQueue})${4}
|
||||
snippet ready
|
||||
$(function () {
|
||||
${1}
|
||||
});
|
||||
snippet rem
|
||||
${1:obj}.remove()${2}
|
||||
snippet rema
|
||||
${1:obj}.removeAttr('${2:attribute name}')${3}
|
||||
snippet remc
|
||||
${1:obj}.removeClass('${2:class name}')${3}
|
||||
snippet remd
|
||||
${1:obj}.removeData('${2:key name}')${3}
|
||||
snippet remdd
|
||||
$.removeData(${1:element}${2:, 'key name}')${3}
|
||||
snippet remp
|
||||
${1:obj}.removeProp('${2:property name}')${3}
|
||||
snippet repa
|
||||
${1:obj}.replaceAll(${2:target})${3}
|
||||
snippet repw
|
||||
${1:obj}.replaceWith(${2:content})${3}
|
||||
snippet reset
|
||||
${1:obj}.reset(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet resize
|
||||
${1:obj}.resize(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet scroll
|
||||
${1:obj}.scroll(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet scrolll
|
||||
${1:obj}.scrollLeft(${2:value})${3}
|
||||
snippet scrollt
|
||||
${1:obj}.scrollTop(${2:value})${3}
|
||||
snippet sdown
|
||||
${1:obj}.slideDown('${2:slow/400/fast}')${3}
|
||||
snippet sdownc
|
||||
${1:obj}.slideDown('${2:slow/400/fast}', function () {
|
||||
${3:// callback};
|
||||
});
|
||||
snippet select
|
||||
${1:obj}.select(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet serialize
|
||||
${1:obj}.serialize()${2}
|
||||
snippet serializea
|
||||
${1:obj}.serializeArray()${2}
|
||||
snippet show
|
||||
${1:obj}.show('${2:slow/400/fast}')${3}
|
||||
snippet showc
|
||||
${1:obj}.show('${2:slow/400/fast}', function () {
|
||||
${3:// callback}
|
||||
});
|
||||
snippet sib
|
||||
${1:obj}.siblings('${2:selector expression}')${3}
|
||||
snippet size
|
||||
${1:obj}.size()${2}
|
||||
snippet slice
|
||||
${1:obj}.slice(${2:start}${3:, end})${4}
|
||||
snippet stoggle
|
||||
${1:obj}.slideToggle('${2:slow/400/fast}')${3}
|
||||
snippet stop
|
||||
${1:obj}.stop('${2:queue}', ${3:false}, ${4:false})${5}
|
||||
snippet submit
|
||||
${1:obj}.submit(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet sup
|
||||
${1:obj}.slideUp('${2:slow/400/fast}')${3}
|
||||
snippet supc
|
||||
${1:obj}.slideUp('${2:slow/400/fast}', function () {
|
||||
${3:// callback};
|
||||
});
|
||||
snippet text
|
||||
${1:obj}.text(${2:'some text'})${3}
|
||||
snippet this
|
||||
$(this)${1}
|
||||
snippet toarr
|
||||
${1:obj}.toArray()
|
||||
snippet tog
|
||||
${1:obj}.toggle(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
}, function ($2) {
|
||||
${4:// event handler}
|
||||
});
|
||||
${4}
|
||||
snippet togclass
|
||||
${1:obj}.toggleClass('${2:class name}')${3}
|
||||
snippet togsh
|
||||
${1:obj}.toggle('${2:slow/400/fast}')${3}
|
||||
snippet trig
|
||||
${1:obj}.trigger('${2:event name}')${3}
|
||||
snippet trigh
|
||||
${1:obj}.triggerHandler('${2:event name}')${3}
|
||||
snippet $trim
|
||||
$.trim(${1:str})${2}
|
||||
snippet $type
|
||||
$.type(${1:obj})${2}
|
||||
snippet unbind
|
||||
${1:obj}.unbind('${2:event name}')${3}
|
||||
snippet undele
|
||||
${1:obj}.undelegate(${2:selector expression}, ${3:event}, ${4:handler})${5}
|
||||
snippet uniq
|
||||
$.unique(${1:array})${2}
|
||||
snippet unload
|
||||
${1:obj}.unload(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
});
|
||||
snippet unwrap
|
||||
${1:obj}.unwrap()${2}
|
||||
snippet val
|
||||
${1:obj}.val('${2:text}')${3}
|
||||
snippet width
|
||||
${1:obj}.width(${2:integer})${3}
|
||||
snippet wrap
|
||||
${1:obj}.wrap('${2:<div class="extra-wrapper"></div>}')${3}
|
||||
7
lib/ace/snippets/javascript.js
Normal file
7
lib/ace/snippets/javascript.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
exports.snippetText = require("../requirejs/text!./javascript.snippets");
|
||||
|
||||
|
||||
});
|
||||
194
lib/ace/snippets/javascript.snippets
Normal file
194
lib/ace/snippets/javascript.snippets
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
# Prototype
|
||||
snippet proto
|
||||
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
|
||||
${4:// body...}
|
||||
};
|
||||
# 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}
|
||||
}
|
||||
# if ... else
|
||||
snippet ife
|
||||
if (${1:true}) {
|
||||
${2}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
# tertiary conditional
|
||||
snippet ter
|
||||
${1:/* condition */} ? ${2:a} : ${3:b}
|
||||
# switch
|
||||
snippet switch
|
||||
switch (${1:expression}) {
|
||||
case '${3:case}':
|
||||
${4:// code}
|
||||
break;
|
||||
${5}
|
||||
default:
|
||||
${2:// code}
|
||||
}
|
||||
# case
|
||||
snippet case
|
||||
case '${1:case}':
|
||||
${2:// code}
|
||||
break;
|
||||
${3}
|
||||
|
||||
# while (...) {...}
|
||||
snippet wh
|
||||
while (${1:/* condition */}) {
|
||||
${0:/* code */}
|
||||
}
|
||||
# try
|
||||
snippet try
|
||||
try {
|
||||
${0:/* code */}
|
||||
} catch (e) {}
|
||||
# do...while
|
||||
snippet do
|
||||
do {
|
||||
${2:/* code */}
|
||||
} while (${1:/* condition */});
|
||||
# Object Method
|
||||
snippet :f
|
||||
regex /([,{[])|^\s*/:f/
|
||||
${1:method_name}: function(${2:attribute}) {
|
||||
${0}
|
||||
}${3:,}
|
||||
# setTimeout function
|
||||
snippet timeout
|
||||
setTimeout(function() {${3}}${2}, ${1:10});
|
||||
# Get Elements
|
||||
snippet gett
|
||||
getElementsBy${1:TagName}('${2}')${3}
|
||||
# Get Element
|
||||
snippet get
|
||||
getElementBy${1:Id}('${2}')${3}
|
||||
# console.log (Firebug)
|
||||
snippet cl
|
||||
console.log(${1});
|
||||
# return
|
||||
snippet ret
|
||||
return ${1:result}
|
||||
# for (property in object ) { ... }
|
||||
snippet fori
|
||||
for (var ${1:prop} in ${2:Things}) {
|
||||
${0:$2[$1]}
|
||||
}
|
||||
# hasOwnProperty
|
||||
snippet has
|
||||
hasOwnProperty(${1})
|
||||
# docstring
|
||||
snippet /**
|
||||
/**
|
||||
* ${1:description}
|
||||
*
|
||||
*/
|
||||
snippet @par
|
||||
regex /^\s*\*\s*/@(para?m?)?/
|
||||
@param {${1:type}} ${2:name} ${3:description}
|
||||
snippet @ret
|
||||
@return {${1:type}} ${2:description}
|
||||
# JSON.parse
|
||||
snippet jsonp
|
||||
JSON.parse(${1:jstr});
|
||||
# JSON.stringify
|
||||
snippet jsons
|
||||
JSON.stringify(${1:object});
|
||||
# self-defining function
|
||||
snippet sdf
|
||||
var ${1:function_name} = function(${2:argument}) {
|
||||
${3:// initial code ...}
|
||||
|
||||
$1 = function($2) {
|
||||
${4:// main code}
|
||||
};
|
||||
}
|
||||
# singleton
|
||||
snippet sing
|
||||
function ${1:Singleton} (${2:argument}) {
|
||||
// the cached instance
|
||||
var instance;
|
||||
|
||||
// rewrite the constructor
|
||||
$1 = function $1($2) {
|
||||
return instance;
|
||||
};
|
||||
|
||||
// carry over the prototype properties
|
||||
$1.prototype = this;
|
||||
|
||||
// the instance
|
||||
instance = new $1();
|
||||
|
||||
// reset the constructor pointer
|
||||
instance.constructor = $1;
|
||||
|
||||
${3:// code ...}
|
||||
|
||||
return instance;
|
||||
}
|
||||
# class
|
||||
name class
|
||||
regex /^\s*/clas{0,2}/
|
||||
var ${1:class} = function(${20}) {
|
||||
$40$0
|
||||
};
|
||||
|
||||
(function() {
|
||||
${60:this.prop = ""}
|
||||
}).call(${1:class}.prototype);
|
||||
|
||||
exports.${1:class} = ${1:class};
|
||||
#
|
||||
snippet for-
|
||||
for (var ${1:i} = ${2:Things}.length; ${1:i}--; ) {
|
||||
${0:${2:Things}[${1:i}];}
|
||||
}
|
||||
# for (...) {...}
|
||||
snippet for
|
||||
for (var ${1:i} = 0; $1 < ${2:Things}.length; $1$++) {
|
||||
${3:$2[$1]}$0
|
||||
}
|
||||
# for (...) {...} (Improved Native For-Loop)
|
||||
snippet forr
|
||||
for (var ${1:i} = ${2:Things}.length - 1; $1 >= 0; $1$--) {
|
||||
${3:$2[$1]}$0
|
||||
}
|
||||
|
||||
|
||||
#modules
|
||||
snippet def
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
var ${1/.*\///} = require("${1}");
|
||||
|
||||
$TM_SELECTED_TEXT
|
||||
});
|
||||
snippet req
|
||||
guard ^\s*
|
||||
var ${1/.*\///} = require("${1}");
|
||||
$0
|
||||
snippet requ
|
||||
guard ^\s*
|
||||
var ${1/.*\/(.)/\u$1/} = require("${1}").${1/.*\/(.)/\u$1/};
|
||||
$0
|
||||
99
lib/ace/snippets/jsp.snippets
Normal file
99
lib/ace/snippets/jsp.snippets
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
snippet @page
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
snippet jstl
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
|
||||
snippet jstl:c
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
snippet jstl:fn
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
|
||||
snippet cpath
|
||||
${pageContext.request.contextPath}
|
||||
snippet cout
|
||||
<c:out value="${1}" default="${2}" />
|
||||
snippet cset
|
||||
<c:set var="${1}" value="${2}" />
|
||||
snippet cremove
|
||||
<c:remove var="${1}" scope="${2:page}" />
|
||||
snippet ccatch
|
||||
<c:catch var="${1}" />
|
||||
snippet cif
|
||||
<c:if test="${${1}}">
|
||||
${2}
|
||||
</c:if>
|
||||
snippet cchoose
|
||||
<c:choose>
|
||||
${1}
|
||||
</c:choose>
|
||||
snippet cwhen
|
||||
<c:when test="${${1}}">
|
||||
${2}
|
||||
</c:when>
|
||||
snippet cother
|
||||
<c:otherwise>
|
||||
${1}
|
||||
</c:otherwise>
|
||||
snippet cfore
|
||||
<c:forEach items="${${1}}" var="${2}" varStatus="${3}">
|
||||
${4:<c:out value="$2" />}
|
||||
</c:forEach>
|
||||
snippet cfort
|
||||
<c:set var="${1}">${2:item1,item2,item3}</c:set>
|
||||
<c:forTokens var="${3}" items="${$1}" delims="${4:,}">
|
||||
${5:<c:out value="$3" />}
|
||||
</c:forTokens>
|
||||
snippet cparam
|
||||
<c:param name="${1}" value="${2}" />
|
||||
snippet cparam+
|
||||
<c:param name="${1}" value="${2}" />
|
||||
cparam+${3}
|
||||
snippet cimport
|
||||
<c:import url="${1}" />
|
||||
snippet cimport+
|
||||
<c:import url="${1}">
|
||||
<c:param name="${2}" value="${3}" />
|
||||
cparam+${4}
|
||||
</c:import>
|
||||
snippet curl
|
||||
<c:url value="${1}" var="${2}" />
|
||||
<a href="${$2}">${3}</a>
|
||||
snippet curl+
|
||||
<c:url value="${1}" var="${2}">
|
||||
<c:param name="${4}" value="${5}" />
|
||||
cparam+${6}
|
||||
</c:url>
|
||||
<a href="${$2}">${3}</a>
|
||||
snippet credirect
|
||||
<c:redirect url="${1}" />
|
||||
snippet contains
|
||||
${fn:contains(${1:string}, ${2:substr})}
|
||||
snippet contains:i
|
||||
${fn:containsIgnoreCase(${1:string}, ${2:substr})}
|
||||
snippet endswith
|
||||
${fn:endsWith(${1:string}, ${2:suffix})}
|
||||
snippet escape
|
||||
${fn:escapeXml(${1:string})}
|
||||
snippet indexof
|
||||
${fn:indexOf(${1:string}, ${2:substr})}
|
||||
snippet join
|
||||
${fn:join(${1:collection}, ${2:delims})}
|
||||
snippet length
|
||||
${fn:length(${1:collection_or_string})}
|
||||
snippet replace
|
||||
${fn:replace(${1:string}, ${2:substr}, ${3:replace})}
|
||||
snippet split
|
||||
${fn:split(${1:string}, ${2:delims})}
|
||||
snippet startswith
|
||||
${fn:startsWith(${1:string}, ${2:prefix})}
|
||||
snippet substr
|
||||
${fn:substring(${1:string}, ${2:begin}, ${3:end})}
|
||||
snippet substr:a
|
||||
${fn:substringAfter(${1:string}, ${2:substr})}
|
||||
snippet substr:b
|
||||
${fn:substringBefore(${1:string}, ${2:substr})}
|
||||
snippet lc
|
||||
${fn:toLowerCase(${1:string})}
|
||||
snippet uc
|
||||
${fn:toUpperCase(${1:string})}
|
||||
snippet trim
|
||||
${fn:trim(${1:string})}
|
||||
5
lib/ace/snippets/ledger.snippets
Normal file
5
lib/ace/snippets/ledger.snippets
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Ledger <http://ledger-cli.org/>
|
||||
snippet ent
|
||||
`strftime("%Y/%m/%d")` ${1:transaction}
|
||||
${2:account} ${3:value}
|
||||
${4:account}
|
||||
21
lib/ace/snippets/lua.snippets
Normal file
21
lib/ace/snippets/lua.snippets
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
snippet #!
|
||||
#!/usr/bin/env lua
|
||||
$1
|
||||
snippet local
|
||||
local ${1:x} = ${2:1}
|
||||
snippet fun
|
||||
function ${1:fname}(${2:...})
|
||||
${3:-- body}
|
||||
end
|
||||
snippet for
|
||||
for ${1:i}=${2:1},${3:10} do
|
||||
${4:print(i)}
|
||||
end
|
||||
snippet forp
|
||||
for ${1:i},${2:v} in pairs(${3:table_name}) do
|
||||
${4:-- body}
|
||||
end
|
||||
snippet fori
|
||||
for ${1:i},${2:v} in ipairs(${3:table_name}) do
|
||||
${4:-- body}
|
||||
end
|
||||
4
lib/ace/snippets/make.snippets
Normal file
4
lib/ace/snippets/make.snippets
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
snippet ifeq
|
||||
ifeq (${1:cond0},${2:cond1})
|
||||
${3:code}
|
||||
endif
|
||||
54
lib/ace/snippets/mako.snippets
Normal file
54
lib/ace/snippets/mako.snippets
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
snippet def
|
||||
<%def name="${1:name}">
|
||||
${2:}
|
||||
</%def>
|
||||
snippet call
|
||||
<%call expr="${1:name}">
|
||||
${2:}
|
||||
</%call>
|
||||
snippet doc
|
||||
<%doc>
|
||||
${1:}
|
||||
</%doc>
|
||||
snippet text
|
||||
<%text>
|
||||
${1:}
|
||||
</%text>
|
||||
snippet for
|
||||
% for ${1:i} in ${2:iter}:
|
||||
${3:}
|
||||
% endfor
|
||||
snippet if if
|
||||
% if ${1:condition}:
|
||||
${2:}
|
||||
% endif
|
||||
snippet if if/else
|
||||
% if ${1:condition}:
|
||||
${2:}
|
||||
% else:
|
||||
${3:}
|
||||
% endif
|
||||
snippet try
|
||||
% try:
|
||||
${1:}
|
||||
% except${2:}:
|
||||
${3:pass}
|
||||
% endtry
|
||||
snippet wh
|
||||
% while ${1:}:
|
||||
${2:}
|
||||
% endwhile
|
||||
snippet $
|
||||
${ ${1:} }
|
||||
snippet <%
|
||||
<% ${1:} %>
|
||||
snippet <!%
|
||||
<!% ${1:} %>
|
||||
snippet inherit
|
||||
<%inherit file="${1:filename}" />
|
||||
snippet include
|
||||
<%include file="${1:filename}" />
|
||||
snippet namespace
|
||||
<%namespace file="${1:name}" />
|
||||
snippet page
|
||||
<%page args="${1:}" />
|
||||
87
lib/ace/snippets/markdown.snippets
Normal file
87
lib/ace/snippets/markdown.snippets
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
# Markdown
|
||||
|
||||
# Includes octopress (http://octopress.org/) snippets
|
||||
|
||||
snippet [
|
||||
[${1:text}](http://${2:address} "${3:title}")
|
||||
snippet [*
|
||||
[${1:link}](${2:`@*`} "${3:title}")${4}
|
||||
|
||||
snippet [:
|
||||
[${1:id}]: http://${2:url} "${3:title}"
|
||||
snippet [:*
|
||||
[${1:id}]: ${2:`@*`} "${3:title}"
|
||||
|
||||
snippet 
|
||||
snippet ${4}
|
||||
|
||||
snippet ![:
|
||||
![${1:id}]: ${2:url} "${3:title}"
|
||||
snippet ![:*
|
||||
![${1:id}]: ${2:`@*`} "${3:title}"
|
||||
|
||||
snippet ===
|
||||
`repeat('=', strlen(getline(line(".") - 1)))`
|
||||
|
||||
${1}
|
||||
snippet ---
|
||||
`repeat('-', strlen(getline(line(".") - 1)))`
|
||||
|
||||
${1}
|
||||
|
||||
snippet blockquote
|
||||
{% blockquote %}
|
||||
${1:quote}
|
||||
{% endblockquote %}
|
||||
|
||||
snippet blockquote-author
|
||||
{% blockquote ${1:author}, ${2:title} %}
|
||||
${3:quote}
|
||||
{% endblockquote %}
|
||||
|
||||
snippet blockquote-link
|
||||
{% blockquote ${1:author} ${2:URL} ${3:link_text} %}
|
||||
${4:quote}
|
||||
{% endblockquote %}
|
||||
|
||||
snippet bt-codeblock-short
|
||||
```
|
||||
${1:code_snippet}
|
||||
```
|
||||
|
||||
snippet bt-codeblock-full
|
||||
``` ${1:language} ${2:title} ${3:URL} ${4:link_text}
|
||||
${5:code_snippet}
|
||||
```
|
||||
|
||||
snippet codeblock-short
|
||||
{% codeblock %}
|
||||
${1:code_snippet}
|
||||
{% endcodeblock %}
|
||||
|
||||
snippet codeblock-full
|
||||
{% codeblock ${1:title} lang:${2:language} ${3:URL} ${4:link_text} %}
|
||||
${5:code_snippet}
|
||||
{% endcodeblock %}
|
||||
|
||||
snippet gist-full
|
||||
{% gist ${1:gist_id} ${2:filename} %}
|
||||
|
||||
snippet gist-short
|
||||
{% gist ${1:gist_id} %}
|
||||
|
||||
snippet img
|
||||
{% img ${1:class} ${2:URL} ${3:width} ${4:height} ${5:title_text} ${6:alt_text} %}
|
||||
|
||||
snippet youtube
|
||||
{% youtube ${1:video_id} %}
|
||||
|
||||
# The quote should appear only once in the text. It is inherently part of it.
|
||||
# See http://octopress.org/docs/plugins/pullquote/ for more info.
|
||||
|
||||
snippet pullquote
|
||||
{% pullquote %}
|
||||
${1:text} {" ${2:quote} "} ${3:text}
|
||||
{% endpullquote %}
|
||||
247
lib/ace/snippets/objc.snippets
Normal file
247
lib/ace/snippets/objc.snippets
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
# #import <...>
|
||||
snippet Imp
|
||||
#import <${1:Cocoa/Cocoa.h}>${2}
|
||||
# #import "..."
|
||||
snippet imp
|
||||
#import "${1:`Filename()`.h}"${2}
|
||||
# @selector(...)
|
||||
snippet sel
|
||||
@selector(${1:method}:)${3}
|
||||
# @"..." string
|
||||
snippet s
|
||||
@"${1}"${2}
|
||||
# Object
|
||||
snippet o
|
||||
${1:NSObject} *${2:foo} = [${3:$1 alloc}]${4};${5}
|
||||
# NSLog(...)
|
||||
snippet log
|
||||
NSLog(@"${1:%@}"${2});${3}
|
||||
# Class
|
||||
snippet objc
|
||||
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation $1
|
||||
${3}
|
||||
@end
|
||||
# Class Interface
|
||||
snippet int
|
||||
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
|
||||
{${3}
|
||||
}
|
||||
${4}
|
||||
@end
|
||||
snippet @interface
|
||||
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
|
||||
{${3}
|
||||
}
|
||||
${4}
|
||||
@end
|
||||
# Class Implementation
|
||||
snippet impl
|
||||
@implementation ${1:`Filename('', 'someClass')`}
|
||||
${2}
|
||||
@end
|
||||
snippet @implementation
|
||||
@implementation ${1:`Filename('', 'someClass')`}
|
||||
${2}
|
||||
@end
|
||||
# Protocol
|
||||
snippet pro
|
||||
@protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
|
||||
${3}
|
||||
@end
|
||||
snippet @protocol
|
||||
@protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
|
||||
${3}
|
||||
@end
|
||||
# init Definition
|
||||
snippet init
|
||||
- (id)init
|
||||
{
|
||||
if (self = [super init]) {
|
||||
${1}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
# dealloc Definition
|
||||
snippet dealloc
|
||||
- (void) dealloc
|
||||
{
|
||||
${1:deallocations}
|
||||
[super dealloc];
|
||||
}
|
||||
snippet su
|
||||
[super ${1:init}]${2}
|
||||
snippet ibo
|
||||
IBOutlet ${1:NSSomeClass} *${2:$1};${3}
|
||||
# Category
|
||||
snippet cat
|
||||
@interface ${1:NSObject} (${2:MyCategory})
|
||||
@end
|
||||
|
||||
@implementation $1 ($2)
|
||||
${3}
|
||||
@end
|
||||
# Category Interface
|
||||
snippet cath
|
||||
@interface ${1:`Filename('$1', 'NSObject')`} (${2:MyCategory})
|
||||
${3}
|
||||
@end
|
||||
# Method
|
||||
snippet m
|
||||
- (${1:id})${2:method}
|
||||
{
|
||||
${3}
|
||||
}
|
||||
# Method declaration
|
||||
snippet md
|
||||
- (${1:id})${2:method};${3}
|
||||
# IBAction declaration
|
||||
snippet ibad
|
||||
- (IBAction)${1:method}:(${2:id})sender;${3}
|
||||
# IBAction method
|
||||
snippet iba
|
||||
- (IBAction)${1:method}:(${2:id})sender
|
||||
{
|
||||
${3}
|
||||
}
|
||||
# awakeFromNib method
|
||||
snippet wake
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
${1}
|
||||
}
|
||||
# Class Method
|
||||
snippet M
|
||||
+ (${1:id})${2:method}
|
||||
{
|
||||
${3:return nil;}
|
||||
}
|
||||
# Sub-method (Call super)
|
||||
snippet sm
|
||||
- (${1:id})${2:method}
|
||||
{
|
||||
[super $2];${3}
|
||||
return self;
|
||||
}
|
||||
# Accessor Methods For:
|
||||
# Object
|
||||
snippet objacc
|
||||
- (${1:id})${2:thing}
|
||||
{
|
||||
return $2;
|
||||
}
|
||||
|
||||
- (void)set$2:($1)${3:new$2}
|
||||
{
|
||||
[$3 retain];
|
||||
[$2 release];
|
||||
$2 = $3;
|
||||
}${4}
|
||||
# for (object in array)
|
||||
snippet forin
|
||||
for (${1:Class} *${2:some$1} in ${3:array}) {
|
||||
${4}
|
||||
}
|
||||
snippet fore
|
||||
for (${1:object} in ${2:array}) {
|
||||
${3:statements}
|
||||
}
|
||||
snippet forarray
|
||||
unsigned int ${1:object}Count = [${2:array} count];
|
||||
|
||||
for (unsigned int index = 0; index < $1Count; index++) {
|
||||
${3:id} $1 = [$2 $1AtIndex:index];
|
||||
${4}
|
||||
}
|
||||
snippet fora
|
||||
unsigned int ${1:object}Count = [${2:array} count];
|
||||
|
||||
for (unsigned int index = 0; index < $1Count; index++) {
|
||||
${3:id} $1 = [$2 $1AtIndex:index];
|
||||
${4}
|
||||
}
|
||||
# Try / Catch Block
|
||||
snippet @try
|
||||
@try {
|
||||
${1:statements}
|
||||
}
|
||||
@catch (NSException * e) {
|
||||
${2:handler}
|
||||
}
|
||||
@finally {
|
||||
${3:statements}
|
||||
}
|
||||
snippet @catch
|
||||
@catch (${1:exception}) {
|
||||
${2:handler}
|
||||
}
|
||||
snippet @finally
|
||||
@finally {
|
||||
${1:statements}
|
||||
}
|
||||
# IBOutlet
|
||||
# @property (Objective-C 2.0)
|
||||
snippet prop
|
||||
@property (${1:retain}) ${2:NSSomeClass} ${3:*$2};${4}
|
||||
# @synthesize (Objective-C 2.0)
|
||||
snippet syn
|
||||
@synthesize ${1:property};${2}
|
||||
# [[ alloc] init]
|
||||
snippet alloc
|
||||
[[${1:foo} alloc] init${2}];${3}
|
||||
snippet a
|
||||
[[${1:foo} alloc] init${2}];${3}
|
||||
# retain
|
||||
snippet ret
|
||||
[${1:foo} retain];${2}
|
||||
# release
|
||||
snippet rel
|
||||
[${1:foo} release];
|
||||
# autorelease
|
||||
snippet arel
|
||||
[${1:foo} autorelease];
|
||||
# autorelease pool
|
||||
snippet pool
|
||||
NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init];
|
||||
${2:/* code */}
|
||||
[$1 drain];
|
||||
# Throw an exception
|
||||
snippet except
|
||||
NSException *${1:badness};
|
||||
$1 = [NSException exceptionWithName:@"${2:$1Name}"
|
||||
reason:@"${3}"
|
||||
userInfo:nil];
|
||||
[$1 raise];
|
||||
snippet prag
|
||||
#pragma mark ${1:-}
|
||||
snippet cl
|
||||
@class ${1:Foo};${2}
|
||||
snippet color
|
||||
[[NSColor ${1:blackColor}] set];
|
||||
# NSArray
|
||||
snippet array
|
||||
NSMutableArray *${1:array} = [NSMutable array];${2}
|
||||
snippet nsa
|
||||
NSArray ${1}
|
||||
snippet nsma
|
||||
NSMutableArray ${1}
|
||||
snippet aa
|
||||
NSArray * array;${1}
|
||||
snippet ma
|
||||
NSMutableArray * array;${1}
|
||||
# NSDictionary
|
||||
snippet dict
|
||||
NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2}
|
||||
snippet nsd
|
||||
NSDictionary ${1}
|
||||
snippet nsmd
|
||||
NSMutableDictionary ${1}
|
||||
# NSString
|
||||
snippet nss
|
||||
NSString ${1}
|
||||
snippet nsms
|
||||
NSMutableString ${1}
|
||||
347
lib/ace/snippets/perl.snippets
Normal file
347
lib/ace/snippets/perl.snippets
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
# #!/usr/bin/perl
|
||||
snippet #!
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Hash Pointer
|
||||
snippet .
|
||||
=>
|
||||
# Function
|
||||
snippet sub
|
||||
sub ${1:function_name} {
|
||||
${2:#body ...}
|
||||
}
|
||||
# Conditional
|
||||
snippet if
|
||||
if (${1}) {
|
||||
${2:# body...}
|
||||
}
|
||||
# Conditional if..else
|
||||
snippet ife
|
||||
if (${1}) {
|
||||
${2:# body...}
|
||||
}
|
||||
else {
|
||||
${3:# else...}
|
||||
}
|
||||
# Conditional if..elsif..else
|
||||
snippet ifee
|
||||
if (${1}) {
|
||||
${2:# body...}
|
||||
}
|
||||
elsif (${3}) {
|
||||
${4:# elsif...}
|
||||
}
|
||||
else {
|
||||
${5:# else...}
|
||||
}
|
||||
# Conditional One-line
|
||||
snippet xif
|
||||
${1:expression} if ${2:condition};${3}
|
||||
# Unless conditional
|
||||
snippet unless
|
||||
unless (${1}) {
|
||||
${2:# body...}
|
||||
}
|
||||
# Unless conditional One-line
|
||||
snippet xunless
|
||||
${1:expression} unless ${2:condition};${3}
|
||||
# Try/Except
|
||||
snippet eval
|
||||
local $@;
|
||||
eval {
|
||||
${1:# do something risky...}
|
||||
};
|
||||
if (my $e = $@) {
|
||||
${2:# handle failure...}
|
||||
}
|
||||
# While Loop
|
||||
snippet wh
|
||||
while (${1}) {
|
||||
${2:# body...}
|
||||
}
|
||||
# While Loop One-line
|
||||
snippet xwh
|
||||
${1:expression} while ${2:condition};${3}
|
||||
# C-style For Loop
|
||||
snippet cfor
|
||||
for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {
|
||||
${4:# body...}
|
||||
}
|
||||
# For loop one-line
|
||||
snippet xfor
|
||||
${1:expression} for @${2:array};${3}
|
||||
# Foreach Loop
|
||||
snippet for
|
||||
foreach my $${1:x} (@${2:array}) {
|
||||
${3:# body...}
|
||||
}
|
||||
# Foreach Loop One-line
|
||||
snippet fore
|
||||
${1:expression} foreach @${2:array};${3}
|
||||
# Package
|
||||
snippet package
|
||||
package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`};
|
||||
|
||||
${2}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
# Package syntax perl >= 5.14
|
||||
snippet packagev514
|
||||
package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:0.99};
|
||||
|
||||
${3}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
#moose
|
||||
snippet moose
|
||||
use Moose;
|
||||
use namespace::autoclean;
|
||||
${1:#}BEGIN {extends '${2:ParentClass}'};
|
||||
|
||||
${3}
|
||||
# parent
|
||||
snippet parent
|
||||
use parent qw(${1:Parent Class});
|
||||
# Read File
|
||||
snippet slurp
|
||||
my $${1:var} = do { local $/; open my $file, '<', "${2:file}"; <$file> };
|
||||
${3}
|
||||
# strict warnings
|
||||
snippet strwar
|
||||
use strict;
|
||||
use warnings;
|
||||
# older versioning with perlcritic bypass
|
||||
snippet vers
|
||||
## no critic
|
||||
our $VERSION = '${1:version}';
|
||||
eval $VERSION;
|
||||
## use critic
|
||||
# new 'switch' like feature
|
||||
snippet switch
|
||||
use feature 'switch';
|
||||
|
||||
# Anonymous subroutine
|
||||
snippet asub
|
||||
sub {
|
||||
${1:# body }
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Begin block
|
||||
snippet begin
|
||||
BEGIN {
|
||||
${1:# begin body}
|
||||
}
|
||||
|
||||
# call package function with some parameter
|
||||
snippet pkgmv
|
||||
__PACKAGE__->${1:package_method}(${2:var})
|
||||
|
||||
# call package function without a parameter
|
||||
snippet pkgm
|
||||
__PACKAGE__->${1:package_method}()
|
||||
|
||||
# call package "get_" function without a parameter
|
||||
snippet pkget
|
||||
__PACKAGE__->get_${1:package_method}()
|
||||
|
||||
# call package function with a parameter
|
||||
snippet pkgetv
|
||||
__PACKAGE__->get_${1:package_method}(${2:var})
|
||||
|
||||
# complex regex
|
||||
snippet qrx
|
||||
qr/
|
||||
${1:regex}
|
||||
/xms
|
||||
|
||||
#simpler regex
|
||||
snippet qr/
|
||||
qr/${1:regex}/x
|
||||
|
||||
#given
|
||||
snippet given
|
||||
given ($${1:var}) {
|
||||
${2:# cases}
|
||||
${3:# default}
|
||||
}
|
||||
|
||||
# switch-like case
|
||||
snippet when
|
||||
when (${1:case}) {
|
||||
${2:# body}
|
||||
}
|
||||
|
||||
# hash slice
|
||||
snippet hslice
|
||||
@{ ${1:hash} }{ ${2:array} }
|
||||
|
||||
|
||||
# map
|
||||
snippet map
|
||||
map { ${2: body } } ${1: @array } ;
|
||||
|
||||
|
||||
|
||||
# Pod stub
|
||||
snippet ppod
|
||||
=head1 NAME
|
||||
|
||||
${1:ClassName} - ${2:ShortDesc}
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use $1;
|
||||
|
||||
${3:# synopsis...}
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
${4:# longer description...}
|
||||
|
||||
|
||||
=head1 INTERFACE
|
||||
|
||||
|
||||
=head1 DEPENDENCIES
|
||||
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
|
||||
# Heading for a subroutine stub
|
||||
snippet psub
|
||||
=head2 ${1:MethodName}
|
||||
|
||||
${2:Summary....}
|
||||
|
||||
# Heading for inline subroutine pod
|
||||
snippet psubi
|
||||
=head2 ${1:MethodName}
|
||||
|
||||
${2:Summary...}
|
||||
|
||||
|
||||
=cut
|
||||
# inline documented subroutine
|
||||
snippet subpod
|
||||
=head2 $1
|
||||
|
||||
Summary of $1
|
||||
|
||||
=cut
|
||||
|
||||
sub ${1:subroutine_name} {
|
||||
${2:# body...}
|
||||
}
|
||||
# Subroutine signature
|
||||
snippet parg
|
||||
=over 2
|
||||
|
||||
=item
|
||||
Arguments
|
||||
|
||||
|
||||
=over 3
|
||||
|
||||
=item
|
||||
C<${1:DataStructure}>
|
||||
|
||||
${2:Sample}
|
||||
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=item
|
||||
Return
|
||||
|
||||
=over 3
|
||||
|
||||
|
||||
=item
|
||||
C<${3:...return data}>
|
||||
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=back
|
||||
|
||||
|
||||
|
||||
# Moose has
|
||||
snippet has
|
||||
has ${1:attribute} => (
|
||||
is => '${2:ro|rw}',
|
||||
isa => '${3:Str|Int|HashRef|ArrayRef|etc}',
|
||||
default => sub {
|
||||
${4:defaultvalue}
|
||||
},
|
||||
${5:# other attributes}
|
||||
);
|
||||
|
||||
|
||||
# override
|
||||
snippet override
|
||||
override ${1:attribute} => sub {
|
||||
${2:# my $self = shift;};
|
||||
${3:# my ($self, $args) = @_;};
|
||||
};
|
||||
|
||||
|
||||
# use test classes
|
||||
snippet tuse
|
||||
use Test::More;
|
||||
use Test::Deep; # (); # uncomment to stop prototype errors
|
||||
use Test::Exception;
|
||||
|
||||
# local test lib
|
||||
snippet tlib
|
||||
use lib qw{ ./t/lib };
|
||||
|
||||
#test methods
|
||||
snippet tmeths
|
||||
$ENV{TEST_METHOD} = '${1:regex}';
|
||||
|
||||
# runtestclass
|
||||
snippet trunner
|
||||
use ${1:test_class};
|
||||
$1->runtests();
|
||||
|
||||
# Test::Class-style test
|
||||
snippet tsub
|
||||
sub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) {
|
||||
my $self = shift;
|
||||
${4:# body}
|
||||
|
||||
}
|
||||
|
||||
# Test::Routine-style test
|
||||
snippet trsub
|
||||
test ${1:test_name} => { description => '${2:Description of test.}'} => sub {
|
||||
my ($self) = @_;
|
||||
${3:# test code}
|
||||
};
|
||||
|
||||
#prep test method
|
||||
snippet tprep
|
||||
sub prep${1:number}_${2:test_case} :Test(startup) {
|
||||
my $self = shift;
|
||||
${4:# body}
|
||||
}
|
||||
|
||||
# cause failures to print stack trace
|
||||
snippet debug_trace
|
||||
use Carp; # 'verbose';
|
||||
# cloak "die"
|
||||
# warn "warning"
|
||||
$SIG{'__DIE__'} = sub {
|
||||
require Carp; Carp::confess
|
||||
};
|
||||
|
||||
377
lib/ace/snippets/php.snippets
Normal file
377
lib/ace/snippets/php.snippets
Normal file
|
|
@ -0,0 +1,377 @@
|
|||
snippet <?
|
||||
<?php
|
||||
|
||||
${1}
|
||||
snippet ec
|
||||
echo ${1};
|
||||
snippet <?e
|
||||
<?php echo ${1} ?>
|
||||
# this one is for php5.4
|
||||
snippet <?=
|
||||
<?=${1}?>
|
||||
snippet ns
|
||||
namespace ${1:Foo\Bar\Baz};
|
||||
${2}
|
||||
snippet use
|
||||
use ${1:Foo\Bar\Baz};
|
||||
${2}
|
||||
snippet c
|
||||
${1:abstract }class ${2:`Filename()`}
|
||||
{
|
||||
${3}
|
||||
}
|
||||
snippet i
|
||||
interface ${1:`Filename()`}
|
||||
{
|
||||
${2}
|
||||
}
|
||||
snippet t.
|
||||
$this->${1}
|
||||
snippet f
|
||||
function ${1:foo}(${2:array }${3:$bar})
|
||||
{
|
||||
${4}
|
||||
}
|
||||
# method
|
||||
snippet m
|
||||
${1:abstract }${2:protected}${3: static} function ${4:foo}(${5:array }${6:$bar})
|
||||
{
|
||||
${7}
|
||||
}
|
||||
# setter method
|
||||
snippet sm
|
||||
/**
|
||||
* Sets the value of ${1:foo}
|
||||
*
|
||||
* @param ${2:$1} $$1 ${3:description}
|
||||
*
|
||||
* @return ${4:`Filename()`}
|
||||
*/
|
||||
${5:public} function set${6:$2}(${7:$2 }$$1)
|
||||
{
|
||||
$this->${8:$1} = $$1;
|
||||
return $this;
|
||||
}${9}
|
||||
# getter method
|
||||
snippet gm
|
||||
/**
|
||||
* Gets the value of ${1:foo}
|
||||
*
|
||||
* @return ${2:$1}
|
||||
*/
|
||||
${3:public} function get${4:$2}()
|
||||
{
|
||||
return $this->${5:$1};
|
||||
}${6}
|
||||
#setter
|
||||
snippet $s
|
||||
${1:$foo}->set${2:Bar}(${3});
|
||||
#getter
|
||||
snippet $g
|
||||
${1:$foo}->get${2:Bar}();
|
||||
|
||||
# Tertiary conditional
|
||||
snippet =?:
|
||||
$${1:foo} = ${2:true} ? ${3:a} : ${4};
|
||||
snippet ?:
|
||||
${1:true} ? ${2:a} : ${3}
|
||||
|
||||
snippet C
|
||||
$_COOKIE['${1:variable}']${2}
|
||||
snippet E
|
||||
$_ENV['${1:variable}']${2}
|
||||
snippet F
|
||||
$_FILES['${1:variable}']${2}
|
||||
snippet G
|
||||
$_GET['${1:variable}']${2}
|
||||
snippet P
|
||||
$_POST['${1:variable}']${2}
|
||||
snippet R
|
||||
$_REQUEST['${1:variable}']${2}
|
||||
snippet S
|
||||
$_SERVER['${1:variable}']${2}
|
||||
snippet SS
|
||||
$_SESSION['${1:variable}']${2}
|
||||
|
||||
# the following are old ones
|
||||
snippet inc
|
||||
include '${1:file}';${2}
|
||||
snippet inc1
|
||||
include_once '${1:file}';${2}
|
||||
snippet req
|
||||
require '${1:file}';${2}
|
||||
snippet req1
|
||||
require_once '${1:file}';${2}
|
||||
# Start Docblock
|
||||
snippet /*
|
||||
/**
|
||||
* ${1}
|
||||
*/
|
||||
# Class - post doc
|
||||
snippet doc_cp
|
||||
/**
|
||||
* ${1:undocumented class}
|
||||
*
|
||||
* @package ${2:default}
|
||||
* @subpackage ${3:default}
|
||||
* @author ${4:`g:snips_author`}
|
||||
*/${5}
|
||||
# Class Variable - post doc
|
||||
snippet doc_vp
|
||||
/**
|
||||
* ${1:undocumented class variable}
|
||||
*
|
||||
* @var ${2:string}
|
||||
*/${3}
|
||||
# Class Variable
|
||||
snippet doc_v
|
||||
/**
|
||||
* ${3:undocumented class variable}
|
||||
*
|
||||
* @var ${4:string}
|
||||
*/
|
||||
${1:var} $${2};${5}
|
||||
# Class
|
||||
snippet doc_c
|
||||
/**
|
||||
* ${3:undocumented class}
|
||||
*
|
||||
* @package ${4:default}
|
||||
* @subpackage ${5:default}
|
||||
* @author ${6:`g:snips_author`}
|
||||
*/
|
||||
${1:}class ${2:}
|
||||
{
|
||||
${7}
|
||||
} // END $1class $2
|
||||
# Constant Definition - post doc
|
||||
snippet doc_dp
|
||||
/**
|
||||
* ${1:undocumented constant}
|
||||
*/${2}
|
||||
# Constant Definition
|
||||
snippet doc_d
|
||||
/**
|
||||
* ${3:undocumented constant}
|
||||
*/
|
||||
define(${1}, ${2});${4}
|
||||
# Function - post doc
|
||||
snippet doc_fp
|
||||
/**
|
||||
* ${1:undocumented function}
|
||||
*
|
||||
* @return ${2:void}
|
||||
* @author ${3:`g:snips_author`}
|
||||
*/${4}
|
||||
# Function signature
|
||||
snippet doc_s
|
||||
/**
|
||||
* ${4:undocumented function}
|
||||
*
|
||||
* @return ${5:void}
|
||||
* @author ${6:`g:snips_author`}
|
||||
*/
|
||||
${1}function ${2}(${3});${7}
|
||||
# Function
|
||||
snippet doc_f
|
||||
/**
|
||||
* ${4:undocumented function}
|
||||
*
|
||||
* @return ${5:void}
|
||||
* @author ${6:`g:snips_author`}
|
||||
*/
|
||||
${1}function ${2}(${3})
|
||||
{${7}
|
||||
}
|
||||
# Header
|
||||
snippet doc_h
|
||||
/**
|
||||
* ${1}
|
||||
*
|
||||
* @author ${2:`g:snips_author`}
|
||||
* @version ${3:$Id$}
|
||||
* @copyright ${4:$2}, `strftime('%d %B, %Y')`
|
||||
* @package ${5:default}
|
||||
*/
|
||||
|
||||
# Interface
|
||||
snippet interface
|
||||
/**
|
||||
* ${2:undocumented class}
|
||||
*
|
||||
* @package ${3:default}
|
||||
* @author ${4:`g:snips_author`}
|
||||
*/
|
||||
interface ${1:`Filename()`}
|
||||
{
|
||||
${5}
|
||||
}
|
||||
# class ...
|
||||
snippet class
|
||||
/**
|
||||
* ${1}
|
||||
*/
|
||||
class ${2:`Filename()`}
|
||||
{
|
||||
${3}
|
||||
/**
|
||||
* ${4}
|
||||
*/
|
||||
${5:public} function ${6:__construct}(${7:argument})
|
||||
{
|
||||
${8:// code...}
|
||||
}
|
||||
}
|
||||
# define(...)
|
||||
snippet def
|
||||
define('${1}'${2});${3}
|
||||
# defined(...)
|
||||
snippet def?
|
||||
${1}defined('${2}')${3}
|
||||
snippet wh
|
||||
while (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
}
|
||||
# do ... while
|
||||
snippet do
|
||||
do {
|
||||
${2:// code... }
|
||||
} while (${1:/* condition */});
|
||||
snippet if
|
||||
if (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
}
|
||||
snippet ifil
|
||||
<?php if (${1:/* condition */}): ?>
|
||||
${2:<!-- code... -->}
|
||||
<?php endif; ?>
|
||||
snippet ife
|
||||
if (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
} else {
|
||||
${3:// code...}
|
||||
}
|
||||
${4}
|
||||
snippet ifeil
|
||||
<?php if (${1:/* condition */}): ?>
|
||||
${2:<!-- html... -->}
|
||||
<?php else: ?>
|
||||
${3:<!-- html... -->}
|
||||
<?php endif; ?>
|
||||
${4}
|
||||
snippet else
|
||||
else {
|
||||
${1:// code...}
|
||||
}
|
||||
snippet elseif
|
||||
elseif (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
}
|
||||
snippet switch
|
||||
switch ($${1:variable}) {
|
||||
case '${2:value}':
|
||||
${3:// code...}
|
||||
break;
|
||||
${5}
|
||||
default:
|
||||
${4:// code...}
|
||||
break;
|
||||
}
|
||||
snippet case
|
||||
case '${1:value}':
|
||||
${2:// code...}
|
||||
break;${3}
|
||||
snippet for
|
||||
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
|
||||
${4: // code...}
|
||||
}
|
||||
snippet foreach
|
||||
foreach ($${1:variable} as $${2:value}) {
|
||||
${3:// code...}
|
||||
}
|
||||
snippet foreachil
|
||||
<?php foreach ($${1:variable} as $${2:value}): ?>
|
||||
${3:<!-- html... -->}
|
||||
<?php endforeach; ?>
|
||||
snippet foreachk
|
||||
foreach ($${1:variable} as $${2:key} => $${3:value}) {
|
||||
${4:// code...}
|
||||
}
|
||||
snippet foreachkil
|
||||
<?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>
|
||||
${4:<!-- html... -->}
|
||||
<?php endforeach; ?>
|
||||
# $... = array (...)
|
||||
snippet array
|
||||
$${1:arrayName} = array('${2}' => ${3});${4}
|
||||
snippet try
|
||||
try {
|
||||
${2}
|
||||
} catch (${1:Exception} $e) {
|
||||
}
|
||||
# lambda with closure
|
||||
snippet lambda
|
||||
${1:static }function (${2:args}) use (${3:&$x, $y /*put vars in scope (closure) */}) {
|
||||
${4}
|
||||
};
|
||||
# pre_dump();
|
||||
snippet pd
|
||||
echo '<pre>'; var_dump(${1}); echo '</pre>';
|
||||
# pre_dump(); die();
|
||||
snippet pdd
|
||||
echo '<pre>'; var_dump(${1}); echo '</pre>'; die(${2:});
|
||||
snippet vd
|
||||
var_dump(${1});
|
||||
snippet vdd
|
||||
var_dump(${1}); die(${2:});
|
||||
snippet http_redirect
|
||||
header ("HTTP/1.1 301 Moved Permanently");
|
||||
header ("Location: ".URL);
|
||||
exit();
|
||||
# Getters & Setters
|
||||
snippet gs
|
||||
/**
|
||||
* Gets the value of ${1:foo}
|
||||
*
|
||||
* @return ${2:$1}
|
||||
*/
|
||||
public function get${3:$2}()
|
||||
{
|
||||
return $this->${4:$1};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of $1
|
||||
*
|
||||
* @param $2 $$1 ${5:description}
|
||||
*
|
||||
* @return ${6:`Filename()`}
|
||||
*/
|
||||
public function set$3(${7:$2 }$$1)
|
||||
{
|
||||
$this->$4 = $$1;
|
||||
return $this;
|
||||
}${8}
|
||||
# anotation, get, and set, useful for doctrine
|
||||
snippet ags
|
||||
/**
|
||||
* ${1:description}
|
||||
*
|
||||
* @${7}
|
||||
*/
|
||||
${2:protected} $${3:foo};
|
||||
|
||||
public function get${4:$3}()
|
||||
{
|
||||
return $this->$3;
|
||||
}
|
||||
|
||||
public function set$4(${5:$4 }$${6:$3})
|
||||
{
|
||||
$this->$3 = $$6;
|
||||
return $this;
|
||||
}
|
||||
snippet rett
|
||||
return true;
|
||||
snippet retf
|
||||
return false;
|
||||
158
lib/ace/snippets/python.snippets
Normal file
158
lib/ace/snippets/python.snippets
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
snippet #!
|
||||
#!/usr/bin/env python
|
||||
snippet imp
|
||||
import ${1:module}
|
||||
snippet from
|
||||
from ${1:package} import ${2:module}
|
||||
# Module Docstring
|
||||
snippet docs
|
||||
'''
|
||||
File: ${1:`Filename('$1.py', 'foo.py')`}
|
||||
Author: ${2:`g:snips_author`}
|
||||
Description: ${3}
|
||||
'''
|
||||
snippet wh
|
||||
while ${1:condition}:
|
||||
${2:# TODO: write code...}
|
||||
# dowh - does the same as do...while in other languages
|
||||
snippet dowh
|
||||
while True:
|
||||
${1:# TODO: write code...}
|
||||
if ${2:condition}:
|
||||
break
|
||||
snippet with
|
||||
with ${1:expr} as ${2:var}:
|
||||
${3:# TODO: write code...}
|
||||
# New Class
|
||||
snippet cl
|
||||
class ${1:ClassName}(${2:object}):
|
||||
"""${3:docstring for $1}"""
|
||||
def __init__(self, ${4:arg}):
|
||||
${5:super($1, self).__init__()}
|
||||
self.$4 = $4
|
||||
${6}
|
||||
# New Function
|
||||
snippet def
|
||||
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
"""${3:docstring for $1}"""
|
||||
${4:# TODO: write code...}
|
||||
snippet deff
|
||||
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
${3:# TODO: write code...}
|
||||
# New Method
|
||||
snippet defs
|
||||
def ${1:mname}(self, ${2:arg}):
|
||||
${3:# TODO: write code...}
|
||||
# New Property
|
||||
snippet property
|
||||
def ${1:foo}():
|
||||
doc = "${2:The $1 property.}"
|
||||
def fget(self):
|
||||
${3:return self._$1}
|
||||
def fset(self, value):
|
||||
${4:self._$1 = value}
|
||||
# Ifs
|
||||
snippet if
|
||||
if ${1:condition}:
|
||||
${2:# TODO: write code...}
|
||||
snippet el
|
||||
else:
|
||||
${1:# TODO: write code...}
|
||||
snippet ei
|
||||
elif ${1:condition}:
|
||||
${2:# TODO: write code...}
|
||||
# For
|
||||
snippet for
|
||||
for ${1:item} in ${2:items}:
|
||||
${3:# TODO: write code...}
|
||||
# Encodes
|
||||
snippet cutf8
|
||||
# -*- coding: utf-8 -*-
|
||||
snippet clatin1
|
||||
# -*- coding: latin-1 -*-
|
||||
snippet cascii
|
||||
# -*- coding: ascii -*-
|
||||
# Lambda
|
||||
snippet ld
|
||||
${1:var} = lambda ${2:vars} : ${3:action}
|
||||
snippet .
|
||||
self.
|
||||
snippet try Try/Except
|
||||
try:
|
||||
${1:# TODO: write code...}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${4:raise $3}
|
||||
snippet try Try/Except/Else
|
||||
try:
|
||||
${1:# TODO: write code...}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${4:raise $3}
|
||||
else:
|
||||
${5:# TODO: write code...}
|
||||
snippet try Try/Except/Finally
|
||||
try:
|
||||
${1:# TODO: write code...}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${4:raise $3}
|
||||
finally:
|
||||
${5:# TODO: write code...}
|
||||
snippet try Try/Except/Else/Finally
|
||||
try:
|
||||
${1:# TODO: write code...}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${4:raise $3}
|
||||
else:
|
||||
${5:# TODO: write code...}
|
||||
finally:
|
||||
${6:# TODO: write code...}
|
||||
# if __name__ == '__main__':
|
||||
snippet ifmain
|
||||
if __name__ == '__main__':
|
||||
${1:main()}
|
||||
# __magic__
|
||||
snippet _
|
||||
__${1:init}__${2}
|
||||
# python debugger (pdb)
|
||||
snippet pdb
|
||||
import pdb; pdb.set_trace()
|
||||
# ipython debugger (ipdb)
|
||||
snippet ipdb
|
||||
import ipdb; ipdb.set_trace()
|
||||
# ipython debugger (pdbbb)
|
||||
snippet pdbbb
|
||||
import pdbpp; pdbpp.set_trace()
|
||||
snippet pprint
|
||||
import pprint; pprint.pprint(${1})${2}
|
||||
snippet "
|
||||
"""
|
||||
${1:doc}
|
||||
"""
|
||||
# test function/method
|
||||
snippet test
|
||||
def test_${1:description}(${2:`indent('.') ? 'self' : ''`}):
|
||||
${3:# TODO: write code...}
|
||||
# test case
|
||||
snippet testcase
|
||||
class ${1:ExampleCase}(unittest.TestCase):
|
||||
|
||||
def test_${2:description}(self):
|
||||
${3:# TODO: write code...}
|
||||
snippet fut
|
||||
from __future__ import ${1}
|
||||
#getopt
|
||||
snippet getopt
|
||||
try:
|
||||
# Short option syntax: "hv:"
|
||||
# Long option syntax: "help" or "verbose="
|
||||
opts, args = getopt.getopt(sys.argv[1:], "${1:short_options}", [${2:long_options}])
|
||||
|
||||
except getopt.GetoptError, err:
|
||||
# Print debug info
|
||||
print str(err)
|
||||
${3:error_action}
|
||||
|
||||
for option, argument in opts:
|
||||
if option in ("-h", "--help"):
|
||||
${4}
|
||||
elif option in ("-v", "--verbose"):
|
||||
verbose = argument
|
||||
121
lib/ace/snippets/r.snippets
Normal file
121
lib/ace/snippets/r.snippets
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
snippet #!
|
||||
#!/usr/bin/env Rscript
|
||||
|
||||
# includes
|
||||
snippet lib
|
||||
library(${1:package})
|
||||
snippet req
|
||||
require(${1:package})
|
||||
snippet source
|
||||
source('${1:file}')
|
||||
|
||||
# conditionals
|
||||
snippet if
|
||||
if (${1:condition}) {
|
||||
${2:code}
|
||||
}
|
||||
snippet el
|
||||
else {
|
||||
${1:code}
|
||||
}
|
||||
snippet ei
|
||||
else if (${1:condition}) {
|
||||
${2:code}
|
||||
}
|
||||
|
||||
# functions
|
||||
snippet fun
|
||||
${1:name} = function (${2:variables}) {
|
||||
${3:code}
|
||||
}
|
||||
snippet ret
|
||||
return(${1:code})
|
||||
|
||||
# dataframes, lists, etc
|
||||
snippet df
|
||||
${1:name}[${2:rows}, ${3:cols}]
|
||||
snippet c
|
||||
c(${1:items})
|
||||
snippet li
|
||||
list(${1:items})
|
||||
snippet mat
|
||||
matrix(${1:data}, nrow=${2:rows}, ncol=${3:cols})
|
||||
|
||||
# apply functions
|
||||
snippet apply
|
||||
apply(${1:array}, ${2:margin}, ${3:function})
|
||||
snippet lapply
|
||||
lapply(${1:list}, ${2:function})
|
||||
snippet sapply
|
||||
lapply(${1:list}, ${2:function})
|
||||
snippet vapply
|
||||
vapply(${1:list}, ${2:function}, ${3:type})
|
||||
snippet mapply
|
||||
mapply(${1:function}, ${2:...})
|
||||
snippet tapply
|
||||
tapply(${1:vector}, ${2:index}, ${3:function})
|
||||
snippet rapply
|
||||
rapply(${1:list}, ${2:function})
|
||||
|
||||
# plyr functions
|
||||
snippet dd
|
||||
ddply(${1:frame}, ${2:variables}, ${3:function})
|
||||
snippet dl
|
||||
dlply(${1:frame}, ${2:variables}, ${3:function})
|
||||
snippet da
|
||||
daply(${1:frame}, ${2:variables}, ${3:function})
|
||||
snippet d_
|
||||
d_ply(${1:frame}, ${2:variables}, ${3:function})
|
||||
|
||||
snippet ad
|
||||
adply(${1:array}, ${2:margin}, ${3:function})
|
||||
snippet al
|
||||
alply(${1:array}, ${2:margin}, ${3:function})
|
||||
snippet aa
|
||||
aaply(${1:array}, ${2:margin}, ${3:function})
|
||||
snippet a_
|
||||
a_ply(${1:array}, ${2:margin}, ${3:function})
|
||||
|
||||
snippet ld
|
||||
ldply(${1:list}, ${2:function})
|
||||
snippet ll
|
||||
llply(${1:list}, ${2:function})
|
||||
snippet la
|
||||
laply(${1:list}, ${2:function})
|
||||
snippet l_
|
||||
l_ply(${1:list}, ${2:function})
|
||||
|
||||
snippet md
|
||||
mdply(${1:matrix}, ${2:function})
|
||||
snippet ml
|
||||
mlply(${1:matrix}, ${2:function})
|
||||
snippet ma
|
||||
maply(${1:matrix}, ${2:function})
|
||||
snippet m_
|
||||
m_ply(${1:matrix}, ${2:function})
|
||||
|
||||
# plot functions
|
||||
snippet pl
|
||||
plot(${1:x}, ${2:y})
|
||||
snippet ggp
|
||||
ggplot(${1:data}, aes(${2:aesthetics}))
|
||||
snippet img
|
||||
${1:(jpeg,bmp,png,tiff)}(filename="${2:filename}", width=${3}, height=${4}, unit="${5}")
|
||||
${6:plot}
|
||||
dev.off()
|
||||
|
||||
# statistical test functions
|
||||
snippet fis
|
||||
fisher.test(${1:x}, ${2:y})
|
||||
snippet chi
|
||||
chisq.test(${1:x}, ${2:y})
|
||||
snippet tt
|
||||
t.test(${1:x}, ${2:y})
|
||||
snippet wil
|
||||
wilcox.test(${1:x}, ${2:y})
|
||||
snippet cor
|
||||
cor.test(${1:x}, ${2:y})
|
||||
snippet fte
|
||||
var.test(${1:x}, ${2:y})
|
||||
snippet kvt
|
||||
kv.test(${1:x}, ${2:y})
|
||||
22
lib/ace/snippets/rst.snippets
Normal file
22
lib/ace/snippets/rst.snippets
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# rst
|
||||
|
||||
snippet :
|
||||
:${1:field name}: ${2:field body}
|
||||
snippet *
|
||||
*${1:Emphasis}*
|
||||
snippet **
|
||||
**${1:Strong emphasis}**
|
||||
snippet _
|
||||
\`${1:hyperlink-name}\`_
|
||||
.. _\`$1\`: ${2:link-block}
|
||||
snippet =
|
||||
${1:Title}
|
||||
=====${2:=}
|
||||
${3}
|
||||
snippet -
|
||||
${1:Title}
|
||||
-----${2:-}
|
||||
${3}
|
||||
snippet cont:
|
||||
.. contents::
|
||||
|
||||
928
lib/ace/snippets/ruby.snippets
Normal file
928
lib/ace/snippets/ruby.snippets
Normal file
|
|
@ -0,0 +1,928 @@
|
|||
########################################
|
||||
# Ruby snippets - for Rails, see below #
|
||||
########################################
|
||||
|
||||
# encoding for Ruby 1.9
|
||||
snippet enc
|
||||
# encoding: utf-8
|
||||
|
||||
# #!/usr/bin/env ruby
|
||||
snippet #!
|
||||
#!/usr/bin/env ruby
|
||||
# encoding: utf-8
|
||||
|
||||
# New Block
|
||||
snippet =b
|
||||
=begin rdoc
|
||||
${1}
|
||||
=end
|
||||
snippet y
|
||||
:yields: ${1:arguments}
|
||||
snippet rb
|
||||
#!/usr/bin/env ruby -wKU
|
||||
snippet beg
|
||||
begin
|
||||
${3}
|
||||
rescue ${1:Exception} => ${2:e}
|
||||
end
|
||||
|
||||
snippet req require
|
||||
require "${1}"${2}
|
||||
snippet #
|
||||
# =>
|
||||
snippet end
|
||||
__END__
|
||||
snippet case
|
||||
case ${1:object}
|
||||
when ${2:condition}
|
||||
${3}
|
||||
end
|
||||
snippet when
|
||||
when ${1:condition}
|
||||
${2}
|
||||
snippet def
|
||||
def ${1:method_name}
|
||||
${2}
|
||||
end
|
||||
snippet deft
|
||||
def test_${1:case_name}
|
||||
${2}
|
||||
end
|
||||
snippet if
|
||||
if ${1:condition}
|
||||
${2}
|
||||
end
|
||||
snippet ife
|
||||
if ${1:condition}
|
||||
${2}
|
||||
else
|
||||
${3}
|
||||
end
|
||||
snippet elsif
|
||||
elsif ${1:condition}
|
||||
${2}
|
||||
snippet unless
|
||||
unless ${1:condition}
|
||||
${2}
|
||||
end
|
||||
snippet while
|
||||
while ${1:condition}
|
||||
${2}
|
||||
end
|
||||
snippet for
|
||||
for ${1:e} in ${2:c}
|
||||
${3}
|
||||
end
|
||||
snippet until
|
||||
until ${1:condition}
|
||||
${2}
|
||||
end
|
||||
snippet cla class .. end
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
${2}
|
||||
end
|
||||
snippet cla class .. initialize .. end
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
def initialize(${2:args})
|
||||
${3}
|
||||
end
|
||||
end
|
||||
snippet cla class .. < ParentClass .. initialize .. end
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < ${2:ParentClass}
|
||||
def initialize(${3:args})
|
||||
${4}
|
||||
end
|
||||
end
|
||||
snippet cla ClassName = Struct .. do .. end
|
||||
${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} = Struct.new(:${2:attr_names}) do
|
||||
def ${3:method_name}
|
||||
${4}
|
||||
end
|
||||
end
|
||||
snippet cla class BlankSlate .. initialize .. end
|
||||
class ${1:BlankSlate}
|
||||
instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ }
|
||||
end
|
||||
snippet cla class << self .. end
|
||||
class << ${1:self}
|
||||
${2}
|
||||
end
|
||||
# class .. < DelegateClass .. initialize .. end
|
||||
snippet cla-
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < DelegateClass(${2:ParentClass})
|
||||
def initialize(${3:args})
|
||||
super(${4:del_obj})
|
||||
|
||||
${5}
|
||||
end
|
||||
end
|
||||
snippet mod module .. end
|
||||
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
${2}
|
||||
end
|
||||
snippet mod module .. module_function .. end
|
||||
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
module_function
|
||||
|
||||
${2}
|
||||
end
|
||||
snippet mod module .. ClassMethods .. end
|
||||
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
module ClassMethods
|
||||
${2}
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
|
||||
end
|
||||
|
||||
def self.included(receiver)
|
||||
receiver.extend ClassMethods
|
||||
receiver.send :include, InstanceMethods
|
||||
end
|
||||
end
|
||||
# attr_reader
|
||||
snippet r
|
||||
attr_reader :${1:attr_names}
|
||||
# attr_writer
|
||||
snippet w
|
||||
attr_writer :${1:attr_names}
|
||||
# attr_accessor
|
||||
snippet rw
|
||||
attr_accessor :${1:attr_names}
|
||||
snippet atp
|
||||
attr_protected :${1:attr_names}
|
||||
snippet ata
|
||||
attr_accessible :${1:attr_names}
|
||||
# include Enumerable
|
||||
snippet Enum
|
||||
include Enumerable
|
||||
|
||||
def each(&block)
|
||||
${1}
|
||||
end
|
||||
# include Comparable
|
||||
snippet Comp
|
||||
include Comparable
|
||||
|
||||
def <=>(other)
|
||||
${1}
|
||||
end
|
||||
# extend Forwardable
|
||||
snippet Forw-
|
||||
extend Forwardable
|
||||
# def self
|
||||
snippet defs
|
||||
def self.${1:class_method_name}
|
||||
${2}
|
||||
end
|
||||
# def method_missing
|
||||
snippet defmm
|
||||
def method_missing(meth, *args, &blk)
|
||||
${1}
|
||||
end
|
||||
snippet defd
|
||||
def_delegator :${1:@del_obj}, :${2:del_meth}, :${3:new_name}
|
||||
snippet defds
|
||||
def_delegators :${1:@del_obj}, :${2:del_methods}
|
||||
snippet am
|
||||
alias_method :${1:new_name}, :${2:old_name}
|
||||
snippet app
|
||||
if __FILE__ == $PROGRAM_NAME
|
||||
${1}
|
||||
end
|
||||
# usage_if()
|
||||
snippet usai
|
||||
if ARGV.${1}
|
||||
abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${3}
|
||||
end
|
||||
# usage_unless()
|
||||
snippet usau
|
||||
unless ARGV.${1}
|
||||
abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${3}
|
||||
end
|
||||
snippet array
|
||||
Array.new(${1:10}) { |${2:i}| ${3} }
|
||||
snippet hash
|
||||
Hash.new { |${1:hash}, ${2:key}| $1[$2] = ${3} }
|
||||
snippet file File.foreach() { |line| .. }
|
||||
File.foreach(${1:"path/to/file"}) { |${2:line}| ${3} }
|
||||
snippet file File.read()
|
||||
File.read(${1:"path/to/file"})${2}
|
||||
snippet Dir Dir.global() { |file| .. }
|
||||
Dir.glob(${1:"dir/glob/*"}) { |${2:file}| ${3} }
|
||||
snippet Dir Dir[".."]
|
||||
Dir[${1:"glob/**/*.rb"}]${2}
|
||||
snippet dir
|
||||
Filename.dirname(__FILE__)
|
||||
snippet deli
|
||||
delete_if { |${1:e}| ${2} }
|
||||
snippet fil
|
||||
fill(${1:range}) { |${2:i}| ${3} }
|
||||
# flatten_once()
|
||||
snippet flao
|
||||
inject(Array.new) { |${1:arr}, ${2:a}| $1.push(*$2)}${3}
|
||||
snippet zip
|
||||
zip(${1:enums}) { |${2:row}| ${3} }
|
||||
# downto(0) { |n| .. }
|
||||
snippet dow
|
||||
downto(${1:0}) { |${2:n}| ${3} }
|
||||
snippet ste
|
||||
step(${1:2}) { |${2:n}| ${3} }
|
||||
snippet tim
|
||||
times { |${1:n}| ${2} }
|
||||
snippet upt
|
||||
upto(${1:1.0/0.0}) { |${2:n}| ${3} }
|
||||
snippet loo
|
||||
loop { ${1} }
|
||||
snippet ea
|
||||
each { |${1:e}| ${2} }
|
||||
snippet ead
|
||||
each do |${1:e}|
|
||||
${2}
|
||||
end
|
||||
snippet eab
|
||||
each_byte { |${1:byte}| ${2} }
|
||||
snippet eac- each_char { |chr| .. }
|
||||
each_char { |${1:chr}| ${2} }
|
||||
snippet eac- each_cons(..) { |group| .. }
|
||||
each_cons(${1:2}) { |${2:group}| ${3} }
|
||||
snippet eai
|
||||
each_index { |${1:i}| ${2} }
|
||||
snippet eaid
|
||||
each_index do |${1:i}|
|
||||
${2}
|
||||
end
|
||||
snippet eak
|
||||
each_key { |${1:key}| ${2} }
|
||||
snippet eakd
|
||||
each_key do |${1:key}|
|
||||
${2}
|
||||
end
|
||||
snippet eal
|
||||
each_line { |${1:line}| ${2} }
|
||||
snippet eald
|
||||
each_line do |${1:line}|
|
||||
${2}
|
||||
end
|
||||
snippet eap
|
||||
each_pair { |${1:name}, ${2:val}| ${3} }
|
||||
snippet eapd
|
||||
each_pair do |${1:name}, ${2:val}|
|
||||
${3}
|
||||
end
|
||||
snippet eas-
|
||||
each_slice(${1:2}) { |${2:group}| ${3} }
|
||||
snippet easd-
|
||||
each_slice(${1:2}) do |${2:group}|
|
||||
${3}
|
||||
end
|
||||
snippet eav
|
||||
each_value { |${1:val}| ${2} }
|
||||
snippet eavd
|
||||
each_value do |${1:val}|
|
||||
${2}
|
||||
end
|
||||
snippet eawi
|
||||
each_with_index { |${1:e}, ${2:i}| ${3} }
|
||||
snippet eawid
|
||||
each_with_index do |${1:e},${2:i}|
|
||||
${3}
|
||||
end
|
||||
snippet reve
|
||||
reverse_each { |${1:e}| ${2} }
|
||||
snippet reved
|
||||
reverse_each do |${1:e}|
|
||||
${2}
|
||||
end
|
||||
snippet inj
|
||||
inject(${1:init}) { |${2:mem}, ${3:var}| ${4} }
|
||||
snippet injd
|
||||
inject(${1:init}) do |${2:mem}, ${3:var}|
|
||||
${4}
|
||||
end
|
||||
snippet map
|
||||
map { |${1:e}| ${2} }
|
||||
snippet mapd
|
||||
map do |${1:e}|
|
||||
${2}
|
||||
end
|
||||
snippet mapwi-
|
||||
enum_with_index.map { |${1:e}, ${2:i}| ${3} }
|
||||
snippet sor
|
||||
sort { |a, b| ${1} }
|
||||
snippet sorb
|
||||
sort_by { |${1:e}| ${2} }
|
||||
snippet ran
|
||||
sort_by { rand }
|
||||
snippet all
|
||||
all? { |${1:e}| ${2} }
|
||||
snippet any
|
||||
any? { |${1:e}| ${2} }
|
||||
snippet cl
|
||||
classify { |${1:e}| ${2} }
|
||||
snippet col
|
||||
collect { |${1:e}| ${2} }
|
||||
snippet cold
|
||||
collect do |${1:e}|
|
||||
${2}
|
||||
end
|
||||
snippet det
|
||||
detect { |${1:e}| ${2} }
|
||||
snippet detd
|
||||
detect do |${1:e}|
|
||||
${2}
|
||||
end
|
||||
snippet fet
|
||||
fetch(${1:name}) { |${2:key}| ${3} }
|
||||
snippet fin
|
||||
find { |${1:e}| ${2} }
|
||||
snippet find
|
||||
find do |${1:e}|
|
||||
${2}
|
||||
end
|
||||
snippet fina
|
||||
find_all { |${1:e}| ${2} }
|
||||
snippet finad
|
||||
find_all do |${1:e}|
|
||||
${2}
|
||||
end
|
||||
snippet gre
|
||||
grep(${1:/pattern/}) { |${2:match}| ${3} }
|
||||
snippet sub
|
||||
${1:g}sub(${2:/pattern/}) { |${3:match}| ${4} }
|
||||
snippet sca
|
||||
scan(${1:/pattern/}) { |${2:match}| ${3} }
|
||||
snippet scad
|
||||
scan(${1:/pattern/}) do |${2:match}|
|
||||
${3}
|
||||
end
|
||||
snippet max
|
||||
max { |a, b| ${1} }
|
||||
snippet min
|
||||
min { |a, b| ${1} }
|
||||
snippet par
|
||||
partition { |${1:e}| ${2} }
|
||||
snippet pard
|
||||
partition do |${1:e}|
|
||||
${2}
|
||||
end
|
||||
snippet rej
|
||||
reject { |${1:e}| ${2} }
|
||||
snippet rejd
|
||||
reject do |${1:e}|
|
||||
${2}
|
||||
end
|
||||
snippet sel
|
||||
select { |${1:e}| ${2} }
|
||||
snippet seld
|
||||
select do |${1:e}|
|
||||
${2}
|
||||
end
|
||||
snippet lam
|
||||
lambda { |${1:args}| ${2} }
|
||||
snippet doo
|
||||
do
|
||||
${1}
|
||||
end
|
||||
snippet dov
|
||||
do |${1:variable}|
|
||||
${2}
|
||||
end
|
||||
snippet :
|
||||
:${1:key} => ${2:"value"}${3}
|
||||
snippet ope
|
||||
open(${1:"path/or/url/or/pipe"}, "${2:w}") { |${3:io}| ${4} }
|
||||
# path_from_here()
|
||||
snippet fpath
|
||||
File.join(File.dirname(__FILE__), *%2[${1:rel path here}])${2}
|
||||
# unix_filter {}
|
||||
snippet unif
|
||||
ARGF.each_line${1} do |${2:line}|
|
||||
${3}
|
||||
end
|
||||
# option_parse {}
|
||||
snippet optp
|
||||
require "optparse"
|
||||
|
||||
options = {${1:default => "args"}}
|
||||
|
||||
ARGV.options do |opts|
|
||||
opts.banner = "Usage: #{File.basename($PROGRAM_NAME)}
|
||||
snippet opt
|
||||
opts.on( "-${1:o}", "--${2:long-option-name}", ${3:String},
|
||||
"${4:Option description.}") do |${5:opt}|
|
||||
${6}
|
||||
end
|
||||
snippet tc
|
||||
require "test/unit"
|
||||
|
||||
require "${1:library_file_name}"
|
||||
|
||||
class Test${2:$1} < Test::Unit::TestCase
|
||||
def test_${3:case_name}
|
||||
${4}
|
||||
end
|
||||
end
|
||||
snippet ts
|
||||
require "test/unit"
|
||||
|
||||
require "tc_${1:test_case_file}"
|
||||
require "tc_${2:test_case_file}"${3}
|
||||
snippet as
|
||||
assert ${1:test}, "${2:Failure message.}"${3}
|
||||
snippet ase
|
||||
assert_equal ${1:expected}, ${2:actual}${3}
|
||||
snippet asne
|
||||
assert_not_equal ${1:unexpected}, ${2:actual}${3}
|
||||
snippet asid
|
||||
assert_in_delta ${1:expected_float}, ${2:actual_float}, ${3:2 ** -20}${4}
|
||||
snippet asio
|
||||
assert_instance_of ${1:ExpectedClass}, ${2:actual_instance}${3}
|
||||
snippet asko
|
||||
assert_kind_of ${1:ExpectedKind}, ${2:actual_instance}${3}
|
||||
snippet asn
|
||||
assert_nil ${1:instance}${2}
|
||||
snippet asnn
|
||||
assert_not_nil ${1:instance}${2}
|
||||
snippet asm
|
||||
assert_match /${1:expected_pattern}/, ${2:actual_string}${3}
|
||||
snippet asnm
|
||||
assert_no_match /${1:unexpected_pattern}/, ${2:actual_string}${3}
|
||||
snippet aso
|
||||
assert_operator ${1:left}, :${2:operator}, ${3:right}${4}
|
||||
snippet asr
|
||||
assert_raise ${1:Exception} { ${2} }
|
||||
snippet asrd
|
||||
assert_raise ${1:Exception} do
|
||||
${2}
|
||||
end
|
||||
snippet asnr
|
||||
assert_nothing_raised ${1:Exception} { ${2} }
|
||||
snippet asnrd
|
||||
assert_nothing_raised ${1:Exception} do
|
||||
${2}
|
||||
end
|
||||
snippet asrt
|
||||
assert_respond_to ${1:object}, :${2:method}${3}
|
||||
snippet ass assert_same(..)
|
||||
assert_same ${1:expected}, ${2:actual}${3}
|
||||
snippet ass assert_send(..)
|
||||
assert_send [${1:object}, :${2:message}, ${3:args}]${4}
|
||||
snippet asns
|
||||
assert_not_same ${1:unexpected}, ${2:actual}${3}
|
||||
snippet ast
|
||||
assert_throws :${1:expected} { ${2} }
|
||||
snippet astd
|
||||
assert_throws :${1:expected} do
|
||||
${2}
|
||||
end
|
||||
snippet asnt
|
||||
assert_nothing_thrown { ${1} }
|
||||
snippet asntd
|
||||
assert_nothing_thrown do
|
||||
${1}
|
||||
end
|
||||
snippet fl
|
||||
flunk "${1:Failure message.}"${2}
|
||||
# Benchmark.bmbm do .. end
|
||||
snippet bm-
|
||||
TESTS = ${1:10_000}
|
||||
Benchmark.bmbm do |results|
|
||||
${2}
|
||||
end
|
||||
snippet rep
|
||||
results.report("${1:name}:") { TESTS.times { ${2} }}
|
||||
# Marshal.dump(.., file)
|
||||
snippet Md
|
||||
File.open(${1:"path/to/file.dump"}, "wb") { |${2:file}| Marshal.dump(${3:obj}, $2) }${4}
|
||||
# Mashal.load(obj)
|
||||
snippet Ml
|
||||
File.open(${1:"path/to/file.dump"}, "rb") { |${2:file}| Marshal.load($2) }${3}
|
||||
# deep_copy(..)
|
||||
snippet deec
|
||||
Marshal.load(Marshal.dump(${1:obj_to_copy}))${2}
|
||||
snippet Pn-
|
||||
PStore.new(${1:"file_name.pstore"})${2}
|
||||
snippet tra
|
||||
transaction(${1:true}) { ${2} }
|
||||
# xmlread(..)
|
||||
snippet xml-
|
||||
REXML::Document.new(File.read(${1:"path/to/file"}))${2}
|
||||
# xpath(..) { .. }
|
||||
snippet xpa
|
||||
elements.each(${1:"//Xpath"}) do |${2:node}|
|
||||
${3}
|
||||
end
|
||||
# class_from_name()
|
||||
snippet clafn
|
||||
split("::").inject(Object) { |par, const| par.const_get(const) }
|
||||
# singleton_class()
|
||||
snippet sinc
|
||||
class << self; self end
|
||||
snippet nam
|
||||
namespace :${1:`Filename()`} do
|
||||
${2}
|
||||
end
|
||||
snippet tas
|
||||
desc "${1:Task description}"
|
||||
task :${2:task_name => [:dependent, :tasks]} do
|
||||
${3}
|
||||
end
|
||||
# block
|
||||
snippet b
|
||||
{ |${1:var}| ${2} }
|
||||
snippet begin
|
||||
begin
|
||||
raise 'A test exception.'
|
||||
rescue Exception => e
|
||||
puts e.message
|
||||
puts e.backtrace.inspect
|
||||
else
|
||||
# other exception
|
||||
ensure
|
||||
# always executed
|
||||
end
|
||||
|
||||
#debugging
|
||||
snippet debug
|
||||
require 'ruby-debug'; debugger; true;
|
||||
snippet pry
|
||||
require 'pry'; binding.pry
|
||||
|
||||
#############################################
|
||||
# Rails snippets - for pure Ruby, see above #
|
||||
#############################################
|
||||
snippet art
|
||||
assert_redirected_to ${1::action => "${2:index}"}
|
||||
snippet artnp
|
||||
assert_redirected_to ${1:parent}_${2:child}_path(${3:@$1}, ${4:@$2})
|
||||
snippet artnpp
|
||||
assert_redirected_to ${1:parent}_${2:child}_path(${3:@$1})
|
||||
snippet artp
|
||||
assert_redirected_to ${1:model}_path(${2:@$1})
|
||||
snippet artpp
|
||||
assert_redirected_to ${1:model}s_path
|
||||
snippet asd
|
||||
assert_difference "${1:Model}.${2:count}", $1 do
|
||||
${3}
|
||||
end
|
||||
snippet asnd
|
||||
assert_no_difference "${1:Model}.${2:count}" do
|
||||
${3}
|
||||
end
|
||||
snippet asre
|
||||
assert_response :${1:success}, @response.body${2}
|
||||
snippet asrj
|
||||
assert_rjs :${1:replace}, "${2:dom id}"
|
||||
snippet ass assert_select(..)
|
||||
assert_select '${1:path}', :${2:text} => '${3:inner_html' ${4:do}
|
||||
snippet bf
|
||||
before_filter :${1:method}
|
||||
snippet bt
|
||||
belongs_to :${1:association}
|
||||
snippet crw
|
||||
cattr_accessor :${1:attr_names}
|
||||
snippet defcreate
|
||||
def create
|
||||
@${1:model_class_name} = ${2:ModelClassName}.new(params[:$1])
|
||||
|
||||
respond_to do |wants|
|
||||
if @$1.save
|
||||
flash[:notice] = '$2 was successfully created.'
|
||||
wants.html { redirect_to(@$1) }
|
||||
wants.xml { render :xml => @$1, :status => :created, :location => @$1 }
|
||||
else
|
||||
wants.html { render :action => "new" }
|
||||
wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end${3}
|
||||
snippet defdestroy
|
||||
def destroy
|
||||
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
|
||||
@$1.destroy
|
||||
|
||||
respond_to do |wants|
|
||||
wants.html { redirect_to($1s_url) }
|
||||
wants.xml { head :ok }
|
||||
end
|
||||
end${3}
|
||||
snippet defedit
|
||||
def edit
|
||||
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
|
||||
end
|
||||
snippet defindex
|
||||
def index
|
||||
@${1:model_class_name} = ${2:ModelClassName}.all
|
||||
|
||||
respond_to do |wants|
|
||||
wants.html # index.html.erb
|
||||
wants.xml { render :xml => @$1s }
|
||||
end
|
||||
end${3}
|
||||
snippet defnew
|
||||
def new
|
||||
@${1:model_class_name} = ${2:ModelClassName}.new
|
||||
|
||||
respond_to do |wants|
|
||||
wants.html # new.html.erb
|
||||
wants.xml { render :xml => @$1 }
|
||||
end
|
||||
end${3}
|
||||
snippet defshow
|
||||
def show
|
||||
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
|
||||
|
||||
respond_to do |wants|
|
||||
wants.html # show.html.erb
|
||||
wants.xml { render :xml => @$1 }
|
||||
end
|
||||
end${3}
|
||||
snippet defupdate
|
||||
def update
|
||||
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
|
||||
|
||||
respond_to do |wants|
|
||||
if @$1.update_attributes(params[:$1])
|
||||
flash[:notice] = '$2 was successfully updated.'
|
||||
wants.html { redirect_to(@$1) }
|
||||
wants.xml { head :ok }
|
||||
else
|
||||
wants.html { render :action => "edit" }
|
||||
wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end${3}
|
||||
snippet flash
|
||||
flash[:${1:notice}] = "${2}"
|
||||
snippet habtm
|
||||
has_and_belongs_to_many :${1:object}, :join_table => "${2:table_name}", :foreign_key => "${3}_id"${4}
|
||||
snippet hm
|
||||
has_many :${1:object}
|
||||
snippet hmd
|
||||
has_many :${1:other}s, :class_name => "${2:$1}", :foreign_key => "${3:$1}_id", :dependent => :destroy${4}
|
||||
snippet hmt
|
||||
has_many :${1:object}, :through => :${2:object}
|
||||
snippet ho
|
||||
has_one :${1:object}
|
||||
snippet i18
|
||||
I18n.t('${1:type.key}')${2}
|
||||
snippet ist
|
||||
<%= image_submit_tag("${1:agree.png}", :id => "${2:id}"${3} %>
|
||||
snippet log
|
||||
Rails.logger.${1:debug} ${2}
|
||||
snippet log2
|
||||
RAILS_DEFAULT_LOGGER.${1:debug} ${2}
|
||||
snippet logd
|
||||
logger.debug { "${1:message}" }${2}
|
||||
snippet loge
|
||||
logger.error { "${1:message}" }${2}
|
||||
snippet logf
|
||||
logger.fatal { "${1:message}" }${2}
|
||||
snippet logi
|
||||
logger.info { "${1:message}" }${2}
|
||||
snippet logw
|
||||
logger.warn { "${1:message}" }${2}
|
||||
snippet mapc
|
||||
${1:map}.${2:connect} '${3:controller/:action/:id}'
|
||||
snippet mapca
|
||||
${1:map}.catch_all "*${2:anything}", :controller => "${3:default}", :action => "${4:error}"${5}
|
||||
snippet mapr
|
||||
${1:map}.resource :${2:resource}
|
||||
snippet maprs
|
||||
${1:map}.resources :${2:resource}
|
||||
snippet mapwo
|
||||
${1:map}.with_options :${2:controller} => '${3:thing}' do |$3|
|
||||
${4}
|
||||
end
|
||||
snippet mbs
|
||||
before_save :${1:method}
|
||||
snippet mcht
|
||||
change_table :${1:table_name} do |t|
|
||||
${2}
|
||||
end
|
||||
snippet mp
|
||||
map(&:${1:id})
|
||||
snippet mrw
|
||||
mattr_accessor :${1:attr_names}
|
||||
snippet oa
|
||||
order("${1:field}")
|
||||
snippet od
|
||||
order("${1:field} DESC")
|
||||
snippet pa
|
||||
params[:${1:id}]${2}
|
||||
snippet ra
|
||||
render :action => "${1:action}"
|
||||
snippet ral
|
||||
render :action => "${1:action}", :layout => "${2:layoutname}"
|
||||
snippet rest
|
||||
respond_to do |wants|
|
||||
wants.${1:html} { ${2} }
|
||||
end
|
||||
snippet rf
|
||||
render :file => "${1:filepath}"
|
||||
snippet rfu
|
||||
render :file => "${1:filepath}", :use_full_path => ${2:false}
|
||||
snippet ri
|
||||
render :inline => "${1:<%= 'hello' %>}"
|
||||
snippet ril
|
||||
render :inline => "${1:<%= 'hello' %>}", :locals => { ${2::name} => "${3:value}"${4} }
|
||||
snippet rit
|
||||
render :inline => "${1:<%= 'hello' %>}", :type => ${2::rxml}
|
||||
snippet rjson
|
||||
render :json => ${1:text to render}
|
||||
snippet rl
|
||||
render :layout => "${1:layoutname}"
|
||||
snippet rn
|
||||
render :nothing => ${1:true}
|
||||
snippet rns
|
||||
render :nothing => ${1:true}, :status => ${2:401}
|
||||
snippet rp
|
||||
render :partial => "${1:item}"
|
||||
snippet rpc
|
||||
render :partial => "${1:item}", :collection => ${2:@$1s}
|
||||
snippet rpl
|
||||
render :partial => "${1:item}", :locals => { :${2:$1} => ${3:@$1}
|
||||
snippet rpo
|
||||
render :partial => "${1:item}", :object => ${2:@$1}
|
||||
snippet rps
|
||||
render :partial => "${1:item}", :status => ${2:500}
|
||||
snippet rt
|
||||
render :text => "${1:text to render}"
|
||||
snippet rtl
|
||||
render :text => "${1:text to render}", :layout => "${2:layoutname}"
|
||||
snippet rtlt
|
||||
render :text => "${1:text to render}", :layout => ${2:true}
|
||||
snippet rts
|
||||
render :text => "${1:text to render}", :status => ${2:401}
|
||||
snippet ru
|
||||
render :update do |${1:page}|
|
||||
$1.${2}
|
||||
end
|
||||
snippet rxml
|
||||
render :xml => ${1:text to render}
|
||||
snippet sc
|
||||
scope :${1:name}, :where(:@${2:field} => ${3:value})
|
||||
snippet sl
|
||||
scope :${1:name}, lambda do |${2:value}|
|
||||
where("${3:field = ?}", ${4:bind var})
|
||||
end
|
||||
snippet sha1
|
||||
Digest::SHA1.hexdigest(${1:string})
|
||||
snippet sweeper
|
||||
class ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper
|
||||
observe $1
|
||||
|
||||
def after_save(${2:model_class_name})
|
||||
expire_cache($2)
|
||||
end
|
||||
|
||||
def after_destroy($2)
|
||||
expire_cache($2)
|
||||
end
|
||||
|
||||
def expire_cache($2)
|
||||
expire_page
|
||||
end
|
||||
end
|
||||
snippet tcb
|
||||
t.boolean :${1:title}
|
||||
${2}
|
||||
snippet tcbi
|
||||
t.binary :${1:title}, :limit => ${2:2}.megabytes
|
||||
${3}
|
||||
snippet tcd
|
||||
t.decimal :${1:title}, :precision => ${2:10}, :scale => ${3:2}
|
||||
${4}
|
||||
snippet tcda
|
||||
t.date :${1:title}
|
||||
${2}
|
||||
snippet tcdt
|
||||
t.datetime :${1:title}
|
||||
${2}
|
||||
snippet tcf
|
||||
t.float :${1:title}
|
||||
${2}
|
||||
snippet tch
|
||||
t.change :${1:name}, :${2:string}, :${3:limit} => ${4:80}
|
||||
${5}
|
||||
snippet tci
|
||||
t.integer :${1:title}
|
||||
${2}
|
||||
snippet tcl
|
||||
t.integer :lock_version, :null => false, :default => 0
|
||||
${1}
|
||||
snippet tcr
|
||||
t.references :${1:taggable}, :polymorphic => { :default => '${2:Photo}' }
|
||||
${3}
|
||||
snippet tcs
|
||||
t.string :${1:title}
|
||||
${2}
|
||||
snippet tct
|
||||
t.text :${1:title}
|
||||
${2}
|
||||
snippet tcti
|
||||
t.time :${1:title}
|
||||
${2}
|
||||
snippet tcts
|
||||
t.timestamp :${1:title}
|
||||
${2}
|
||||
snippet tctss
|
||||
t.timestamps
|
||||
${1}
|
||||
snippet va
|
||||
validates_associated :${1:attribute}
|
||||
snippet vao
|
||||
validates_acceptance_of :${1:terms}
|
||||
snippet vc
|
||||
validates_confirmation_of :${1:attribute}
|
||||
snippet ve
|
||||
validates_exclusion_of :${1:attribute}, :in => ${2:%w( mov avi )}
|
||||
snippet vf
|
||||
validates_format_of :${1:attribute}, :with => /${2:regex}/
|
||||
snippet vi
|
||||
validates_inclusion_of :${1:attribute}, :in => %w(${2: mov avi })
|
||||
snippet vl
|
||||
validates_length_of :${1:attribute}, :within => ${2:3}..${3:20}
|
||||
snippet vn
|
||||
validates_numericality_of :${1:attribute}
|
||||
snippet vpo
|
||||
validates_presence_of :${1:attribute}
|
||||
snippet vu
|
||||
validates_uniqueness_of :${1:attribute}
|
||||
snippet wants
|
||||
wants.${1:js|xml|html} { ${2} }
|
||||
snippet wc
|
||||
where(${1:"conditions"}${2:, bind_var})
|
||||
snippet wh
|
||||
where(${1:field} => ${2:value})
|
||||
snippet xdelete
|
||||
xhr :delete, :${1:destroy}, :id => ${2:1}${3}
|
||||
snippet xget
|
||||
xhr :get, :${1:show}, :id => ${2:1}${3}
|
||||
snippet xpost
|
||||
xhr :post, :${1:create}, :${2:object} => { ${3} }
|
||||
snippet xput
|
||||
xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { ${4} }${5}
|
||||
snippet test
|
||||
test "should ${1:do something}" do
|
||||
${2}
|
||||
end
|
||||
#migrations
|
||||
snippet mac
|
||||
add_column :${1:table_name}, :${2:column_name}, :${3:data_type}
|
||||
snippet mrc
|
||||
remove_column :${1:table_name}, :${2:column_name}
|
||||
snippet mrnc
|
||||
rename_column :${1:table_name}, :${2:old_column_name}, :${3:new_column_name}
|
||||
snippet mcc
|
||||
change_column :${1:table}, :${2:column}, :${3:type}
|
||||
snippet mccc
|
||||
t.column :${1:title}, :${2:string}
|
||||
snippet mct
|
||||
create_table :${1:table_name} do |t|
|
||||
t.column :${2:name}, :${3:type}
|
||||
end
|
||||
snippet migration
|
||||
class ${1:class_name} < ActiveRecord::Migration
|
||||
def self.up
|
||||
${2}
|
||||
end
|
||||
|
||||
def self.down
|
||||
end
|
||||
end
|
||||
|
||||
snippet trc
|
||||
t.remove :${1:column}
|
||||
snippet tre
|
||||
t.rename :${1:old_column_name}, :${2:new_column_name}
|
||||
${3}
|
||||
snippet tref
|
||||
t.references :${1:model}
|
||||
|
||||
#rspec
|
||||
snippet it
|
||||
it "${1:spec_name}" do
|
||||
${2}
|
||||
end
|
||||
snippet itp
|
||||
it "${1:spec_name}"
|
||||
${2}
|
||||
snippet desc
|
||||
describe ${1:class_name} do
|
||||
${2}
|
||||
end
|
||||
snippet cont
|
||||
context "${1:message}" do
|
||||
${2}
|
||||
end
|
||||
snippet bef
|
||||
before :${1:each} do
|
||||
${2}
|
||||
end
|
||||
snippet aft
|
||||
after :${1:each} do
|
||||
${2}
|
||||
end
|
||||
83
lib/ace/snippets/sh.snippets
Normal file
83
lib/ace/snippets/sh.snippets
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
# Shebang. Executing bash via /usr/bin/env makes scripts more portable.
|
||||
snippet #!
|
||||
#!/usr/bin/env bash
|
||||
|
||||
snippet if
|
||||
if [[ ${1:condition} ]]; then
|
||||
${2:#statements}
|
||||
fi
|
||||
snippet elif
|
||||
elif [[ ${1:condition} ]]; then
|
||||
${2:#statements}
|
||||
snippet for
|
||||
for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do
|
||||
${3:#statements}
|
||||
done
|
||||
snippet fori
|
||||
for ${1:needle} in ${2:haystack} ; do
|
||||
${3:#statements}
|
||||
done
|
||||
snippet wh
|
||||
while [[ ${1:condition} ]]; do
|
||||
${2:#statements}
|
||||
done
|
||||
snippet until
|
||||
until [[ ${1:condition} ]]; do
|
||||
${2:#statements}
|
||||
done
|
||||
snippet case
|
||||
case ${1:word} in
|
||||
${2:pattern})
|
||||
${3};;
|
||||
esac
|
||||
snippet go
|
||||
while getopts '${1:o}' ${2:opts}
|
||||
do
|
||||
case $$2 in
|
||||
${3:o0})
|
||||
${4:#staments};;
|
||||
esac
|
||||
done
|
||||
# Set SCRIPT_DIR variable to directory script is located.
|
||||
snippet sdir
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# getopt
|
||||
snippet getopt
|
||||
__ScriptVersion="${1:version}"
|
||||
|
||||
#=== FUNCTION ================================================================
|
||||
# NAME: usage
|
||||
# DESCRIPTION: Display usage information.
|
||||
#===============================================================================
|
||||
function usage ()
|
||||
{
|
||||
cat <<- EOT
|
||||
|
||||
Usage : $${0:0} [options] [--]
|
||||
|
||||
Options:
|
||||
-h|help Display this message
|
||||
-v|version Display script version
|
||||
|
||||
EOT
|
||||
} # ---------- end of function usage ----------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Handle command line arguments
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
while getopts ":hv" opt
|
||||
do
|
||||
case $opt in
|
||||
|
||||
h|help ) usage; exit 0 ;;
|
||||
|
||||
v|version ) echo "$${0:0} -- Version $__ScriptVersion"; exit 0 ;;
|
||||
|
||||
\? ) echo -e "\n Option does not exist : $OPTARG\n"
|
||||
usage; exit 1 ;;
|
||||
|
||||
esac # --- end of case ---
|
||||
done
|
||||
shift $(($OPTIND-1))
|
||||
|
||||
9
lib/ace/snippets/snippets.snippets
Normal file
9
lib/ace/snippets/snippets.snippets
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# snippets for making snippets :)
|
||||
snippet snip
|
||||
snippet ${1:trigger}
|
||||
${2}
|
||||
snippet msnip
|
||||
snippet ${1:trigger} ${2:description}
|
||||
${3}
|
||||
snippet v
|
||||
{VISUAL}
|
||||
26
lib/ace/snippets/sql.snippets
Normal file
26
lib/ace/snippets/sql.snippets
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
snippet tbl
|
||||
create table ${1:table} (
|
||||
${2:columns}
|
||||
);
|
||||
snippet col
|
||||
${1:name} ${2:type} ${3:default ''} ${4:not null}
|
||||
snippet ccol
|
||||
${1:name} varchar2(${2:size}) ${3:default ''} ${4:not null}
|
||||
snippet ncol
|
||||
${1:name} number ${3:default 0} ${4:not null}
|
||||
snippet dcol
|
||||
${1:name} date ${3:default sysdate} ${4:not null}
|
||||
snippet ind
|
||||
create index ${3:$1_$2} on ${1:table}(${2:column});
|
||||
snippet uind
|
||||
create unique index ${1:name} on ${2:table}(${3:column});
|
||||
snippet tblcom
|
||||
comment on table ${1:table} is '${2:comment}';
|
||||
snippet colcom
|
||||
comment on column ${1:table}.${2:column} is '${3:comment}';
|
||||
snippet addcol
|
||||
alter table ${1:table} add (${2:column} ${3:type});
|
||||
snippet seq
|
||||
create sequence ${1:name} start with ${2:1} increment by ${3:1} minvalue ${4:1};
|
||||
snippet s*
|
||||
select * from ${1:table}
|
||||
92
lib/ace/snippets/tcl.snippets
Normal file
92
lib/ace/snippets/tcl.snippets
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
# #!/usr/bin/env tclsh
|
||||
snippet #!
|
||||
#!/usr/bin/env tclsh
|
||||
|
||||
# Process
|
||||
snippet pro
|
||||
proc ${1:function_name} {${2:args}} {
|
||||
${3:#body ...}
|
||||
}
|
||||
#xif
|
||||
snippet xif
|
||||
${1:expr}? ${2:true} : ${3:false}
|
||||
# Conditional
|
||||
snippet if
|
||||
if {${1}} {
|
||||
${2:# body...}
|
||||
}
|
||||
# Conditional if..else
|
||||
snippet ife
|
||||
if {${1}} {
|
||||
${2:# body...}
|
||||
} else {
|
||||
${3:# else...}
|
||||
}
|
||||
# Conditional if..elsif..else
|
||||
snippet ifee
|
||||
if {${1}} {
|
||||
${2:# body...}
|
||||
} elseif {${3}} {
|
||||
${4:# elsif...}
|
||||
} else {
|
||||
${5:# else...}
|
||||
}
|
||||
# If catch then
|
||||
snippet ifc
|
||||
if { [catch {${1:#do something...}} ${2:err}] } {
|
||||
${3:# handle failure...}
|
||||
}
|
||||
# Catch
|
||||
snippet catch
|
||||
catch {${1}} ${2:err} ${3:options}
|
||||
# While Loop
|
||||
snippet wh
|
||||
while {${1}} {
|
||||
${2:# body...}
|
||||
}
|
||||
# For Loop
|
||||
snippet for
|
||||
for {set ${2:var} 0} {$$2 < ${1:count}} {${3:incr} $2} {
|
||||
${4:# body...}
|
||||
}
|
||||
# Foreach Loop
|
||||
snippet fore
|
||||
foreach ${1:x} {${2:#list}} {
|
||||
${3:# body...}
|
||||
}
|
||||
# after ms script...
|
||||
snippet af
|
||||
after ${1:ms} ${2:#do something}
|
||||
# after cancel id
|
||||
snippet afc
|
||||
after cancel ${1:id or script}
|
||||
# after idle
|
||||
snippet afi
|
||||
after idle ${1:script}
|
||||
# after info id
|
||||
snippet afin
|
||||
after info ${1:id}
|
||||
# Expr
|
||||
snippet exp
|
||||
expr {${1:#expression here}}
|
||||
# Switch
|
||||
snippet sw
|
||||
switch ${1:var} {
|
||||
${3:pattern 1} {
|
||||
${4:#do something}
|
||||
}
|
||||
default {
|
||||
${2:#do something}
|
||||
}
|
||||
}
|
||||
# Case
|
||||
snippet ca
|
||||
${1:pattern} {
|
||||
${2:#do something}
|
||||
}${3}
|
||||
# Namespace eval
|
||||
snippet ns
|
||||
namespace eval ${1:path} {${2:#script...}}
|
||||
# Namespace current
|
||||
snippet nsc
|
||||
namespace current
|
||||
191
lib/ace/snippets/tex.snippets
Normal file
191
lib/ace/snippets/tex.snippets
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
#PREAMBLE
|
||||
#newcommand
|
||||
snippet nc
|
||||
\newcommand{\${1:cmd}}[${2:opt}]{${3:realcmd}}${4}
|
||||
#usepackage
|
||||
snippet up
|
||||
\usepackage[${1:[options}]{${2:package}}
|
||||
#newunicodechar
|
||||
snippet nuc
|
||||
\newunicodechar{${1}}{${2:\ensuremath}${3:tex-substitute}}}
|
||||
#DeclareMathOperator
|
||||
snippet dmo
|
||||
\DeclareMathOperator{${1}}{${2}}
|
||||
|
||||
#DOCUMENT
|
||||
# \begin{}...\end{}
|
||||
snippet begin
|
||||
\begin{${1:env}}
|
||||
${2}
|
||||
\end{$1}
|
||||
# Tabular
|
||||
snippet tab
|
||||
\begin{${1:tabular}}{${2:c}}
|
||||
${3}
|
||||
\end{$1}
|
||||
snippet thm
|
||||
\begin[${1:author}]{${2:thm}}
|
||||
${3}
|
||||
\end{$1}
|
||||
snippet center
|
||||
\begin{center}
|
||||
${1}
|
||||
\end{center}
|
||||
# Align(ed)
|
||||
snippet ali
|
||||
\begin{align${1:ed}}
|
||||
${2}
|
||||
\end{align$1}
|
||||
# Gather(ed)
|
||||
snippet gat
|
||||
\begin{gather${1:ed}}
|
||||
${2}
|
||||
\end{gather$1}
|
||||
# Equation
|
||||
snippet eq
|
||||
\begin{equation}
|
||||
${1}
|
||||
\end{equation}
|
||||
# Equation
|
||||
snippet eq*
|
||||
\begin{equation*}
|
||||
${1}
|
||||
\end{equation*}
|
||||
# Unnumbered Equation
|
||||
snippet \
|
||||
\[
|
||||
${1}
|
||||
\]
|
||||
# Enumerate
|
||||
snippet enum
|
||||
\begin{enumerate}
|
||||
\item ${1}
|
||||
\end{enumerate}
|
||||
# Itemize
|
||||
snippet itemize
|
||||
\begin{itemize}
|
||||
\item ${1}
|
||||
\end{itemize}
|
||||
# Description
|
||||
snippet desc
|
||||
\begin{description}
|
||||
\item[${1}] ${2}
|
||||
\end{description}
|
||||
# Matrix
|
||||
snippet mat
|
||||
\begin{${1:p/b/v/V/B/small}matrix}
|
||||
${2}
|
||||
\end{$1matrix}
|
||||
# Cases
|
||||
snippet cas
|
||||
\begin{cases}
|
||||
${1:equation}, &\text{ if }${2:case}\\
|
||||
${3}
|
||||
\end{cases}
|
||||
# Split
|
||||
snippet spl
|
||||
\begin{split}
|
||||
${1}
|
||||
\end{split}
|
||||
# Part
|
||||
snippet part
|
||||
\part{${1:part name}} % (fold)
|
||||
\label{prt:${2:$1}}
|
||||
${3}
|
||||
% part $2 (end)
|
||||
# Chapter
|
||||
snippet cha
|
||||
\chapter{${1:chapter name}}
|
||||
\label{cha:${2:$1}}
|
||||
${3}
|
||||
# Section
|
||||
snippet sec
|
||||
\section{${1:section name}}
|
||||
\label{sec:${2:$1}}
|
||||
${3}
|
||||
# Sub Section
|
||||
snippet sub
|
||||
\subsection{${1:subsection name}}
|
||||
\label{sub:${2:$1}}
|
||||
${3}
|
||||
# Sub Sub Section
|
||||
snippet subs
|
||||
\subsubsection{${1:subsubsection name}}
|
||||
\label{ssub:${2:$1}}
|
||||
${3}
|
||||
# Paragraph
|
||||
snippet par
|
||||
\paragraph{${1:paragraph name}}
|
||||
\label{par:${2:$1}}
|
||||
${3}
|
||||
# Sub Paragraph
|
||||
snippet subp
|
||||
\subparagraph{${1:subparagraph name}}
|
||||
\label{subp:${2:$1}}
|
||||
${3}
|
||||
#References
|
||||
snippet itd
|
||||
\item[${1:description}] ${2:item}
|
||||
snippet figure
|
||||
${1:Figure}~\ref{${2:fig:}}${3}
|
||||
snippet table
|
||||
${1:Table}~\ref{${2:tab:}}${3}
|
||||
snippet listing
|
||||
${1:Listing}~\ref{${2:list}}${3}
|
||||
snippet section
|
||||
${1:Section}~\ref{${2:sec:}}${3}
|
||||
snippet page
|
||||
${1:page}~\pageref{${2}}${3}
|
||||
snippet index
|
||||
\index{${1:index}}${2}
|
||||
#Citations
|
||||
snippet cite
|
||||
\cite[${1}]{${2}}${3}
|
||||
snippet fcite
|
||||
\footcite[${1}]{${2}}${3}
|
||||
#Formating text: italic, bold, underline, small capital, emphase ..
|
||||
snippet it
|
||||
\textit{${1:text}}
|
||||
snippet bf
|
||||
\textbf{${1:text}}
|
||||
snippet under
|
||||
\underline{${1:text}}
|
||||
snippet emp
|
||||
\emph{${1:text}}
|
||||
snippet sc
|
||||
\textsc{${1:text}}
|
||||
#Choosing font
|
||||
snippet sf
|
||||
\textsf{${1:text}}
|
||||
snippet rm
|
||||
\textrm{${1:text}}
|
||||
snippet tt
|
||||
\texttt{${1:text}}
|
||||
#misc
|
||||
snippet ft
|
||||
\footnote{${1:text}}
|
||||
snippet fig
|
||||
\begin{figure}
|
||||
\begin{center}
|
||||
\includegraphics[scale=${1}]{Figures/${2}}
|
||||
\end{center}
|
||||
\caption{${3}}
|
||||
\label{fig:${4}}
|
||||
\end{figure}
|
||||
snippet tikz
|
||||
\begin{figure}
|
||||
\begin{center}
|
||||
\begin{tikzpicture}[scale=${1:1}]
|
||||
${2}
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
\caption{${3}}
|
||||
\label{fig:${4}}
|
||||
\end{figure}
|
||||
#math
|
||||
snippet stackrel
|
||||
\stackrel{${1:above}}{${2:below}} ${3}
|
||||
snippet frac
|
||||
\frac{${1:num}}{${2:denom}}
|
||||
snippet sum
|
||||
\sum^{${1:n}}_{${2:i=1}}{${3}}
|
||||
30
lib/ace/snippets/textile.snippets
Normal file
30
lib/ace/snippets/textile.snippets
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Jekyll post header
|
||||
snippet header
|
||||
---
|
||||
title: ${1:title}
|
||||
layout: post
|
||||
date: ${2:date} ${3:hour:minute:second} -05:00
|
||||
---
|
||||
|
||||
# Image
|
||||
snippet img
|
||||
!${1:url}(${2:title}):${3:link}!
|
||||
|
||||
# Table
|
||||
snippet |
|
||||
|${1}|${2}
|
||||
|
||||
# Link
|
||||
snippet link
|
||||
"${1:link text}":${2:url}
|
||||
|
||||
# Acronym
|
||||
snippet (
|
||||
(${1:Expand acronym})${2}
|
||||
|
||||
# Footnote
|
||||
snippet fn
|
||||
[${1:ref number}] ${3}
|
||||
|
||||
fn$1. ${2:footnote}
|
||||
|
||||
97
lib/ace/snippets/xslt.snippets
Normal file
97
lib/ace/snippets/xslt.snippets
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
snippet apply-templates with-param
|
||||
<xsl:apply-templates select="${1:*}">
|
||||
<xsl:with-param name="${2:param}">${3}</xsl:with-param>${4}
|
||||
</xsl:apply-templates>${5}
|
||||
|
||||
snippet apply-templates sort-by
|
||||
<xsl:apply-templates select="${1:*}">
|
||||
<xsl:sort select="${2:node}" order="${3:ascending}" data-type="${4:text}">${5}
|
||||
</xsl:apply-templates>${6}
|
||||
|
||||
snippet apply-templates plain
|
||||
<xsl:apply-templates select="${1:*}" />${2}
|
||||
|
||||
snippet attribute blank
|
||||
<xsl:attribute name="${1:name}">${2}</xsl:attribute>${3}
|
||||
|
||||
snippet attribute value-of
|
||||
<xsl:attribute name="${1:name}">
|
||||
<xsl:value-of select="${2:*}" />
|
||||
</xsl:attribute>${3}
|
||||
|
||||
snippet call-template
|
||||
<xsl:call-template name="${1:template}" />
|
||||
|
||||
snippet call-template with-param
|
||||
<xsl:call-template name="${1:template}">
|
||||
<xsl:with-param name="${2:param}">${3}</xsl:with-param>${4}
|
||||
</xsl:call-template>${5}
|
||||
|
||||
snippet choose
|
||||
<xsl:choose>
|
||||
<xsl:when test="${1:value}">
|
||||
${2}
|
||||
</xsl:when>${3}
|
||||
</xsl:choose>
|
||||
|
||||
snippet copy-of
|
||||
<xsl:copy-of select="${1:*}" />${2}
|
||||
|
||||
snippet for-each
|
||||
<xsl:for-each select="${1:*}">${2}
|
||||
</xsl:for-each>${3}
|
||||
|
||||
snippet if
|
||||
<xsl:if test="${1:test}">${2}
|
||||
</xsl:if>${3}
|
||||
|
||||
snippet import
|
||||
<xsl:import href="${1:stylesheet}" />${2}
|
||||
|
||||
snippet include
|
||||
<xsl:include href="${1:stylesheet}" />${2}
|
||||
|
||||
snippet otherwise
|
||||
<xsl:otherwise>${1}
|
||||
</xsl:otherwise>
|
||||
|
||||
snippet param
|
||||
<xsl:param name="${1:name}">${2}
|
||||
</xsl:param>${3}
|
||||
|
||||
snippet stylesheet
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">${1}
|
||||
</xsl:stylesheet>
|
||||
|
||||
snippet template
|
||||
<xsl:template match="${1:*}">${3}
|
||||
</xsl:template>
|
||||
|
||||
snippet template named
|
||||
<xsl:template name="${1:name}">${2}
|
||||
</xsl:template>
|
||||
|
||||
snippet text
|
||||
<xsl:text>${1}</xsl:text>
|
||||
|
||||
snippet value-of
|
||||
<xsl:value-of select="${1:*}" />${2}
|
||||
|
||||
snippet variable blank
|
||||
<xsl:variable name="${1:name}">${2}
|
||||
</xsl:variable>
|
||||
|
||||
snippet variable select
|
||||
<xsl:variable select="${1:*}" />${2}
|
||||
|
||||
snippet when
|
||||
<xsl:when test="${1:test}">${2}
|
||||
</xsl:when>
|
||||
|
||||
snippet with-param
|
||||
<xsl:with-param name="${1:name}">${2}</xsl:with-param>
|
||||
|
||||
snippet with-param select
|
||||
<xsl:with-param name="${1:name}" select="${2:*}" />
|
||||
|
||||
96
lib/ace/snippets_test.js
Normal file
96
lib/ace/snippets_test.js
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
/* ***** 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 ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var SnippetManager = require("./snippets").SnippetManager;
|
||||
var assert = require("./test/assertions");
|
||||
|
||||
module.exports = {
|
||||
"test: textmate style format strings" : function() {
|
||||
var fmt = SnippetManager.tmStrFormat;
|
||||
SnippetManager.tmStrFormat("hello", {
|
||||
guard: "(..)(.)(.)",
|
||||
flag:"g",
|
||||
fmt: "a\\UO\\l$1\\E$2"
|
||||
}) == "aOHElo";
|
||||
},
|
||||
"test: parse snipmate file" : function() {
|
||||
var expected = [{
|
||||
name: "a",
|
||||
guard: "(?:(=)|(:))?s*)",
|
||||
trigger: "\\(?f",
|
||||
endTrigger: "\\)",
|
||||
endGuard: "",
|
||||
content: "{$0}\n"
|
||||
}, {
|
||||
tabTrigger: "f",
|
||||
name: "f function",
|
||||
content: "function"
|
||||
}];
|
||||
|
||||
|
||||
|
||||
var parsed = SnippetManager.parseSnippetFile(
|
||||
"name a\nregex /(?:(=)|(:))?\s*)/\\(?f/\\)/\n\t{$0}" +
|
||||
"\n\t\n\n#function\nsnippet f function\n\tfunction"
|
||||
);
|
||||
|
||||
assert.equal(JSON.stringify(expected, null, 4), JSON.stringify(parsed, null, 4))
|
||||
},
|
||||
"test: parse snippet": function() {
|
||||
var content = "-\\$$2a${1:x${$2:y$3\\}\\n\\}$TM_SELECTION}";
|
||||
var tokens = SnippetManager.tokenizeTmSnippet(content);
|
||||
assert.equal(tokens.length, 15);
|
||||
assert.equal(tokens[4], tokens[14]);
|
||||
assert.equal(tokens[2].tabstopId, 2);
|
||||
|
||||
var content = "\\}${var/as\\/d/\\ul\\//g:s}"
|
||||
var tokens = SnippetManager.tokenizeTmSnippet(content);
|
||||
assert.equal(tokens.length, 4);
|
||||
assert.equal(tokens[1], tokens[3]);
|
||||
assert.equal(tokens[2], "s");
|
||||
assert.equal(tokens[1].text, "var");
|
||||
assert.equal(tokens[1].fmt, "\\ul\\/");
|
||||
assert.equal(tokens[1].guard, "as\\/d");
|
||||
assert.equal(tokens[1].flag, "g");
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec()
|
||||
}
|
||||
|
|
@ -48,6 +48,7 @@ var testNames = [
|
|||
"ace/range_list_test",
|
||||
"ace/search_test",
|
||||
"ace/selection_test",
|
||||
"ace/snippets_test",
|
||||
"ace/token_iterator_test",
|
||||
"ace/tokenizer_test",
|
||||
"ace/virtual_renderer_test"
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ var Tokenizer = function(rules) {
|
|||
tokens.push(token);
|
||||
token = {type: type, value: value};
|
||||
}
|
||||
} else {
|
||||
} else if (type) {
|
||||
if (token.type)
|
||||
tokens.push(token);
|
||||
token = {type: null, value: ""};
|
||||
|
|
|
|||
82
tool/tmsnippets.js
Normal file
82
tool/tmsnippets.js
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
var fs = require('fs')
|
||||
var plist = require('plist')
|
||||
|
||||
var snippets = [];
|
||||
var path = process.argv[2] || process.cwd();
|
||||
function readSnippet(path, name) {
|
||||
if (name)
|
||||
path += name
|
||||
console.log(name)
|
||||
if (!/\.(tmSnippet|sublime-snippet|plist)$/i.test(path))
|
||||
return
|
||||
console.log(name)
|
||||
var plistString = fs.readFileSync(path, "utf8");
|
||||
plist.parseString(plistString, function(_, plist){
|
||||
snippets.push(plist)
|
||||
})
|
||||
}
|
||||
|
||||
// read
|
||||
function readDir(path) {
|
||||
if (fs.statSync(path).isDirectory()) {
|
||||
path += "/"
|
||||
fs.readdirSync(path).forEach(function(name) {
|
||||
if (/snippets/i.test(name))
|
||||
readSnippetsInDir(path + name)
|
||||
else
|
||||
readDir(path + name)
|
||||
})
|
||||
}
|
||||
}
|
||||
function readSnippetsInDir(path) {
|
||||
if (fs.statSync(path).isDirectory()) {
|
||||
path += "/"
|
||||
snippets.push(path)
|
||||
fs.readdirSync(path).forEach(function(name) {
|
||||
readSnippet(path, name)
|
||||
})
|
||||
} else {
|
||||
readSnippet(path)
|
||||
}
|
||||
}
|
||||
readDir(path)
|
||||
// transform
|
||||
snippets = snippets.map(function(s) {
|
||||
if (s.length == 1)
|
||||
s = s[0]
|
||||
if (s.scope)
|
||||
s.scope = s.scope.replace(/source\./g, "")
|
||||
delete s.uuid
|
||||
return s
|
||||
})
|
||||
|
||||
// stringify
|
||||
var indent = ""
|
||||
var text = JSON.stringify(snippets, null, 1)
|
||||
// .replace(/(\n\s*)"(\w+)"\:/g, "$1$2:")
|
||||
.replace(/(\n\s*)\},\n\s*{/g, "$1}, {")
|
||||
.replace(/\[\n\s*\{\n/g, "[{\n").replace(/(\n\s*)\}\n\s*\]/g, "$1}]")
|
||||
.replace(/\[\n\s*[^\[\{\}\]]{0,100}\]/g, function(x){return x.replace(/\n\s*/g, " ")})
|
||||
.replace(/\:\s*\{\n\s*(.*)\n\s*\}/g, ": {$1}")
|
||||
.split(/\n\s*/).map(function(x){
|
||||
if (x[0] == "}" || x[0] == "]")
|
||||
indent = indent.substr(1)
|
||||
|
||||
if (x.slice(-1) == "{" || x.slice(-1) == "[") {
|
||||
indent += "\t"
|
||||
return indent.substr(1) + x
|
||||
}
|
||||
return indent +x
|
||||
}).join("\n")
|
||||
.replace(/\\[\\tnr]/g, function(a){
|
||||
if (a[1] == "\\")
|
||||
return a
|
||||
else if (a[1] == "t")
|
||||
return "\t"
|
||||
else
|
||||
return "\\n"+"\\" + "\n"
|
||||
})
|
||||
|
||||
fs.writeFileSync(path += "/./ace.snippets.js", text)
|
||||
|
||||
console.log(path)
|
||||
Loading…
Add table
Add a link
Reference in a new issue