]> git.eshelyaron.com Git - emacs.git/commitdiff
sh-script.el: Improve consistency in variable-use fontification.
authorJostein Kjønigsen <jostein@kjonigsen.net>
Wed, 30 Apr 2025 09:33:26 +0000 (11:33 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 14:04:58 +0000 (16:04 +0200)
sh-mode--treesit-settings: Ensure all variable use is treated the
same way.
Before this patch the following commands would all be treated differently:

    echo "${var}"
    echo "$var"
    echo ${var}
    echo $var

Now they are treated the same.
* lisp/progmodes/sh-script.el (sh-mode--treesit-settings): Tweak
rules.  (Bug#78167)

(cherry picked from commit 7265be09cebc9ee752b688b7a85fb1ac18b45ef5)

lisp/progmodes/sh-script.el

index 39b93304f8da0908e69784b3267b1fc6c03a4c83..aa55bb1fb7d008eb3359b6edaad3a71d6c36e3c6 100644 (file)
@@ -3386,7 +3386,11 @@ See `sh-mode--treesit-other-keywords' and
    :language 'bash
    :override t
    '((command_substitution) @sh-quoted-exec
-     (string (expansion (variable_name) @font-lock-variable-use-face)))
+     (expansion (variable_name) @font-lock-variable-use-face)
+     (expansion ["${" "}"] @font-lock-bracket-face)
+     (simple_expansion
+      "$" @font-lock-bracket-face
+      (variable_name) @font-lock-variable-use-face))
 
    :feature 'heredoc
    :language 'bash