From f42eab017857ae84b5eb5f546b5774079fde98be Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 14 Aug 2023 03:00:47 -0400 Subject: [PATCH 1/3] bump tree-sitter-perl version need some grammar tweaks for the indent queries to function properly --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index b23cb44895a6..6b379b33fc55 100644 --- a/languages.toml +++ b/languages.toml @@ -1119,7 +1119,7 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "perl" -source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "ed21ecbcc128a6688770ebafd3ef68a1c9bc1ea9" } +source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "9f3166800d40267fa68ed8273e96baf74f390517" } [[language]] name = "pod" From 53ce0966053507c683c3b84361026515bcb2c47e Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 14 Aug 2023 03:01:25 -0400 Subject: [PATCH 2/3] add indent queries for perl --- book/src/generated/lang-support.md | 2 +- runtime/queries/perl/indents.scm | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/perl/indents.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 596b62babdae..ec0ade34e66f 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -112,7 +112,7 @@ | pascal | ✓ | ✓ | | `pasls` | | passwd | ✓ | | | | | pem | ✓ | | | | -| perl | ✓ | | | `perlnavigator` | +| perl | ✓ | | ✓ | `perlnavigator` | | php | ✓ | ✓ | ✓ | `intelephense` | | po | ✓ | ✓ | | | | pod | ✓ | | | | diff --git a/runtime/queries/perl/indents.scm b/runtime/queries/perl/indents.scm new file mode 100644 index 000000000000..03318243bd12 --- /dev/null +++ b/runtime/queries/perl/indents.scm @@ -0,0 +1,29 @@ +[ + (block) + (conditional_statement) + (loop_statement) + (cstyle_for_statement) + (for_statement) + (elsif) + (array_element_expression) + (hash_element_expression) + (coderef_call_expression) + (anonymous_slice_expression) + (slice_expression) + (keyval_expression) + (anonymous_array_expression) + (anonymous_hash_expression) + (stub_expression) + (func0op_call_expression) + (func1op_call_expression) + (map_grep_expression) + (function_call_expression) + (method_call_expression) + (attribute) +] @indent + +[ + "}" + "]" + ")" +] @outdent From e9043e3cfbc5ec18eee2364db0291953893bd9bf Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 14 Aug 2023 04:03:50 -0400 Subject: [PATCH 3/3] add textobject queries for perl --- book/src/generated/lang-support.md | 2 +- runtime/queries/perl/textobjects.scm | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/perl/textobjects.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index ec0ade34e66f..c1b0acfdbd69 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -112,7 +112,7 @@ | pascal | ✓ | ✓ | | `pasls` | | passwd | ✓ | | | | | pem | ✓ | | | | -| perl | ✓ | | ✓ | `perlnavigator` | +| perl | ✓ | ✓ | ✓ | `perlnavigator` | | php | ✓ | ✓ | ✓ | `intelephense` | | po | ✓ | ✓ | | | | pod | ✓ | | | | diff --git a/runtime/queries/perl/textobjects.scm b/runtime/queries/perl/textobjects.scm new file mode 100644 index 000000000000..1b0b5f076c24 --- /dev/null +++ b/runtime/queries/perl/textobjects.scm @@ -0,0 +1,14 @@ +(subroutine_declaration_statement + body: (_) @function.inside) @function.around +(anonymous_subroutine_expression + body: (_) @function.inside) @function.around + +(package_statement) @class.around +(package_statement + (block) @class.inside) + +(list_expression + (_) @parameter.inside) + +(comment) @comment.around +(pod) @comment.around