Skip to content
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
18 changes: 9 additions & 9 deletions .github/workflows/checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ jobs:
- name: Checkout
id: checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
src/
*.json
*.js
*.mjs
README.md
CHANGELOG.md
#with:
# sparse-checkout: |
# .github
# src/
# *.json
# *.js
# *.mjs
# README.md
# CHANGELOG.md

- name: Install Node.js
uses: actions/setup-node@v4
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@ jobs:
timeout-minutes: 15
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Install Node.js
id: node-setup
uses: actions/setup-node@v4
with:
node-version: 18.x

- name: Install Dependencies
id: install
run: npm install

- name: Publish
id: publish
if: success() && startsWith(github.ref, 'refs/tags/')
run: npm run deploy
env:
Expand Down
4 changes: 2 additions & 2 deletions 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.1.0",
"version": "0.2.0",
"pricing": "Free",
"engines": {
"vscode": "^1.92.0"
Expand Down Expand Up @@ -110,4 +110,4 @@
"@vscode/test-cli": "^0.0.9",
"@vscode/test-electron": "^2.4.0"
}
}
}
320 changes: 319 additions & 1 deletion snippets/dart.json
Original file line number Diff line number Diff line change
@@ -1 +1,319 @@
{}
{
"Main entry point": {
"scope": "flutter, dart",
"prefix": "main",
"description": "Main entry point",
"body": [
"import 'dart:async';\n",
"@pragma('vm:entry-point')",
"void main([List<String>? args]) =>",
" runZonedGuarded<void>(() async {",
" ${0:// ...}",
" },",
" (error, stackTrace) => print('\\$error\\n\\$stackTrace'), // ignore: avoid_print",
" );\n"
]
},
"Try-catch-finally block": {
"scope": "flutter, dart",
"prefix": "try",
"description": "Try-catch-finally block",
"body": [
"try {",
" // ...",
"} on Object catch (error, stackTrace) {",
" rethrow; // or Error.throwWithStackTrace(error, stackTrace);",
"} finally {",
" // ...",
"}"
]
},
"Timeout handler": {
"scope": "flutter, dart",
"prefix": "timeout",
"description": "Timeout handler",
"body": "timeout(const Duration(milliseconds: 5000))${0:;}"
},
"Stopwatch": {
"scope": "flutter, dart",
"prefix": "stopwatch",
"description": "Stopwatch",
"body": [
"final stopwatch = Stopwatch()..start();",
"try {",
" /* ... */",
"} finally {",
" log(",
" '${(stopwatch..stop()).elapsedMicroseconds} μs',",
" name: 'select',",
" level: 100,",
" );",
"}"
]
},
"Platform conditional imports": {
"scope": "flutter, dart",
"prefix": [
"conditional_imports",
"import_conditional"
],
"description": "Platform conditional imports",
"body": [
"import 'stub.dart'",
" // ignore: uri_does_not_exist",
" if (dart.library.js_interop) 'js.dart'",
" // ignore: uri_does_not_exist",
" 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",
"body": "// --- ${1} --- //\n\n$0"
},
"Reverse bypass": {
"scope": "flutter, dart",
"prefix": [
"reverseList"
],
"description": "Reverse list traversal in a loop",
"body": [
"for (var i = list.length - 1; i >= 0; i--) $0"
]
},
"Part": {
"scope": "flutter, dart",
"prefix": "part",
"description": "Part of file",
"body": [
"part '${TM_FILENAME_BASE}.g.dart';$0"
]
},
"Mocks": {
"scope": "flutter, dart",
"prefix": "mocks",
"description": "Import mocks file",
"body": [
"import '${TM_FILENAME_BASE}.mocks.dart';$0"
]
},
"Hash Code": {
"scope": "flutter, dart",
"prefix": [
"hashCode",
"equals",
"=="
],
"description": "Hash Code and Equals override",
"body": [
"@override",
"int get hashCode => id.hashCode;\n",
"@override",
"bool operator ==(Object other) =>",
" identical(this, other) ||",
" other is ${1:${TM_FILENAME_BASE/(.)(.*)/${1:/upcase}${2:/camelcase}/}} &&",
" id == other.id;${0}\n"
]
},
"No Such Method": {
"scope": "flutter, dart",
"prefix": [
"nosm",
"noSuchMethod"
],
"description": "This method is invoked when a non-existent method or property is accessed.",
"body": [
"@override",
"dynamic noSuchMethod(Invocation invocation) {",
" ${1:}",
"}"
]
},
"Test": {
"scope": "flutter, dart",
"prefix": [
"test",
"unitTest"
],
"description": "Create a test function",
"body": [
"test('${1:test description}', () {",
" ${0:expect(true, isTrue);}",
"});\n"
]
},
"Pragma": {
"scope": "flutter, dart",
"prefix": [
"@pragma",
"pragma"
],
"description": "Pragma annotation https://mrale.ph/dartvm/pragmas.html",
"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": {
"scope": "flutter, dart",
"prefix": [
"doc-disabled",
"@doc-disabled"
],
"description": "No documentation annotation",
"body": []
},
"Dart doc category": {
"scope": "flutter, dart",
"prefix": [
"category",
"doc-category",
"dartdoc-category",
"@doc-category"
],
"description": "Add category to documentation",
"body": [
"/// {@${1|category,subCategory|} ${0}}"
]
},
"Dart doc image": {
"scope": "flutter, dart",
"prefix": [
"doc-image",
"dartdoc-image",
"@doc-image"
],
"description": "Add image to documentation",
"body": [
"/// {@image <image alt='' src='${0:https://host.tld/path/to/image.png}'>}"
]
},
"Dart doc animation": {
"scope": "flutter, dart",
"prefix": [
"doc-animation",
"dartdoc-animation",
"@doc-animation"
],
"description": "Add animation to documentation",
"body": "/// {@animation name 100 200 ${0:https://host.tld/path/to/video.mp4}}"
},
"Dart doc new template": {
"scope": "flutter, dart",
"prefix": [
"@template",
"template",
"dartdoc-new-template",
"doc-new-macro",
"newtmpl",
"@doc-template"
],
"description": "Creates a new dartdoc template with current file's name as its prefix",
"body": [
"/// {@template ${1:$TM_FILENAME_BASE}}",
"/// ${0:Body of the template}",
"/// {@endtemplate}"
]
},
"Dart doc use macro": {
"scope": "flutter, dart",
"prefix": [
"@macro",
"macro",
"dartdoc-use-template",
"doc-use-macro",
"usetmpl",
"@doc-macro"
],
"description": "Uses existing dartdoc macro with current file's name as its prefix",
"body": "/// {@macro ${0:$TM_FILENAME_BASE}}"
},
"Dart doc inject html": {
"scope": "flutter, dart",
"prefix": [
"@inject-html",
"inject-html",
"dartdoc-html",
"doc-html",
"html",
"@doc-html"
],
"description": "Injects html into the current comment",
"body": [
"/// {@inject-html}",
"/// ${0:<p>[The HTML to inject.]()</p>}",
"/// {@end-inject-html}"
]
},
"Deprecated": {
"scope": "flutter, dart",
"prefix": [
"@deprecated",
"deprecated"
],
"description": "Deprecated",
"body": "@Deprecated('${0:Reason}')"
},
"Meta": {
"scope": "flutter, dart",
"prefix": [
"@meta",
"meta",
"@annotation",
"annotation"
],
"description": "Meta annotation",
"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",
"body": "// coverage:${1|ignore-line,ignore-start,ignore-end,ignore-file|}"
}
}
Loading