├── .DS_Store
├── .gitignore
├── .vscode
├── extensions.json
├── launch.json
├── settings.json
└── tasks.json
├── .vscodeignore
├── CHANGELOG.md
├── README.md
├── package.json
├── public
├── 2.gif
├── logo.png
├── logo.psd
└── logo2.png
├── publish.sh
├── snippets
├── html.json
└── javascript.json
├── src
├── extension.ts
└── test
│ ├── extension.test.ts
│ └── index.ts
├── test
├── index.html
├── index.txt
└── yox.js
├── tsconfig.json
└── tslint.json
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Wscats/yox-snippets/3d6669d1f565a5a6506235dc5b9ee5d92ed5fa17/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | out
2 | node_modules
3 | .vscode-test/
4 | *.vsix
5 | .DS_Store
6 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | // See http://go.microsoft.com/fwlink/?LinkId=827846
3 | // for the documentation about the extensions.json format
4 | "recommendations": [
5 | "ms-vscode.vscode-typescript-tslint-plugin"
6 | ]
7 | }
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | // A launch configuration that compiles the extension and then opens it inside a new window
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | {
6 | "version": "0.2.0",
7 | "configurations": [{
8 | "name": "Run Extension",
9 | "type": "extensionHost",
10 | "request": "launch",
11 | "runtimeExecutable": "${execPath}",
12 | "args": [
13 | "--extensionDevelopmentPath=${workspaceFolder}"
14 | ],
15 | "outFiles": [
16 | "${workspaceFolder}/out/**/*.js"
17 | ],
18 | "preLaunchTask": "npm: watch"
19 | },
20 | {
21 | "name": "Extension Tests",
22 | "type": "extensionHost",
23 | "request": "launch",
24 | "runtimeExecutable": "${execPath}",
25 | "args": [
26 | "--extensionDevelopmentPath=${workspaceFolder}",
27 | "--extensionTestsPath=${workspaceFolder}/out/test"
28 | ],
29 | "outFiles": [
30 | "${workspaceFolder}/out/test/**/*.js"
31 | ],
32 | "preLaunchTask": "npm: watch"
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 | "files.exclude": {
4 | "out": false // set this to true to hide the "out" folder with the compiled JS files
5 | },
6 | "search.exclude": {
7 | "out": true // set this to false to include "out" folder in search results
8 | },
9 | // Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10 | "typescript.tsc.autoDetect": "off"
11 | }
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | // See https://go.microsoft.com/fwlink/?LinkId=733558
2 | // for the documentation about the tasks.json format
3 | {
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "type": "npm",
8 | "script": "watch",
9 | "problemMatcher": "$tsc-watch",
10 | "isBackground": true,
11 | "presentation": {
12 | "reveal": "never"
13 | },
14 | "group": {
15 | "kind": "build",
16 | "isDefault": true
17 | }
18 | }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/.vscodeignore:
--------------------------------------------------------------------------------
1 | .vscode/**
2 | .vscode-test/**
3 | out/test/**
4 | src/**
5 | .gitignore
6 | **/tsconfig.json
7 | **/tslint.json
8 | **/*.map
9 | **/*.ts
10 | public/logo.psd
11 | public/logo.png
12 | public/2.gif
13 | test/**
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to the `Yox` extension will be documented in this file.
4 |
5 | - 2019.11.28 Update html sinppets
6 | - 2019.11.29 Update javascript sinppets
7 | - 2019.11.30 Delete useless configuration
8 | - 2019.12.1 Change the extension logo
9 | - 2019.12.2 Update html and javascript sinppets
10 | - 2019.12.3 Add hbs snippets
11 |
12 | # Unreleased
13 |
14 | - Add syntax highlight
15 | - Add css snippets
16 | - Change the extension logo
17 | - Update readme
18 | - Supported more languages
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Yox Snippets for Visual Studio Code
2 |
3 | This extension adds Yox Code Snippets into Visual Studio Code.
4 |
5 | 这个插件基于最新的 Yox 的 API 添加了 Code Snippets。
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | # Snippets
16 |
17 | Including most of the API of Yox. You can type `Yox`, choose `Yox.component`, and press ENTER, then `Yox.component(name, {...})` appear on the screen.
18 |
19 | 插件的 Snippets 如下表格所示,比如你可以键入 `Yox` 然后按上下键选中 `Yox.component` 再按 Enter 键,就输入了`Yox.component(name, {...})`了。
20 |
21 | | Prefix | JavaScript Snippet Content |
22 | | ------ | ------------ |
23 | | `import` | `import ... from ...` |
24 | | `newYox` | `new Yox({...})` |
25 | | `addSpecialEvent` | `Yox.dom.addSpecialEvent(name, function (name, listener) {...})` |
26 | | `Yox.dom.on` | `Yox.dom.on(node, event, listener)` |
27 | | `Yox.dom.off` | `Yox.dom.off(node, event, listener)` |
28 | | `Yox.dom.addClass` | `Yox.dom.addClass(node, className)` |
29 | | `Yox.dom.removeClass` | `Yox.dom.removeClass(node, className)` |
30 | | `Yox.directive` | `Yox.directive(name, { bind: function (node, directive, vnode) {...} })` |
31 | | `Yox.component` | `Yox.component(name, {...})` |
32 | | `Yox.filter` | `Yox.filter(name, function (value) {...})` |
33 | | `Yox.transition` | `Yox.transition(name, { leave: function (node) {...} })` |
34 | | `Yox.partial` | `Yox.partial(name, partial)` |
35 | | `template` | `template: "..."` |
36 | | `name` | `name: "..."` |
37 | | `model` | `model: "..."` |
38 | | `data` | `data: { key: value }` |
39 | | `data` | `data: function () {...}` |
40 | | `filters` | `filters: { definition: function (value) {...} }` |
41 | | `computed` | `computed: { definition: function (value) {...} }` |
42 | | `methods` | `methods: { definition: function (value) {...} }` |
43 | | `watchers` | `watchers: { definition: function (value) {...} }` |
44 | | `transitions` | `transitions: { enter: function (node) {...} }` |
45 | | `directives` | `directives: { definition: function (value) {...} }` |
46 | | `events` | `events: { definition: function (value) {...} }` |
47 | | `partials` | `partials: {...}` |
48 | | `propTypes` | `propTypes: {...}` |
49 | | `components` | `components: {...}` |
50 | | `beforeCreate` | `beforeCreate: function () {...}` |
51 | | `afterCreate` | `afterCreate: function () {...}` |
52 | | `beforeMount` | `beforeMount: function () {...}` |
53 | | `afterMount` | `afterMount: function () {...}` |
54 | | `beforeUpdate` | `beforeUpdate: function () {...}` |
55 | | `afterUpdate` | `afterUpdate: function () {...}` |
56 | | `beforeDestroy` | `beforeDestroy: function () {...}` |
57 | | `afterDestroy` | `afterDestroy: function () {...}` |
58 | | `this.$el` | `this.$el.xxx` |
59 | | `this.$refs` | `this.$refs.xxx` |
60 | | `this.$vnode` | `this.$vnode.xxx` |
61 | | `this.$options` | `this.$options.xxx` |
62 | | `this.nextTick` | `this.nextTick(task)` |
63 | | `this.copy` | `this.copy.(data, deep)` |
64 | | `this.toggle` | `this.toggle(keypath)` |
65 | | `this.increase` | `this.increase(keypath, step, max)` |
66 | | `this.decrease` | `this.decrease(keypath, step, min)` |
67 | | `this.append` | `this.append(keypath, item)` |
68 | | `this.prepend` | `this.prepend(keypath, item)` |
69 | | `this.insert` | `this.insert(keypath, item, index)` |
70 | | `this.remove` | `this.remove(keypath, item)` |
71 | | `this.removeAt` | `this.removeAt(keypath, index)` |
72 | | `console.log` | `console.log(...)` |
73 | | `preventDefault` | `event.prevent()` |
74 | | `stopPropagation` | `event.stop()` |
75 |
76 |
77 |
78 |
79 | | Prefix | HTML Snippet Content |
80 | | ------ | ------------ |
81 | | `template` | `...` |
82 | | `{{}}` | `{{ ... }}` |
83 | | `{{!--}}` | `{{!-- ... --}}` |
84 | | `on-event` | `on-...=...` |
85 | | `o-directive` | `o-...=...` |
86 | | `transition` | `transition="..."` |
87 | | `#if` | `{{#if condition1}}...{{else if condition2}}...{{else}}...{{/if}}`|
88 | | `#each` | `{{#each items: item}}...{{/each}}` |
89 | | `#partial` | `{{#partial id}}...{{/partial}}` |
90 | | `model` | `model="..."` |
91 | | `` |
92 |
93 | If you enjoy `Yox`, you should have it! Waiting for you in our heart!
94 |
95 | If you think it's useful, you can leave us a [message and like it](https://marketplace.visualstudio.com/items?itemName=Wscats.yox&ssr=false#review-details), Your support is our driving force😀
96 |
97 | # License
98 |
99 | [Yox Snippets](https://marketplace.visualstudio.com/items?itemName=Wscats.yox) is released under the [MIT](http://opensource.org/licenses/MIT).
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "yox",
3 | "displayName": "Yox",
4 | "description": "This extension adds Yox Code Snippets into Visual Studio Code.",
5 | "icon": "public/logo2.png",
6 | "author": {
7 | "name": "Eno Yao",
8 | "email": "kalone.cool@gmail.com",
9 | "url": "https://github.com/Wscats"
10 | },
11 | "publisher": "Wscats",
12 | "version": "0.1.9",
13 | "license": "MIT",
14 | "engines": {
15 | "vscode": "^1.40.0"
16 | },
17 | "keywords": [
18 | "yox",
19 | "html",
20 | "javascript",
21 | "snippet"
22 | ],
23 | "homepage": "https://github.com/wscats/yox-snippets#readme",
24 | "repository": {
25 | "type": "git",
26 | "url": "https://github.com/wscats/yox-snippets"
27 | },
28 | "bugs": {
29 | "url": "https://github.com/wscats/yox-snippets/issues",
30 | "email": "kalone.cool@163.com"
31 | },
32 | "categories": [
33 | "Other",
34 | "Programming Languages",
35 | "Snippets",
36 | "Formatters"
37 | ],
38 | "contributes": {
39 | "snippets": [
40 | {
41 | "language": "javascript",
42 | "path": "./snippets/javascript.json"
43 | },
44 | {
45 | "language": "typescript",
46 | "path": "./snippets/javascript.json"
47 | },
48 | {
49 | "language": "html",
50 | "path": "./snippets/javascript.json"
51 | },
52 | {
53 | "language": "html",
54 | "path": "./snippets/html.json"
55 | },
56 | {
57 | "language": "hbs",
58 | "path": "./snippets/javascript.json"
59 | },
60 | {
61 | "language": "hbs",
62 | "path": "./snippets/html.json"
63 | }
64 | ],
65 | "languages": [
66 | {
67 | "id": "hbs",
68 | "extensions": [
69 | ".hbs"
70 | ],
71 | "aliases": [
72 | "html",
73 | "javascript"
74 | ]
75 | },
76 | {
77 | "id": "html",
78 | "extensions": [
79 | ".hbs"
80 | ],
81 | "aliases": [
82 | "html",
83 | "javascript"
84 | ]
85 | }
86 | ]
87 | },
88 | "scripts": {
89 | "start": "./publish.sh",
90 | "build": "vsce package",
91 | "vscode:prepublish": "yarn run compile",
92 | "compile": "tsc -p ./",
93 | "watch": "tsc -watch -p ./",
94 | "postinstall": "node ./node_modules/vscode/bin/install",
95 | "test": "yarn run compile && node ./node_modules/vscode/bin/test"
96 | },
97 | "devDependencies": {
98 | "yox": "^1.0.0-alpha.118",
99 | "typescript": "^3.3.1",
100 | "vscode": "^1.1.28",
101 | "tslint": "^5.12.1",
102 | "@types/node": "^10.12.21",
103 | "@types/mocha": "^2.2.42"
104 | }
105 | }
--------------------------------------------------------------------------------
/public/2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Wscats/yox-snippets/3d6669d1f565a5a6506235dc5b9ee5d92ed5fa17/public/2.gif
--------------------------------------------------------------------------------
/public/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Wscats/yox-snippets/3d6669d1f565a5a6506235dc5b9ee5d92ed5fa17/public/logo.png
--------------------------------------------------------------------------------
/public/logo.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Wscats/yox-snippets/3d6669d1f565a5a6506235dc5b9ee5d92ed5fa17/public/logo.psd
--------------------------------------------------------------------------------
/public/logo2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Wscats/yox-snippets/3d6669d1f565a5a6506235dc5b9ee5d92ed5fa17/public/logo2.png
--------------------------------------------------------------------------------
/publish.sh:
--------------------------------------------------------------------------------
1 | # count=1
2 | # cat package.json | while read line | sed '/name/g'
3 | # do
4 | # echo "Line $count: $line"
5 | # count=$[ $count + 1 ]
6 | # done
7 | # echo "Finished processing the file"
8 |
9 |
10 | # grep 'name' package.json
11 |
12 | # nl ./test/index.txt | sed '2,5d'
13 |
14 | # cat ./test/index.txt | sed '2,5d'
15 |
16 | sed 's/2/4/' ./test/index.txt
--------------------------------------------------------------------------------
/snippets/html.json:
--------------------------------------------------------------------------------
1 | {
2 | "template": {
3 | "prefix": "template",
4 | "body": [
5 | "",
6 | "\t<${1:div}$2>",
7 | "\t\t$0",
8 | "\t${1:div}>",
9 | ""
10 | ],
11 | "description": "template"
12 | },
13 | "mustache": {
14 | "prefix": "{{}}",
15 | "body": [
16 | "{{$1}}"
17 | ],
18 | "description": "mustache"
19 | },
20 | "mustacheComment": {
21 | "prefix": "{{!--}}",
22 | "body": [
23 | "{{!-- $1 --}}"
24 | ],
25 | "description": "mustache comment"
26 | },
27 | "event": {
28 | "prefix": [
29 | "on-event"
30 | ],
31 | "body": [
32 | "on-${1:event}=\"${2:handle}\""
33 | ],
34 | "description": "event"
35 | },
36 | "directive": {
37 | "prefix": [
38 | "o-directive"
39 | ],
40 | "body": [
41 | "o-${1:directive}=\"${2:handle}\""
42 | ],
43 | "description": "directive"
44 | },
45 | "transition": {
46 | "prefix": [
47 | "transition"
48 | ],
49 | "body": [
50 | "transition=\"${1:name}\""
51 | ],
52 | "description": "transition"
53 | },
54 | "if": {
55 | "prefix": "#if",
56 | "body": [
57 | "{{#if ${1:condition}}}",
58 | "\tA",
59 | "{{else if ${2:condition}}}",
60 | "\tB",
61 | "{{else}}",
62 | "\tC",
63 | "{{/if}}"
64 | ],
65 | "description": "if"
66 | },
67 | "each": {
68 | "prefix": "#each",
69 | "body": [
70 | "{{#each ${1:items}:${2:item}}}",
71 | "\t${3:item}",
72 | "{{/each}}"
73 | ],
74 | "description": "each"
75 | },
76 | "partial": {
77 | "prefix": "#partial",
78 | "body": [
79 | "{{#partial $1}}",
80 | "\t$2",
81 | "{{/partial}}"
82 | ],
83 | "description": "partial"
84 | },
85 | "model": {
86 | "prefix": "model",
87 | "body": [
88 | "model=\"$1\""
89 | ],
90 | "description": "model"
91 | },
92 | "singleLineComment": {
93 | "prefix": ""
96 | ],
97 | "description": "single line comment"
98 | },
99 | "multilineComment": {
100 | "prefix": ""
105 | ],
106 | "description": "multiline comment"
107 | }
108 | }
--------------------------------------------------------------------------------
/snippets/javascript.json:
--------------------------------------------------------------------------------
1 | {
2 | "import": {
3 | "prefix": "import",
4 | "body": [
5 | "import $1 from '$2'"
6 | ],
7 | "description": "import ... from ..."
8 | },
9 | "yox": {
10 | "prefix": "newYox",
11 | "body": [
12 | "new Yox({",
13 | "\t$1",
14 | "})"
15 | ],
16 | "description": "new Yox()"
17 | },
18 | "addSpecialEvent": {
19 | "prefix": "Yox.dom.addSpecialEvent",
20 | "body": [
21 | "Yox.dom.addSpecialEvent(\"${1:definition}\", {",
22 | "\ton: function (element, listener) { ${2:handle} },",
23 | "\toff: function (element, listener) { ${3:handle} }",
24 | "})"
25 | ],
26 | "description": "Yox.dom.addSpecialEvent"
27 | },
28 | "yoxDomOn": {
29 | "prefix": "Yox.dom.on",
30 | "body": [
31 | "Yox.dom.on(${1:node}, \"${2:event}\", ${3:listener})"
32 | ],
33 | "description": "Yox.dom.on"
34 | },
35 | "yoxDomOff": {
36 | "prefix": "Yox.dom.off",
37 | "body": [
38 | "Yox.dom.off(${1:node}, \"${2:event}\", ${3:listener})"
39 | ],
40 | "description": "Yox.dom.off"
41 | },
42 | "yoxDomAddClass": {
43 | "prefix": "Yox.dom.addClass",
44 | "body": [
45 | "Yox.dom.addClass(${1:node}, \"${2:className}\")"
46 | ],
47 | "description": "Yox.dom.addClass"
48 | },
49 | "yoxDomRemoveClass": {
50 | "prefix": "Yox.dom.removeClass",
51 | "body": [
52 | "Yox.dom.removeClass(${1:node}, \"${2:className}\")"
53 | ],
54 | "description": "Yox.dom.removeClass"
55 | },
56 | "yoxDirective": {
57 | "prefix": "Yox.directive",
58 | "body": [
59 | "Yox.directive(\"${1:name}\", {",
60 | "\tbind: function (node, directive, vnode) { ${2:handle} },",
61 | "\tunbind: function (node, directive, vnode) { ${2:handle} }",
62 | "})"
63 | ],
64 | "description": "Yox.directive"
65 | },
66 | "yoxComponent": {
67 | "prefix": "Yox.component",
68 | "body": [
69 | "Yox.component(\"${1:name}\", { ${2:options} })"
70 | ],
71 | "description": "Yox.component"
72 | },
73 | "yoxFilter": {
74 | "prefix": "Yox.filter",
75 | "body": [
76 | "Yox.filter(\"${1:name}\", function (value) { ${2:handle} })"
77 | ],
78 | "description": "Yox.filter"
79 | },
80 | "yoxTransition": {
81 | "prefix": "Yox.transition",
82 | "body": [
83 | "Yox.transition(\"${1:name}\", {",
84 | "\tenter: function (node) { ${2:handle} },",
85 | "\tleave: function (node, done) { ${3:handle} }",
86 | "})"
87 | ],
88 | "description": "Yox.transition"
89 | },
90 | "yoxPartial": {
91 | "prefix": "Yox.partial",
92 | "body": [
93 | "Yox.partial(\"${1:name}\", ${2:partial})"
94 | ],
95 | "description": "Yox.partial"
96 | },
97 | "template": {
98 | "prefix": "template",
99 | "body": [
100 | "template: \"$1\""
101 | ],
102 | "description": "template"
103 | },
104 | "name": {
105 | "prefix": "name",
106 | "body": [
107 | "name: \"$1\""
108 | ],
109 | "description": "name"
110 | },
111 | "model": {
112 | "prefix": "model",
113 | "body": [
114 | "model: \"$1\""
115 | ],
116 | "description": "model"
117 | },
118 | "data": {
119 | "prefix": "data:{",
120 | "body": [
121 | "data: {",
122 | "\t${1:key}: ${2:value}",
123 | "}"
124 | ],
125 | "description": "data"
126 | },
127 | "dataFunction": {
128 | "prefix": "data:function",
129 | "body": [
130 | "data: function () {",
131 | "\treturn { ${1:data} }",
132 | "}"
133 | ],
134 | "description": "dataFunction"
135 | },
136 | "filters": {
137 | "prefix": "filters",
138 | "body": [
139 | "filters: {",
140 | "\t${1:definition}: function (value) { ${2:handle} }",
141 | "}"
142 | ],
143 | "description": "filters"
144 | },
145 | "computed": {
146 | "prefix": "computed",
147 | "body": [
148 | "computed: {",
149 | "\t${1:definition}: function (value) { ${2:handle} }",
150 | "}"
151 | ],
152 | "description": "computed"
153 | },
154 | "methods": {
155 | "prefix": "methods",
156 | "body": [
157 | "methods: {",
158 | "\t${1:definition}: function (value) { ${2:handle} }",
159 | "}"
160 | ],
161 | "description": "methods"
162 | },
163 | "watchers": {
164 | "prefix": "watchers",
165 | "body": [
166 | "watchers: {",
167 | "\t${1:definition}: function (value) { ${2:handle} }",
168 | "}"
169 | ],
170 | "description": "watchers"
171 | },
172 | "transitions": {
173 | "prefix": "transitions",
174 | "body": [
175 | "transitions: {",
176 | "\tenter: function (node) { ${1:handle} },",
177 | "\tleave: function (node, done) { ${2:handle} }",
178 | "}"
179 | ],
180 | "description": "transitions"
181 | },
182 | "directives": {
183 | "prefix": "directives",
184 | "body": [
185 | "directives: {",
186 | "\t${1:definition}: function (value) { ${2:handle} }",
187 | "}"
188 | ],
189 | "description": "directives"
190 | },
191 | "beforeCreate": {
192 | "prefix": "beforeCreate",
193 | "body": [
194 | "beforeCreate: function () { ${1:handle} }"
195 | ],
196 | "description": "beforeCreate"
197 | },
198 | "afterCreate": {
199 | "prefix": "afterCreate",
200 | "body": [
201 | "afterCreate: function () { ${1:handle} }"
202 | ],
203 | "description": "afterCreate"
204 | },
205 | "beforeMount": {
206 | "prefix": "beforeMount",
207 | "body": [
208 | "beforeMount: function () { ${1:handle} }"
209 | ],
210 | "description": "beforeMount"
211 | },
212 | "afterMount": {
213 | "prefix": "afterMount",
214 | "body": [
215 | "afterMount: function () { ${1:handle} }"
216 | ],
217 | "description": "afterMount"
218 | },
219 | "beforeUpdate": {
220 | "prefix": "beforeUpdate",
221 | "body": [
222 | "beforeUpdate: function () { ${1:handle} }"
223 | ],
224 | "description": "beforeUpdate"
225 | },
226 | "afterUpdate": {
227 | "prefix": "afterUpdate",
228 | "body": [
229 | "afterUpdate: function () { ${1:handle} }"
230 | ],
231 | "description": "afterUpdate"
232 | },
233 | "beforeDestroy": {
234 | "prefix": "beforeDestroy",
235 | "body": [
236 | "beforeDestroy: function () { ${1:handle} }"
237 | ],
238 | "description": "beforeDestroy"
239 | },
240 | "afterDestroy": {
241 | "prefix": "afterDestroy",
242 | "body": [
243 | "afterDestroy: function () { ${1:handle} }"
244 | ],
245 | "description": "afterDestroy"
246 | },
247 | "events": {
248 | "prefix": "events",
249 | "body": [
250 | "events: {",
251 | "\t${1:definition}: function (value) { ${2:handle} }",
252 | "}"
253 | ],
254 | "description": "events"
255 | },
256 | "partials": {
257 | "prefix": "partials",
258 | "body": [
259 | "partials: {",
260 | "\t${1:definition}: {${2:key}: ${3:value}}",
261 | "}"
262 | ],
263 | "description": "partials"
264 | },
265 | "propTypes": {
266 | "prefix": "propTypes",
267 | "body": [
268 | "propTypes: {",
269 | "\t${1:propName}: {",
270 | "\t\ttype: ${2:type},",
271 | "\t\tvalue: ${3:value},",
272 | "\t\trequired: ${4:required}",
273 | "\t}",
274 | "}"
275 | ],
276 | "description": "propTypes"
277 | },
278 | "components": {
279 | "prefix": "components",
280 | "body": [
281 | "components: {",
282 | "\t${1:key}: ${2:value}",
283 | "}"
284 | ],
285 | "description": "components"
286 | },
287 | "this.$refs": {
288 | "prefix": "this.$refs",
289 | "body": [
290 | "this.\\$refs$1"
291 | ],
292 | "description": "this.$refs"
293 | },
294 | "this.$el": {
295 | "prefix": "this.$el",
296 | "body": [
297 | "this.\\$el$1"
298 | ],
299 | "description": "this.$el"
300 | },
301 | "this.$vnode": {
302 | "prefix": "this.$vnode",
303 | "body": [
304 | "this.\\$vnode$1"
305 | ],
306 | "description": "this.$vnode"
307 | },
308 | "this.options": {
309 | "prefix": "this.$options",
310 | "body": [
311 | "this.\\$options$1"
312 | ],
313 | "description": "this.$options"
314 | },
315 | "this.nextTick": {
316 | "prefix": "this.nextTick",
317 | "body": [
318 | "this.nextTick(${1:task})"
319 | ],
320 | "description": "this.nextTick"
321 | },
322 | "this.copy": {
323 | "prefix": "this.copy",
324 | "body": [
325 | "this.copy(${1:data}, ${2:deep})"
326 | ],
327 | "description": "this.copy"
328 | },
329 | "this.toggle": {
330 | "prefix": "this.toggle",
331 | "body": [
332 | "this.toggle(${1:keypath})"
333 | ],
334 | "description": "this.toggle"
335 | },
336 | "this.increase": {
337 | "prefix": "this.increase",
338 | "body": [
339 | "this.increase(${1:keypath}, ${2:step}, ${3:max})"
340 | ],
341 | "description": "this.increase"
342 | },
343 | "this.decrease": {
344 | "prefix": "this.decrease",
345 | "body": [
346 | "this.decrease(${1:keypath}, ${2:step}, ${3:min})"
347 | ],
348 | "description": "this.decrease"
349 | },
350 | "this.append": {
351 | "prefix": "this.append",
352 | "body": [
353 | "this.append(${1:keypath}, ${2:item})"
354 | ],
355 | "description": "this.append"
356 | },
357 | "this.prepend": {
358 | "prefix": "this.prepend",
359 | "body": [
360 | "this.prepend(${1:keypath}, ${2:item})"
361 | ],
362 | "description": "this.prepend"
363 | },
364 | "this.insert": {
365 | "prefix": "this.insert",
366 | "body": [
367 | "this.insert(${1:keypath}, ${2:item}, ${3:index})"
368 | ],
369 | "description": "this.insert"
370 | },
371 | "this.remove": {
372 | "prefix": "this.remove",
373 | "body": [
374 | "this.remove(${1:keypath}, ${2:item})"
375 | ],
376 | "description": "this.remove"
377 | },
378 | "this.removeAt": {
379 | "prefix": "this.removeAt",
380 | "body": [
381 | "this.removeAt(${1:keypath}, ${2:index})"
382 | ],
383 | "description": "this.removeAt"
384 | },
385 | "console.log": {
386 | "prefix": "console.log",
387 | "body": [
388 | "console.log($1)"
389 | ],
390 | "description": "console.log"
391 | },
392 | "preventDefault": {
393 | "prefix": "preventDefault",
394 | "body": [
395 | "event.prevent();",
396 | "$1"
397 | ],
398 | "description": "preventDefault"
399 | },
400 | "stopPropagation": {
401 | "prefix": "stopPropagation",
402 | "body": [
403 | "event.stop();",
404 | "$1"
405 | ],
406 | "description": "stopPropagation"
407 | }
408 | }
--------------------------------------------------------------------------------
/src/extension.ts:
--------------------------------------------------------------------------------
1 | // The module 'vscode' contains the VS Code extensibility API
2 | // Import the module and reference it with the alias vscode in your code below
3 | import * as vscode from 'vscode';
4 |
5 | // this method is called when your extension is activated
6 | // your extension is activated the very first time the command is executed
7 | export function activate(context: vscode.ExtensionContext) {
8 |
9 | // Use the console to output diagnostic information (console.log) and errors (console.error)
10 | // This line of code will only be executed once when your extension is activated
11 | console.log('Congratulations, your extension "yox-extension" is now active!');
12 | }
13 |
14 | // this method is called when your extension is deactivated
15 | export function deactivate() {}
16 |
--------------------------------------------------------------------------------
/src/test/extension.test.ts:
--------------------------------------------------------------------------------
1 | //
2 | // Note: This example test is leveraging the Mocha test framework.
3 | // Please refer to their documentation on https://mochajs.org/ for help.
4 | //
5 |
6 | // The module 'assert' provides assertion methods from node
7 | import * as assert from 'assert';
8 |
9 | // You can import and use all API from the 'vscode' module
10 | // as well as import your extension to test it
11 | // import * as vscode from 'vscode';
12 | // import * as myExtension from '../extension';
13 |
14 | // Defines a Mocha test suite to group tests of similar kind together
15 | suite("Extension Tests", function () {
16 |
17 | // Defines a Mocha unit test
18 | test("Something 1", function() {
19 | assert.equal(-1, [1, 2, 3].indexOf(5));
20 | assert.equal(-1, [1, 2, 3].indexOf(0));
21 | });
22 | });
--------------------------------------------------------------------------------
/src/test/index.ts:
--------------------------------------------------------------------------------
1 | //
2 | // PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
3 | //
4 | // This file is providing the test runner to use when running extension tests.
5 | // By default the test runner in use is Mocha based.
6 | //
7 | // You can provide your own test runner if you want to override it by exporting
8 | // a function run(testsRoot: string, clb: (error: Error, failures?: number) => void): void
9 | // that the extension host can call to run the tests. The test runner is expected to use console.log
10 | // to report the results back to the caller. When the tests are finished, return
11 | // a possible error to the callback or null if none.
12 |
13 | import * as testRunner from 'vscode/lib/testrunner';
14 |
15 | // You can directly control Mocha options by configuring the test runner below
16 | // See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options
17 | // for more info
18 | testRunner.configure({
19 | ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
20 | useColors: true // colored output from test results
21 | });
22 |
23 | module.exports = testRunner;
--------------------------------------------------------------------------------
/test/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |