• ⇧↩ (shift + enter) will turn the current word as a function (like the ruby one does). ⇧⌃↩ (shift + control + enter) will make it into a method instead (blah: function() { ... })

• Cleaned up some snippets like setTimeout and the if/if else/function and others

git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@5308 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
This commit is contained in:
haraldmartin
2006-09-26 15:20:02 +00:00
parent 9fff45d36d
commit 7c8a8d1c75
10 changed files with 86 additions and 10 deletions
+28
View File
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>cat &lt;&lt;SNIPPET
function ${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}(\${1:args}) {
\$0
}
SNIPPET</string>
<key>fallbackInput</key>
<string>word</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
<string>$
</string>
<key>name</key>
<string>New Function</string>
<key>output</key>
<string>insertAsSnippet</string>
<key>scope</key>
<string>source.js</string>
<key>uuid</key>
<string>73951799-AC15-40A6-81DB-EC051AB4A033</string>
</dict>
+28
View File
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>cat &lt;&lt;SNIPPET
${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}: function(\${1:args}) {
\$0
}\${2:,}
SNIPPET</string>
<key>fallbackInput</key>
<string>word</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
<string>~$
</string>
<key>name</key>
<string>New Method</string>
<key>output</key>
<string>insertAsSnippet</string>
<key>scope</key>
<string>source.js</string>
<key>uuid</key>
<string>1717B5AE-209B-4548-9155-9E88A7230C1C</string>
</dict>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string>${1:key}: ${2:"${3:value}"}${4:, }</string>
<key>name</key>
<string>Object key — key: "value"</string>
<key>scope</key>
<string>source.js</string>
<key>tabTrigger</key>
<string>:</string>
<key>uuid</key>
<string>DC8B46FB-8ADA-45EA-8F36-94C807A0D302</string>
</dict>
</plist>
+1 -2
View File
@@ -3,8 +3,7 @@
<plist version="1.0">
<dict>
<key>content</key>
<string>${1:class_name}.prototype.${2:method_name} = function(${3:first_argument})
{
<string>${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
${0:// body...}
};
</string>
+1 -2
View File
@@ -3,8 +3,7 @@
<plist version="1.0">
<dict>
<key>content</key>
<string>function ${1:function_name} (${2:first_argument})
{
<string>function ${1:function_name} (${2:argument}) {
${0:// body...}
}</string>
<key>name</key>
+1 -1
View File
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>content</key>
<string>function($1){${0:$TM_SELECTED_TEXT}};</string>
<string>function($1) {${0:$TM_SELECTED_TEXT}};</string>
<key>name</key>
<string>function(){};</string>
<key>scope</key>
+1 -1
View File
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>content</key>
<string>if(${1:true}){${0:$TM_SELECTED_TEXT}}else{};</string>
<string>if (${1:true}) {${0:$TM_SELECTED_TEXT}} else{};</string>
<key>name</key>
<string>if … else</string>
<key>scope</key>
+1 -1
View File
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>content</key>
<string>if(${1:true}){${0:$TM_SELECTED_TEXT}};</string>
<string>if (${1:true}) {${0:$TM_SELECTED_TEXT}};</string>
<key>name</key>
<string>if</string>
<key>scope</key>
+1 -1
View File
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>content</key>
<string>setTimeout((function() {$0})${2:}, ${1:10});</string>
<string>setTimeout(function() {$0}${2:}, ${1:10});</string>
<key>name</key>
<string>setTimeout function</string>
<key>scope</key>
+8 -2
View File
@@ -10,13 +10,16 @@
<string>------------------------------------</string>
<string>F0E4FB6A-4878-48C6-A777-62438DF1E14F</string>
<string>2F96136B-0193-42F5-90FC-B6F456A3AD77</string>
<string>4C6EDB43-3E2E-411B-A016-13C135C59833</string>
<string>73951799-AC15-40A6-81DB-EC051AB4A033</string>
<string>1717B5AE-209B-4548-9155-9E88A7230C1C</string>
<string>------------------------------------</string>
<string>F19F3732-39A7-48EC-A72B-A8F477A01795</string>
<string>31964029-9D71-4ADC-8213-DFE5C4E222B3</string>
<string>011C4681-FBEC-4891-9326-3DECFCDED6D6</string>
<string>4C6EDB43-3E2E-411B-A016-13C135C59833</string>
<string>------------------------------------</string>
<string>009A3E6C-FE3F-4A18-8759-2DC31F17BBE2</string>
<string>DC8B46FB-8ADA-45EA-8F36-94C807A0D302</string>
</array>
<key>submenus</key>
<dict/>
@@ -28,13 +31,16 @@
<string>B4874A14-2491-465A-A349-61E4EBCF4700</string>
<string>F0E4FB6A-4878-48C6-A777-62438DF1E14F</string>
<string>2F96136B-0193-42F5-90FC-B6F456A3AD77</string>
<string>73951799-AC15-40A6-81DB-EC051AB4A033</string>
<string>1717B5AE-209B-4548-9155-9E88A7230C1C</string>
<string>4C6EDB43-3E2E-411B-A016-13C135C59833</string>
<string>93E017CC-6F27-11D9-90EB-000D93589AF6</string>
<string>BC062860-3346-4D3B-8421-C5543F83D11F</string>
<string>F19F3732-39A7-48EC-A72B-A8F477A01795</string>
<string>31964029-9D71-4ADC-8213-DFE5C4E222B3</string>
<string>4C6EDB43-3E2E-411B-A016-13C135C59833</string>
<string>011C4681-FBEC-4891-9326-3DECFCDED6D6</string>
<string>009A3E6C-FE3F-4A18-8759-2DC31F17BBE2</string>
<string>DC8B46FB-8ADA-45EA-8F36-94C807A0D302</string>
</array>
<key>uuid</key>
<string>AAB4FD74-73F9-11D9-B89A-000D93589AF6</string>