Skip to content

Commit cfd552f

Browse files
committed
Initial commit
0 parents  commit cfd552f

File tree

8 files changed

+672
-0
lines changed

8 files changed

+672
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
out
2+
node_modules

.vscodeignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.vscode/**
2+
typings/**
3+
out/test/**
4+
test/**
5+
**/*.ts
6+
**/*.map
7+
.gitignore
8+
tsconfig.json
9+
vsc-extension-quickstart.md
10+
art/**
11+
.travis.yml
12+
test-data/**
13+
coverage/**

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Mahmoud Ali
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
## JavaScript Snippet Pack for Visual Studio Code
2+
3+
Download this extension from the
4+
[Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items/akamud.vscode-javascript-snippet-pack)
5+
6+
-----------------------------------------
7+
8+
A snippet pack to make you more productive working with JavaScript.
9+
Based on [Visual Studio extension](https://github.com/madskristensen/JavaScriptSnippetPack) by [Mads Kristensen](https://github.com/madskristensen), which is based on [Atom snippets](https://atom.io/packages/javascript-snippets).
10+
11+
This extension ships a bunch of useful code snippets for the JavaScript and TypeScript editors.
12+
13+
Here's the full list of all the snippets:
14+
15+
## Console
16+
17+
### [cd] console.dir
18+
19+
```javascript
20+
console.dir(${1});
21+
```
22+
23+
### [ce] console.error
24+
25+
```javascript
26+
console.error(${1});
27+
```
28+
29+
### [ci] console.info
30+
31+
```javascript
32+
console.info(${1});
33+
```
34+
35+
### [cl] console.log
36+
37+
```javascript
38+
console.log(${1});
39+
```
40+
41+
### [cw] console.warn
42+
43+
```javascript
44+
console.warn(${1});
45+
```
46+
47+
### [de] debugger
48+
49+
```javascript
50+
debugger;
51+
```
52+
53+
## DOM
54+
55+
### [ae] addEventListener
56+
57+
```javascript
58+
${1:document}.addEventListener('${2:load}', function(e) {
59+
${3:// body}
60+
});
61+
```
62+
63+
### [ac] appendChild
64+
65+
```javascript
66+
${1:document}.appendChild(${2:elem});
67+
```
68+
69+
### [rc] removeChild
70+
71+
```javascript
72+
${1:document}.removeChild(${2:elem});
73+
```
74+
75+
### [cel] createElement
76+
77+
```javascript
78+
${1:document}.createElement(${2:elem});
79+
```
80+
81+
### [cdf] createDocumentFragment
82+
83+
```javascript
84+
${1:document}.createDocumentFragment();
85+
```
86+
87+
### [ca] classList.add
88+
89+
```javascript
90+
${1:document}.classList.add('${2:class}');
91+
```
92+
93+
### [ct] classList.toggle
94+
95+
```javascript
96+
${1:document}.classList.toggle('${2:class}');
97+
```
98+
99+
### [cr] classList.remove
100+
101+
```javascript
102+
${1:document}.classList.remove('${2:class}');
103+
```
104+
105+
### [gi] getElementById
106+
107+
```javascript
108+
${1:document}.getElementById('${2:id}');
109+
```
110+
111+
### [gc] getElementsByClassName
112+
113+
```javascript
114+
${1:document}.getElementsByClassName('${2:class}');
115+
```
116+
117+
### [gt] getElementsByTagName
118+
119+
```javascript
120+
${1:document}.getElementsByTagName('${2:tag}');
121+
```
122+
123+
### [ga] getAttribute
124+
125+
```javascript
126+
${1:document}.getAttribute('${2:attr}');
127+
```
128+
129+
### [sa] setAttribute
130+
131+
```javascript
132+
${1:document}.setAttribute('${2:attr}', ${3:value});
133+
```
134+
135+
### [ra] removeAttribute
136+
137+
```javascript
138+
${1:document}.removeAttribute('${2:attr}');
139+
```
140+
141+
### [ih] innerHTML
142+
143+
```javascript
144+
${1:document}.innerHTML = '${2:elem}';
145+
```
146+
147+
### [tc] textContent
148+
149+
```javascript
150+
${1:document}.textContent = '${2:content}';
151+
```
152+
153+
### [qs] querySelector
154+
155+
```javascript
156+
${1:document}.querySelector('${2:selector}');
157+
```
158+
159+
### [qsa] querySelectorAll
160+
161+
```javascript
162+
${1:document}.querySelectorAll('${2:selector}');
163+
```
164+
165+
## Loop
166+
167+
### [fe] forEach
168+
169+
```javascript
170+
${1:array}.forEach(function(item) {
171+
${2:// body}
172+
});
173+
```
174+
175+
## Function
176+
177+
### [fn] function
178+
179+
```javascript
180+
function ${1:methodName} (${2:arguments}) {
181+
${3:// body}
182+
}
183+
```
184+
185+
### [afn] anonymous function
186+
187+
```javascript
188+
function(${1:arguments}) {
189+
${2:// body}
190+
}
191+
```
192+
193+
### [pr] prototype
194+
195+
```javascript
196+
${1:object}.prototype.${2:method} = function(${3:arguments}) {
197+
${4:// body}
198+
}
199+
```
200+
201+
### [iife] immediately-invoked function expression
202+
203+
```javascript
204+
(function(${1:window}, ${2:document}) {
205+
${3:// body}
206+
})(${1:window}, ${2:document});
207+
```
208+
209+
### [call] function call
210+
211+
```javascript
212+
${1:method}.call(${2:context}, ${3:arguments})
213+
```
214+
215+
### [apply] function apply
216+
217+
```javascript
218+
${1:method}.apply(${2:context}, [${3:arguments}])
219+
```
220+
221+
### [ofn] function as a property of an object
222+
223+
```javascript
224+
${1:functionName}: function(${2:arguments}) {
225+
${3:// body}
226+
}
227+
```
228+
229+
## JSON
230+
231+
### [jp] JSON.parse
232+
233+
```javascript
234+
JSON.parse(${1:obj});
235+
```
236+
237+
### [js] JSON.stringify
238+
239+
```javascript
240+
JSON.stringify(${1:obj});
241+
```
242+
243+
## Timer
244+
245+
### [si] setInterval
246+
247+
```javascript
248+
setInterval(function() {
249+
${0:// body}
250+
}, ${1:1000});
251+
```
252+
253+
### [st] setTimeout
254+
255+
```javascript
256+
setTimeout(function() {
257+
${0:// body}
258+
}, ${1:1000});
259+
```
260+
261+
## Misc
262+
263+
### [us] use strict
264+
265+
```javascript
266+
'use strict';
267+
```
268+
269+
### [al] alert
270+
271+
```javascript
272+
alert('${1:msg}');
273+
```
274+
275+
### [co] confirm
276+
277+
```javascript
278+
confirm('${1:msg}');
279+
```
280+
281+
### [pm] prompt
282+
283+
```javascript
284+
prompt('${1:msg}');
285+
```
286+
287+
## License
288+
[MIT License](https://raw.githubusercontent.com/akamud/vscode-javascript-snippet-pack/master/LICENSE)

art/js-icon.png

3.21 KB
Loading

art/js-icon.psd

53 KB
Binary file not shown.

package.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "vscode-javascript-snippet-pack",
3+
"publisher": "akamud",
4+
"displayName": "JavaScript Snippet Pack ",
5+
"description": "A snippet pack to make you more productive working with JavaScript",
6+
"icon": "art/js-icon.png",
7+
"galleryBanner": {
8+
"color": "#F0DB4F",
9+
"theme": "dark"
10+
},
11+
"license": "MIT",
12+
"bugs": {
13+
"url": "https://github.com/akamud/vscode-javascript-snippet-pack/issues"
14+
},
15+
"homepage": "https://github.com/akamud/vscode-javascript-snippet-pack/",
16+
"repository": {
17+
"type": "git",
18+
"url": "https://github.com/akamud/vscode-javascript-snippet-pack.git"
19+
},
20+
"version": "0.1",
21+
"engines": { "vscode": "^0.11.x" },
22+
"categories": ["Snippets"],
23+
"keywords": [
24+
"Javascript",
25+
"Typescript"
26+
],
27+
"contributes": {
28+
"snippets": [
29+
{
30+
"language": "javascript",
31+
"path": "./snippets/javascript.json"
32+
},
33+
{
34+
"language": "typescript",
35+
"path": "./snippets/javascript.json"
36+
},
37+
{
38+
"language": "javascriptreact",
39+
"path": "./snippets/javascript.json"
40+
},
41+
{
42+
"language": "typescriptreact",
43+
"path": "./snippets/javascript.json"
44+
}
45+
]
46+
}
47+
}

0 commit comments

Comments
 (0)