Skip to content

Commit

Permalink
Merge pull request #3 from PlugFox/feature/README.md
Browse files Browse the repository at this point in the history
Feature/readme.md
  • Loading branch information
PlugFox authored Aug 22, 2024
2 parents 9afe923 + b9ba40d commit 6d8a945
Show file tree
Hide file tree
Showing 9 changed files with 408 additions and 149 deletions.
17 changes: 14 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## How to add widget wrappper

1. Add command to package.json
1. Add command to `package.json`

```json
{
Expand All @@ -17,7 +17,7 @@
}
```

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

```ts
const snippetListenableBuilder = (widget: string) => {
Expand All @@ -32,7 +32,18 @@ export const wrapWithListenableBuilder = async () =>
wrapWith(snippetListenableBuilder);
```

3. Add command to src/extension.ts
3. Add action to `src/code-actions/code-action-wrap.ts`

```ts
return [
{
command: "flutter-plus.wrap-listenablebuilder",
title: "Wrap with ListenableBuilder",
}
]
```

4. Add command to `src/extension.ts`

```ts
export function activate(context: vscode.ExtensionContext) {
Expand Down
100 changes: 100 additions & 0 deletions README.md

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Flutter Plus",
"description": "Extension with various improvements for Flutter",
"icon": "assets/logo.png",
"version": "0.3.0",
"version": "0.4.0",
"pricing": "Free",
"engines": {
"vscode": "^1.92.0"
Expand Down Expand Up @@ -46,6 +46,10 @@
{
"command": "flutter-plus.wrap-valuelistenablebuilder",
"title": "Wrap with ValueListenableBuilder<T>"
},
{
"command": "flutter-plus.wrap-repaintboundary",
"title": "Wrap with RepaintBoundary"
}
],
"submenus": [
Expand All @@ -72,6 +76,10 @@
"commandPalette": []
},
"snippets": [
{
"language": "markdown",
"path": "./snippets/markdown.json"
},
{
"language": "dart",
"path": "./snippets/dart.json"
Expand Down
124 changes: 43 additions & 81 deletions snippets/dart.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Main entry point": {
"scope": "flutter, dart",
"prefix": "main",
"description": "Main entry point",
"description": "Generates a main function with error handling and zone management for Dart applications.",
"body": [
"import 'dart:async';\n",
"@pragma('vm:entry-point')",
Expand All @@ -17,7 +17,7 @@
"Try-catch-finally block": {
"scope": "flutter, dart",
"prefix": "try",
"description": "Try-catch-finally block",
"description": "Creates a try-catch-finally block, useful for managing exceptions and ensuring cleanup code runs.",
"body": [
"try {",
" // ...",
Expand All @@ -31,13 +31,13 @@
"Timeout handler": {
"scope": "flutter, dart",
"prefix": "timeout",
"description": "Timeout handler",
"description": "Creates a timeout handler for setting execution limits on asynchronous operations.",
"body": "timeout(const Duration(milliseconds: 5000))${0:;}"
},
"Stopwatch": {
"scope": "flutter, dart",
"prefix": "stopwatch",
"description": "Stopwatch",
"description": "Initializes a Stopwatch to measure and log elapsed time for code execution.",
"body": [
"final stopwatch = Stopwatch()..start();",
"try {",
Expand All @@ -54,10 +54,11 @@
"Platform conditional imports": {
"scope": "flutter, dart",
"prefix": [
"conditional",
"conditional_imports",
"import_conditional"
],
"description": "Platform conditional imports",
"description": "Generates platform-specific imports based on the environment (VM or JS), ensuring compatibility across different platforms.",
"body": [
"import 'stub.dart'",
" // ignore: uri_does_not_exist",
Expand All @@ -66,91 +67,58 @@
" if (dart.library.io) 'io.dart';\n"
]
},
"Changelog unreleased": {
"scope": "md, markdown",
"prefix": [
"changelog_unreleased",
"unreleased"
],
"description": "Changelog unreleased",
"body": [
"## Unreleased",
"",
"- **ADDED**: ${0}",
"- **CHANGED**: ",
"- **DEPRECATED**: ",
"- **REMOVED**: ",
"- **FIXED**: ",
"- **SECURITY**: ",
"- **REFACTOR**: ",
"- **DOCS**: ",
" "
]
},
"Changelog version": {
"scope": "md, markdown",
"prefix": [
"changelog_version",
"version"
],
"description": "Changelog version section",
"body": [
"## ${1:0}.${2:0}.${3:0}",
"",
"- **ADDED**: ${0}",
"- **CHANGED**: ",
"- **DEPRECATED**: ",
"- **REMOVED**: ",
"- **FIXED**: ",
"- **SECURITY**: ",
"- **REFACTOR**: ",
"- **DOCS**: ",
" "
]
},
"Divider": {
"scope": "flutter, dart",
"prefix": [
"dvd",
"divider_comment"
],
"description": "Divider comment line",
"description": "Inserts a divider comment line, useful for visually separating sections of code.",
"body": "// --- ${1} --- //\n\n$0"
},
"Reverse bypass": {
"scope": "flutter, dart",
"prefix": [
"reverseList"
],
"description": "Reverse list traversal in a loop",
"description": "Generates a loop for traversing a list in reverse order.",
"body": [
"for (var i = list.length - 1; i >= 0; i--) $0"
]
},
"Part": {
"scope": "flutter, dart",
"prefix": "part",
"description": "Part of file",
"description": "Adds a part directive to include the specified Dart file as part of the current library.",
"body": [
"part '${TM_FILENAME_BASE}.g.dart';$0"
]
},
"Mocks": {
"scope": "flutter, dart",
"prefix": "mocks",
"description": "Import mocks file",
"description": "Imports a Dart file containing mock implementations for testing purposes.",
"body": [
"import '${TM_FILENAME_BASE}.mocks.dart';$0"
]
},
"toString": {
"scope": "flutter, dart",
"prefix": "toStr",
"description": "Overrides the `toString` method for a custom object, providing a string representation of the object for debugging or logging.",
"body": [
"@override",
"String toString() => '${0}'"
]
},
"Hash Code": {
"scope": "flutter, dart",
"prefix": [
"hashCode",
"equals",
"=="
],
"description": "Hash Code and Equals override",
"description": "Generates hash code and equals methods, overriding the `==` operator and the `hashCode` getter for custom object comparison.",
"body": [
"@override",
"int get hashCode => id.hashCode;\n",
Expand All @@ -167,7 +135,7 @@
"nosm",
"noSuchMethod"
],
"description": "This method is invoked when a non-existent method or property is accessed.",
"description": "Implements the `noSuchMethod` method, handling calls to non-existent methods or properties.",
"body": [
"@override",
"dynamic noSuchMethod(Invocation invocation) {",
Expand All @@ -181,7 +149,7 @@
"test",
"unitTest"
],
"description": "Create a test function",
"description": "Creates a test function, setting up a basic test case using the `test` package.",
"body": [
"test('${1:test description}', () {",
" ${0:expect(true, isTrue);}",
Expand All @@ -191,10 +159,10 @@
"Pragma": {
"scope": "flutter, dart",
"prefix": [
"@pragma",
"pragma"
"pragma",
"@pragma"
],
"description": "Pragma annotation https://mrale.ph/dartvm/pragmas.html",
"description": "Inserts a pragma directive to optimize or modify Dart VM/compiler behavior based on the specified options.",
"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'|})"
},
"Dart doc disable documentation": {
Expand All @@ -203,18 +171,16 @@
"doc-disabled",
"@doc-disabled"
],
"description": "No documentation annotation",
"description": "Adds a comment annotation to disable documentation generation for the specified block of code.",
"body": []
},
"Dart doc category": {
"scope": "flutter, dart",
"prefix": [
"category",
"doc-category",
"dartdoc-category",
"@doc-category"
],
"description": "Add category to documentation",
"description": "Categorizes a block of documentation with the specified category or subcategory tags.",
"body": [
"/// {@${1|category,subCategory|} ${0}}"
]
Expand All @@ -223,10 +189,9 @@
"scope": "flutter, dart",
"prefix": [
"doc-image",
"dartdoc-image",
"@doc-image"
],
"description": "Add image to documentation",
"description": "Embeds an image within a block of documentation, using the specified URL as the source.",
"body": [
"/// {@image <image alt='' src='${0:https://host.tld/path/to/image.png}'>}"
]
Expand All @@ -235,23 +200,22 @@
"scope": "flutter, dart",
"prefix": [
"doc-animation",
"dartdoc-animation",
"@doc-animation"
],
"description": "Add animation to documentation",
"description": "Embeds an animation within a block of documentation, with options for specifying the size and source URL.",
"body": "/// {@animation name 100 200 ${0:https://host.tld/path/to/video.mp4}}"
},
"Dart doc new template": {
"scope": "flutter, dart",
"prefix": [
"newtmpl",
"@template",
"template",
"dartdoc-new-template",
"doc-new-template",
"doc-new-macro",
"newtmpl",
"@doc-template"
],
"description": "Creates a new dartdoc template with current file's name as its prefix",
"description": "Creates a new Dart documentation template with the current file's name as the prefix, useful for reusing content across multiple documentation blocks.",
"body": [
"/// {@template ${1:$TM_FILENAME_BASE}}",
"/// ${0:Body of the template}",
Expand All @@ -261,27 +225,25 @@
"Dart doc use macro": {
"scope": "flutter, dart",
"prefix": [
"usetmpl",
"@macro",
"macro",
"dartdoc-use-template",
"doc-use-template",
"doc-use-macro",
"usetmpl",
"@doc-macro"
],
"description": "Uses existing dartdoc macro with current file's name as its prefix",
"description": "Inserts an existing Dart documentation macro, using the current file's name as the prefix, to maintain consistency in documentation.",
"body": "/// {@macro ${0:$TM_FILENAME_BASE}}"
},
"Dart doc inject html": {
"scope": "flutter, dart",
"prefix": [
"doc-html",
"@inject-html",
"inject-html",
"dartdoc-html",
"doc-html",
"html",
"@doc-html"
],
"description": "Injects html into the current comment",
"description": "Injects custom HTML into a documentation comment, allowing for rich formatting or content inclusion.",
"body": [
"/// {@inject-html}",
"/// ${0:<p>[The HTML to inject.]()</p>}",
Expand All @@ -291,29 +253,29 @@
"Deprecated": {
"scope": "flutter, dart",
"prefix": [
"@deprecated",
"deprecated"
"deprecated",
"@deprecated"
],
"description": "Deprecated",
"description": "Marks a class, method, or property as deprecated, indicating that it should no longer be used and may be removed in future versions.",
"body": "@Deprecated('${0:Reason}')"
},
"Meta": {
"scope": "flutter, dart",
"prefix": [
"@meta",
"meta",
"@meta",
"@annotation",
"annotation"
],
"description": "Meta annotation",
"description": "Applies a meta annotation to a class, method, or property, providing additional metadata for tooling or code analysis purposes.",
"body": "@${1|immutable,useResult,internal,protected,literal,mustCallSuper,sealed,alwaysThrows,factory,visibleForOverriding,visibleForTesting,experimental,nonVirtual,doNotStore,optionalTypeArgs|}"
},
"Coverage": {
"scope": "flutter, dart",
"prefix": [
"coverage"
],
"description": "Coverage annotation",
"description": "Adds a coverage annotation to mark lines or blocks of code that should be ignored by test coverage tools.",
"body": "// coverage:${1|ignore-line,ignore-start,ignore-end,ignore-file|}"
}
}
Loading

0 comments on commit 6d8a945

Please sign in to comment.