Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

json: Add runnable for `package.json` and `composer.json` scripts (#12285)

Remco Smits5665cad25061
diff --git a/crates/languages/src/json/runnables.scm b/crates/languages/src/json/runnables.scm
new file mode 100644
index 00000000000..2396f05a572
--- /dev/null
+++ b/crates/languages/src/json/runnables.scm
@@ -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)
+)
diff --git a/crates/languages/src/json/tasks.json b/crates/languages/src/json/tasks.json
new file mode 100644
index 00000000000..07bb0a9f0ad
--- /dev/null
+++ b/crates/languages/src/json/tasks.json
@@ -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"]
+ }
+]