From 82c4caa3ad0701754e9a4a0f26b2b07120c5f0b6 Mon Sep 17 00:00:00 2001 From: Chris Sergienko Date: Sat, 20 Apr 2024 13:11:49 +0300 Subject: [PATCH 1/2] feat: update bash grammar to latest tree-sitter-bash rev --- languages.toml | 2 +- runtime/queries/bash/highlights.scm | 39 ++++++++++------------------- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/languages.toml b/languages.toml index 03af4fc2f9fa..f148acdcaa07 100644 --- a/languages.toml +++ b/languages.toml @@ -934,7 +934,7 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "bash" -source = { git = "https://github.com/tree-sitter/tree-sitter-bash", rev = "275effdfc0edce774acf7d481f9ea195c6c403cd" } +source = { git = "https://github.com/tree-sitter/tree-sitter-bash", rev = "f8fb3274f72a30896075585b32b0c54cad65c086" } [[language]] name = "php" diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm index 92d61e8b83e0..f33a7c2d3ae8 100644 --- a/runtime/queries/bash/highlights.scm +++ b/runtime/queries/bash/highlights.scm @@ -7,45 +7,33 @@ (command_name) @function -(variable_name) @variable.other.member +(variable_name) @property [ - "if" - "then" - "else" - "elif" - "fi" "case" - "in" - "esac" -] @keyword.control.conditional - -[ - "for" "do" "done" + "elif" + "else" + "esac" + "export" + "fi" + "for" + "function" + "if" + "in" "select" + "then" + "unset" "until" "while" -] @keyword.control.repeat - -[ - "declare" - "typeset" - "export" - "readonly" - "local" - "unset" - "unsetenv" ] @keyword -"function" @keyword.function - (comment) @comment (function_definition name: (word) @function) -(file_descriptor) @constant.numeric.integer +(file_descriptor) @number [ (command_substitution) @@ -60,7 +48,6 @@ ">>" "<" "|" - (expansion_flags) ] @operator ( From b5096a3739db3d7194876cdd26904b60c5a50211 Mon Sep 17 00:00:00 2001 From: Chris Sergienko Date: Sat, 20 Apr 2024 14:46:40 +0300 Subject: [PATCH 2/2] revert changes to highlights.scm and remove (expansion_flags) --- runtime/queries/bash/highlights.scm | 38 +++++++++++++++++++---------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm index f33a7c2d3ae8..1aa35aa7c790 100644 --- a/runtime/queries/bash/highlights.scm +++ b/runtime/queries/bash/highlights.scm @@ -7,33 +7,45 @@ (command_name) @function -(variable_name) @property +(variable_name) @variable.other.member [ - "case" - "do" - "done" - "elif" + "if" + "then" "else" - "esac" - "export" + "elif" "fi" - "for" - "function" - "if" + "case" "in" + "esac" +] @keyword.control.conditional + +[ + "for" + "do" + "done" "select" - "then" - "unset" "until" "while" +] @keyword.control.repeat + +[ + "declare" + "typeset" + "export" + "readonly" + "local" + "unset" + "unsetenv" ] @keyword +"function" @keyword.function + (comment) @comment (function_definition name: (word) @function) -(file_descriptor) @number +(file_descriptor) @constant.numeric.integer [ (command_substitution)