dart: Add Flutter runnables and tasks (#13686)

Release Notes:

- Added runnable tasks for Flutter
This commit is contained in:
Abdullah Alsigar 2024-07-11 11:46:53 +03:00 committed by GitHub
parent 22900554d5
commit bdba8b23fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,6 @@
## Roadmap
1. Add `dart run` command.
2. Add `dart test` command.
3. Add `flutter test --name` command, to allow running a single test or group of tests.
4. Auto hot reload Flutter app when files change.

View file

@ -0,0 +1,45 @@
; Flutter main
(
(
(import_or_export
(library_import
(import_specification
("import"
(configurable_uri
(uri
(string_literal) @_import
(#match? @_import "package:flutter/(material|widgets|cupertino).dart")
(#not-match? @_import "package:flutter_test/flutter_test.dart")
(#not-match? @_import "package:test/test.dart")
))))))
(
(function_signature
name: (_) @run
)
(#eq? @run "main")
)
(#set! tag flutter-main)
)
)
; Flutter test main
(
(
(import_or_export
(library_import
(import_specification
("import"
(configurable_uri
(uri
(string_literal) @_import
(#match? @_import "package:flutter_test/flutter_test.dart")
))))))
(
(function_signature
name: (_) @run
)
(#eq? @run "main")
)
(#set! tag flutter-test-main)
)
)

View file

@ -0,0 +1,26 @@
[
{
"label": "flutter run",
"command": "flutter",
"args": ["run"],
"tags": ["flutter-main"]
},
{
"label": "fvm flutter run",
"command": "fvm flutter",
"args": ["run"],
"tags": ["flutter-main"]
},
{
"label": "flutter test $ZED_STEM",
"command": "flutter",
"args": ["test", "$ZED_FILE"],
"tags": ["flutter-test-main"]
},
{
"label": "fvm flutter test $ZED_STEM",
"command": "fvm flutter",
"args": ["test", "$ZED_FILE"],
"tags": ["flutter-test-main"]
}
]