Skip to content

Commit 28da59c

Browse files
committed
Extension structure
0 parents  commit 28da59c

File tree

7 files changed

+286
-0
lines changed

7 files changed

+286
-0
lines changed

.vscode/launch.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// A launch configuration that launches the extension inside a new window
2+
{
3+
"version": "0.1.0",
4+
"configurations": [
5+
{
6+
"name": "Launch Extension",
7+
"type": "extensionHost",
8+
"request": "launch",
9+
"runtimeExecutable": "${execPath}",
10+
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ]
11+
}
12+
]
13+
}

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Change Log
2+
All notable changes to the "uruit-react-snippets" extension will be documented in this file.
3+
4+
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
5+
6+
## [Unreleased]
7+
- Initial release

README.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# uruit-react-snippets README
2+
3+
This is the README for your extension "uruit-react-snippets". After writing up a brief description, we recommend including the following sections.
4+
5+
## Features
6+
7+
Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
8+
9+
For example if there is an image subfolder under your extension project workspace:
10+
11+
\!\[feature X\]\(images/feature-x.png\)
12+
13+
> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
14+
15+
## Requirements
16+
17+
If you have any requirements or dependencies, add a section describing those and how to install and configure them.
18+
19+
## Extension Settings
20+
21+
Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
22+
23+
For example:
24+
25+
This extension contributes the following settings:
26+
27+
* `myExtension.enable`: enable/disable this extension
28+
* `myExtension.thing`: set to `blah` to do something
29+
30+
## Known Issues
31+
32+
Calling out known issues can help limit users opening duplicate issues against your extension.
33+
34+
## Release Notes
35+
36+
Users appreciate release notes as you update your extension.
37+
38+
### 1.0.0
39+
40+
Initial release of ...
41+
42+
### 1.0.1
43+
44+
Fixed issue #.
45+
46+
### 1.1.0
47+
48+
Added features X, Y, and Z.
49+
50+
-----------------------------------------------------------------------------------------------------------
51+
52+
## Working with Markdown
53+
54+
**Note:** You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
55+
56+
* Split the editor (`Cmd+\` on OSX or `Ctrl+\` on Windows and Linux)
57+
* Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux)
58+
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) to see a list of Markdown snippets
59+
60+
### For more information
61+
62+
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
63+
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
64+
65+
**Enjoy!**

images/uruit-logo.png

1.88 KB
Loading

package.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "uruit-react-snippets",
3+
"displayName": "Uruit React Snippets",
4+
"description": "",
5+
"version": "0.0.1",
6+
"publisher": "UruIT",
7+
"icon": "./images/uruit-logo.png",
8+
"engines": {
9+
"vscode": "^1.13.0"
10+
},
11+
"categories": [
12+
"Snippets"
13+
],
14+
"contributes": {
15+
"snippets": [
16+
{
17+
"language": "javascript",
18+
"path": "./snippets/snippets.json"
19+
}
20+
]
21+
}
22+
}

snippets/snippets.json

+159
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"Print to console": {
3+
"prefix": "u-ci",
4+
"body": [
5+
"console.info('$1');"
6+
],
7+
"description": "Log output to console"
8+
},
9+
"Class Constructor": {
10+
"prefix": "u-ctor",
11+
"body": [
12+
"constructor(props) {",
13+
"\tsuper(props);",
14+
"\t$0",
15+
"}"
16+
],
17+
"description": "Class constructor"
18+
},
19+
"Import Statement": {
20+
"prefix": "u-impt",
21+
"body": [
22+
"import $2 from '$1';$0"
23+
],
24+
"description": "Import module"
25+
},
26+
"Stateless component": {
27+
"prefix": "u-rfc",
28+
"body": [
29+
"import React from 'react';",
30+
"import PropTypes from 'prop-types';",
31+
"import styles from './$1.scss';",
32+
"",
33+
"export default function $1({ prop }) {",
34+
"\treturn (",
35+
"\t\t$2",
36+
"\t);",
37+
"}",
38+
"",
39+
"$1.propTypes = {",
40+
"",
41+
"};"
42+
],
43+
"description": "Stateless component"
44+
},
45+
"Stateful component": {
46+
"prefix": "u-rcc",
47+
"body": [
48+
"import React from 'react';",
49+
"import PropTypes from 'prop-types';",
50+
"import styles from './$1.scss';",
51+
"",
52+
"export default class $1 extends React.Component {",
53+
"\trender() {",
54+
"\t\t$0",
55+
"\t}",
56+
"}",
57+
"",
58+
"$1.propTypes = {",
59+
"",
60+
"};"
61+
],
62+
"description": "Stateful component"
63+
},
64+
"Test": {
65+
"prefix": "u-it",
66+
"body": [
67+
"it('$1', () => {",
68+
"\tconst wrapper = shallow(<$2 />);",
69+
"\texpect(wrapper.$0).toBeTruthy();",
70+
"});"
71+
],
72+
"description": "New unit test"
73+
},
74+
"Test Suite": {
75+
"prefix": "u-desc",
76+
"body": [
77+
"describe('$1', () => {",
78+
"\t$0",
79+
"});"
80+
],
81+
"description": "New test suite"
82+
},
83+
"Test Suite File": {
84+
"prefix": "u-suite",
85+
"body": [
86+
"import React from 'react';",
87+
"import $1 from './$1';",
88+
"import renderer from 'react-test-renderer';",
89+
"import { shallow } from 'enzyme';",
90+
"",
91+
"describe('$1', () => {",
92+
"\tit('should render', () => {",
93+
"\t\tconst wrapper = shallow(<$1 />);",
94+
"\t\texpect(wrapper.find('div').node).toBeTruthy();",
95+
"\t});",
96+
"});"
97+
],
98+
"description": "Jest Test Suite"
99+
},
100+
"PropTypes": {
101+
"prefix": "u-pt",
102+
"body": [
103+
"$1: PropTypes.$2.isRequired"
104+
],
105+
"description": "React PropType"
106+
},
107+
"PropTypes.String": {
108+
"prefix": "u-pts",
109+
"body": [
110+
"$1: PropTypes.string.isRequired$2"
111+
],
112+
"description": "React PropType String"
113+
},
114+
"PropTypes.Number": {
115+
"prefix": "u-ptn",
116+
"body": [
117+
"$1: PropTypes.number.isRequired$2"
118+
],
119+
"description": "React PropType Number"
120+
},
121+
"PropTypes.Bool": {
122+
"prefix": "u-ptb",
123+
"body": [
124+
"$1: PropTypes.bool.isRequired$2"
125+
],
126+
"description": "React PropType Bool"
127+
},
128+
"PropTypes.Func": {
129+
"prefix": "u-ptf",
130+
"body": [
131+
"$1: PropTypes.func.isRequired$2"
132+
],
133+
"description": "React PropType Func"
134+
},
135+
"Redux actions": {
136+
"prefix": "u-actions",
137+
"body": [
138+
"import { call, put, takeLatest } from 'redux-saga/effects';",
139+
"",
140+
"export const $1 = '$1';",
141+
"export const $2 = () => ({",
142+
"\ttype: $1",
143+
"});",
144+
"",
145+
"export default function* watch$3() {",
146+
"\tyield takeLatest($1, $4);",
147+
"}"
148+
]
149+
},
150+
"Redux action": {
151+
"prefix": "u-action",
152+
"body": [
153+
"export const $1 = '$1';",
154+
"export const $2 = () => ({",
155+
"\ttype: $1",
156+
"});"
157+
]
158+
}
159+
}

vsc-extension-quickstart.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Welcome to your VS Code Extension
2+
3+
## What's in the folder
4+
* This folder contains all of the files necessary for your extension
5+
* `package.json` - this is the manifest file that defines the location of the snippet file
6+
and specifies the language of the snippets
7+
* `snippets/snippets.json` - the file containing all snippets
8+
9+
## Get up and running straight away
10+
* press `F5` to open a new window with your extension loaded
11+
* create a new file with a file name suffix matching your language
12+
* verify that your snippets are proposed on intellisense
13+
14+
## Make changes
15+
* you can relaunch the extension from the debug toolbar after making changes to the files listed above
16+
* you can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes
17+
18+
## Install your extension
19+
* To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
20+
* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.

0 commit comments

Comments
 (0)