Skip to content

Commit 6d8a945

Browse files
authored
Merge pull request #3 from PlugFox/feature/README.md
Feature/readme.md
2 parents 9afe923 + b9ba40d commit 6d8a945

File tree

9 files changed

+408
-149
lines changed

9 files changed

+408
-149
lines changed

CONTRIBUTING.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## How to add widget wrappper
44

5-
1. Add command to package.json
5+
1. Add command to `package.json`
66

77
```json
88
{
@@ -17,7 +17,7 @@
1717
}
1818
```
1919

20-
2. Add snippet to src/commands/wrap-with.command.ts
20+
2. Add snippet to `src/commands/wrap-with.command.ts`
2121

2222
```ts
2323
const snippetListenableBuilder = (widget: string) => {
@@ -32,7 +32,18 @@ export const wrapWithListenableBuilder = async () =>
3232
wrapWith(snippetListenableBuilder);
3333
```
3434

35-
3. Add command to src/extension.ts
35+
3. Add action to `src/code-actions/code-action-wrap.ts`
36+
37+
```ts
38+
return [
39+
{
40+
command: "flutter-plus.wrap-listenablebuilder",
41+
title: "Wrap with ListenableBuilder",
42+
}
43+
]
44+
```
45+
46+
4. Add command to `src/extension.ts`
3647

