json: Add runnable for `package.json` and `composer.json` scripts (#12285)
Remco Smits
created
**Package.json**
https://github.com/zed-industries/zed/assets/62463826/f8ca12a5-1292-4465-83e1-3c2ab65f5833
**Composer.json**
https://github.com/zed-industries/zed/assets/62463826/61f9e74d-c6ed-4329-855b-d0161e0a117b
Release Notes:
- Added runnable for `package.json` and `composer.json` scripts
([#12215](https://github.com/zed-industries/zed/issues/12215)).
Change summary
crates/languages/src/json/runnables.scm | 21 +++++++++++++++++++++
crates/languages/src/json/tasks.json | 14 ++++++++++++++
2 files changed, 35 insertions(+)
Detailed changes
@@ -0,0 +1,21 @@
+; Add support `package.json` and `composer.json` script runnable
+
+(
+ (document
+ (object
+ (pair
+ key: (string
+ (string_content) @_name
+ (#eq? @_name "scripts")
+ )
+ value: (object
+ (pair
+ key: (string (string_content) @run @script)
+ )
+ )
+ )
+ )
+ )
+ (#set! tag package-script)
+ (#set! tag composer-script)
+)
@@ -0,0 +1,14 @@
+[
+ {
+ "label": "package script $ZED_CUSTOM_script",
+ "command": "npm run",
+ "args": ["$ZED_CUSTOM_script"],
+ "tags": ["package-script"]
+ },
+ {
+ "label": "composer script $ZED_CUSTOM_script",
+ "command": "composer",
+ "args": ["$ZED_CUSTOM_script"],
+ "tags": ["composer-script"]
+ }
+]