aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel S Poulin2022-01-30 02:04:36 +0000
committerGitHub2022-01-30 02:04:36 +0000
commite2833b58533f3991fa68061a21486b1322239fe3 (patch)
treeb04c2db042737114e9b105d252e98f5979a45d15
parent333c2949c2b036f8aafa77be2286eb3c135ea269 (diff)
Add textobjects queries for php (#1601)
* Add textobjects queries for php * Missing EOL fix * Update generated docs after adding textobjects to php
-rw-r--r--book/src/generated/lang-support.md2
-rw-r--r--runtime/queries/php/textobjects.scm30
2 files changed, 31 insertions, 1 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index eff82226..85371773 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -40,7 +40,7 @@
| ocaml | ✓ | | ✓ | |
| ocaml-interface | ✓ | | | |
| perl | ✓ | ✓ | ✓ | |
-| php | ✓ | | ✓ | |
+| php | ✓ | ✓ | ✓ | |
| prolog | | | | `swipl` |
| protobuf | ✓ | | ✓ | |
| python | ✓ | ✓ | ✓ | `pylsp` |
diff --git a/runtime/queries/php/textobjects.scm b/runtime/queries/php/textobjects.scm
new file mode 100644
index 00000000..04ffefd2
--- /dev/null
+++ b/runtime/queries/php/textobjects.scm
@@ -0,0 +1,30 @@
+(class_declaration
+ body: (_) @class.inside) @class.around
+
+(interface_declaration
+ body: (_) @class.inside) @class.around
+
+(trait_declaration
+ body: (_) @class.inside) @class.around
+
+(enum_declaration
+ body: (_) @class.inside) @class.around
+
+(function_definition
+ body: (_) @function.inside) @function.around
+
+(method_declaration
+ body: (_) @function.inside) @function.around
+
+(arrow_function
+ body: (_) @function.inside) @function.around
+
+(anonymous_function_creation_expression
+ body: (_) @function.inside) @function.around
+
+(formal_parameters
+ [
+ (simple_parameter)
+ (variadic_parameter)
+ (property_promotion_parameter)
+ ] @parameter.inside)