3748
```ts
3849
export function activate(context: vscode.ExtensionContext) {

README.md

Lines changed: 100 additions & 0 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Flutter Plus",
44
"description": "Extension with various improvements for Flutter",
55
"icon": "assets/logo.png",
6-
"version": "0.3.0",
6+
"version": "0.4.0",
77
"pricing": "Free",
88
"engines": {
99
"vscode": "^1.92.0"
@@ -46,6 +46,10 @@
4646
{
4747
"command": "flutter-plus.wrap-valuelistenablebuilder",
4848
"title": "Wrap with ValueListenableBuilder<T>"
49+
},
50+
{
51+
"command": "flutter-plus.wrap-repaintboundary",
52+
"title": "Wrap with RepaintBoundary"
4953
}
5054
],
5155
"submenus": [
@@ -72,6 +76,10 @@
7276
"commandPalette": []
7377
},
7478
"snippets": [
79+
{
80+
"language": "markdown",
81+
"path": "./snippets/markdown.json"
82+
},
7583
{
7684
"language": "dart",
7785
"path": "./snippets/dart.json"

snippets/dart.json

Lines changed: 43 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"Main entry point": {
33
"scope": "flutter, dart",
44
"prefix": "main",
5-
"description": "Main entry point",
5+
"description": "Generates a main function with error handling and zone management for Dart applications.",
66
"body": [
77
"import 'dart:async';\n",
88
"@pragma('vm:entry-point')",
@@ -17,7 +17,7 @@
1717
"Try-catch-finally block": {
1818
"scope": "flutter, dart",
1919
"prefix": "try",
20-
"description": "Try-catch-finally block",
20+
"description": "Creates a try-catch-finally block, useful for managing exceptions and ensuring cleanup code runs.",
2121
"body": [
2222
"try {",
2323
" // ...",
@@ -31,13 +31,13 @@
3131
"Timeout handler": {
3232
"scope": "flutter, dart",
3333
"prefix": "timeout",
34-
"description": "Timeout handler",
34+
"description": "Creates a timeout handler for setting execution limits on asynchronous operations.",
3535
"body": "timeout(const Duration(milliseconds: 5000))${0:;}"
3636
},
3737
"Stopwatch": {
3838
"scope": "flutter, dart",
3939
"prefix": "stopwatch",
40-
"description": "Stopwatch",
40+
"description": "Initializes a Stopwatch to measure and log elapsed time for code execution.",
4141
"body": [
4242
"final stopwatch = Stopwatch()..start();",
4343
"try {",
@@ -54,10 +54,11 @@
5454
"Platform conditional imports": {
5555
"scope": "flutter, dart",
5656
"prefix": [
57+
"conditional",
5758
"conditional_imports",
5859
"import_conditional"
5960
],
60-
"description": "Platform conditional imports",
61+
"description": "Generates platform-specific imports based on the environment (VM or JS), ensuring compatibility across different platforms.",
6162
"body": [
6263
"import 'stub.dart'",
6364
" // ignore: uri_does_not_exist",
@@ -66,91 +67,58 @@
6667
" if (dart.library.io) 'io.dart';\n"
6768
]
6869
},
69-
"Changelog unreleased": {
70-
"scope": "md, markdown",
71-
"prefix": [
72-
"changelog_unreleased",
73-
"unreleased"
74-
],
75-
"description": "Changelog unreleased",
76-
"body": [
77-
"## Unreleased",
78-
"",
79-
"- **ADDED**: ${0}",
80-
"- **CHANGED**: ",
81-
"- **DEPRECATED**: ",
82-
"- **REMOVED**: ",
83-
"- **FIXED**: ",
84-
"- **SECURITY**: ",
85-
"- **REFACTOR**: ",
86-
"- **DOCS**: ",
87-
" "
88-
]
89-
},
90-
"Changelog version": {
91-
"scope": "md, markdown",
92-
"prefix": [
93-
"changelog_version",
94-
"version"
95-
],
96-
"description": "Changelog version section",
97-
"body": [
98-
"## ${1:0}.${2:0}.${3:0}",
99-
"",
100-
"- **ADDED**: ${0}",
101-
"- **CHANGED**: ",
102-
"- **DEPRECATED**: ",
103-
"- **REMOVED**: ",
104-
"- **FIXED**: ",
105-
"- **SECURITY**: ",
106-
"- **REFACTOR**: ",
107-
"- **DOCS**: ",
108-
" "
109-
]
110-
},
11170
"Divider": {
11271
"scope": "flutter, dart",
11372
"prefix": [
11473
"dvd",
11574
"divider_comment"
11675
],
117-
"description": "Divider comment line",
76+
"description": "Inserts a divider comment line, useful for visually separating sections of code.",
11877
"body": "// --- ${1} --- //\n\n$0"
11978
},
12079
"Reverse bypass": {
12180
"scope": "flutter, dart",
12281
"prefix": [
12382
"reverseList"
12483
],
125-
"description": "Reverse list traversal in a loop",
84+
"description": "Generates a loop for traversing a list in reverse order.",
12685
"body": [
12786
"for (var i = list.length - 1; i >= 0; i--) $0"
12887
]
12988
},
13089
"Part": {
13190
"scope": "flutter, dart",
13291
"prefix": "part",
133-
"description": "Part of file",
92+
"description": "Adds a part directive to include the specified Dart file as part of the current library.",
13493
"body": [
13594
"part '${TM_FILENAME_BASE}.g.dart';$0"
13695
]
13796
},
13897
"Mocks": {
13998
"scope": "flutter, dart",
14099
"prefix": "mocks",
141-
"description": "Import mocks file",
100+
"description": "Imports a Dart file containing mock implementations for testing purposes.",
142101
"body": [
143102
"import '${TM_FILENAME_BASE}.mocks.dart';$0"
144103
]
145104
},
105+
"toString": {
106+
"scope": "flutter, dart",
107+
"prefix": "toStr",
108+
"description": "Overrides the `toString` method for a custom object, providing a string representation of the object for debugging or logging.",
109+
"body": [
110+
"@override",
111+
"String toString() => '${0}'"
112+
]
113+
},
146114
"Hash Code": {
147115
"scope": "flutter, dart",
148116
"prefix": [
149117
"hashCode",
150118
"equals",
151119
"=="
152120
],
153-
"description": "Hash Code and Equals override",
121+
"description": "Generates hash code and equals methods, overriding the `==` operator and the `hashCode` getter for custom object comparison.",
154122
"body": [
155123
"@override",
156124
"int get hashCode => id.hashCode;\n",
@@ -167,7 +135,7 @@
167135
"nosm",
168136
"noSuchMethod"
169137
],
170-
"description": "This method is invoked when a non-existent method or property is accessed.",
138+
"description": "Implements the `noSuchMethod` method, handling calls to non-existent methods or properties.",
171139
"body": [
172140
"@override",
173141
"dynamic noSuchMethod(Invocation invocation) {",
@@ -181,7 +149,7 @@
181149
"test",
182150
"unitTest"
183151
],
184-
"description": "Create a test function",
152+
"description": "Creates a test function, setting up a basic test case using the `test` package.",
185153
"body": [
186154
"test('${1:test description}', () {",
187155
" ${0:expect(true, isTrue);}",
@@ -191,10 +159,10 @@
191159
"Pragma": {
192160
"scope": "flutter, dart",
193161
"prefix": [
194-
"@pragma",
195-
"pragma"
162+
"pragma",
163+
"@pragma"
196164
],
197-
"description": "Pragma annotation https://mrale.ph/dartvm/pragmas.html",
165+
"description": "Inserts a pragma directive to optimize or modify Dart VM/compiler behavior based on the specified options.",
198166
"body": "@pragma(${1|'vm:entry-point','vm:never-inline','vm:prefer-inline','dart2js:tryInline','vm:notify-debugger-on-exception','vm:invisible','vm:always-consider-inlining','flutter:keep-to-string','flutter:keep-to-string-in-subtypes'|})"
199167
},
200168
"Dart doc disable documentation": {
@@ -203,18 +171,16 @@
203171
"doc-disabled",
204172
"@doc-disabled"
205173
],
206-
"description": "No documentation annotation",
174+
"description": "Adds a comment annotation to disable documentation generation for the specified block of code.",
207175
"body": []
208176
},
209177
"Dart doc category": {
210178
"scope": "flutter, dart",
211179
"prefix": [
212-
"category",
213180
"doc-category",
214-
"dartdoc-category",
215181
"@doc-category"
216182
],
217-
"description": "Add category to documentation",
183+
"description": "Categorizes a block of documentation with the specified category or subcategory tags.",
218184
"body": [
219185
"/// {@${1|category,subCategory|} ${0}}"
220186
]
@@ -223,10 +189,9 @@
223189
"scope": "flutter, dart",
224190
"prefix": [
225191
"doc-image",
226-
"dartdoc-image",
227192
"@doc-image"
228193
],
229-
"description": "Add image to documentation",
194+
"description": "Embeds an image within a block of documentation, using the specified URL as the source.",
230195
"body": [
231196
"/// {@image <image alt='' src='${0:https://host.tld/path/to/image.png}'>}"
232197
]
@@ -235,23 +200,22 @@
235200
"scope": "flutter, dart",
236201
"prefix": [
237202
"doc-animation",
238-
"dartdoc-animation",
239203
"@doc-animation"
240204
],
241-
"description": "Add animation to documentation",
205+
"description": "Embeds an animation within a block of documentation, with options for specifying the size and source URL.",
242206
"body": "/// {@animation name 100 200 ${0:https://host.tld/path/to/video.mp4}}"
243207
},
244208
"Dart doc new template": {
245209
"scope": "flutter, dart",
246210
"prefix": [
211+
"newtmpl",
247212
"@template",
248213
"template",
249-
"dartdoc-new-template",
214+
"doc-new-template",
250215
"doc-new-macro",
251-
"newtmpl",
252216
"@doc-template"
253217
],
254-
"description": "Creates a new dartdoc template with current file's name as its prefix",
218+
"description": "Creates a new Dart documentation template with the current file's name as the prefix, useful for reusing content across multiple documentation blocks.",
255219
"body": [
256220
"/// {@template ${1:$TM_FILENAME_BASE}}",
257221
"/// ${0:Body of the template}",
@@ -261,27 +225,25 @@
261225
"Dart doc use macro": {
262226
"scope": "flutter, dart",
263227
"prefix": [
228+
"usetmpl",
264229
"@macro",
265230
"macro",
266-
"dartdoc-use-template",
231+
"doc-use-template",
267232
"doc-use-macro",
268-
"usetmpl",
269233
"@doc-macro"
270234
],
271-
"description": "Uses existing dartdoc macro with current file's name as its prefix",
235+
"description": "Inserts an existing Dart documentation macro, using the current file's name as the prefix, to maintain consistency in documentation.",
272236
"body": "/// {@macro ${0:$TM_FILENAME_BASE}}"
273237
},
274238
"Dart doc inject html": {
275239
"scope": "flutter, dart",
276240
"prefix": [
241+
"doc-html",
277242
"@inject-html",
278243
"inject-html",
279-
"dartdoc-html",
280-
"doc-html",
281-
"html",
282244
"@doc-html"
283245
],
284-
"description": "Injects html into the current comment",
246+
"description": "Injects custom HTML into a documentation comment, allowing for rich formatting or content inclusion.",
285247
"body": [
286248
"/// {@inject-html}",
287249
"/// ${0:<p>[The HTML to inject.]()</p>}",
@@ -291,29 +253,29 @@
291253
"Deprecated": {
292254
"scope": "flutter, dart",
293255
"prefix": [
294-
"@deprecated",
295-
"deprecated"
256+
"deprecated",
257+
"@deprecated"
296258
],
297-
"description": "Deprecated",
259+
"description": "Marks a class, method, or property as deprecated, indicating that it should no longer be used and may be removed in future versions.",
298260
"body": "@Deprecated('${0:Reason}')"
299261
},
300262
"Meta": {
301263
"scope": "flutter, dart",
302264
"prefix": [
303-
"@meta",
304265
"meta",
266+
"@meta",
305267
"@annotation",
306268
"annotation"
307269
],
308-
"description": "Meta annotation",
270+
"description": "Applies a meta annotation to a class, method, or property, providing additional metadata for tooling or code analysis purposes.",
309271
"body": "@${1|immutable,useResult,internal,protected,literal,mustCallSuper,sealed,alwaysThrows,factory,visibleForOverriding,visibleForTesting,experimental,nonVirtual,doNotStore,optionalTypeArgs|}"
310272
},
311273
"Coverage": {
312274
"scope": "flutter, dart",
313275
"prefix": [
314276
"coverage"
315277
],
316-
"description": "Coverage annotation",
278+
"description": "Adds a coverage annotation to mark lines or blocks of code that should be ignored by test coverage tools.",
317279
"body": "// coverage:${1|ignore-line,ignore-start,ignore-end,ignore-file|}"
318280
}
319281
}

0 commit comments

Comments
 (0)