]> git.eshelyaron.com Git - emacs.git/commitdiff
Add string-interpolation feature to bash-ts-mode
authorYuan Fu <casouri@gmail.com>
Sun, 5 Mar 2023 22:16:58 +0000 (14:16 -0800)
committerYuan Fu <casouri@gmail.com>
Sun, 5 Mar 2023 22:17:57 +0000 (14:17 -0800)
* lisp/progmodes/sh-script.el:
(bash-ts-mode): Add string-interpolation feature.
(sh-mode--treesit-settings): Add rule for string-interpolation feature.

lisp/progmodes/sh-script.el

index 4c06efc8146b55fd4c9164fa9164a78b90bced52..29820049636b3d7e17527e3de00713d02096e1d4 100644 (file)
@@ -1619,7 +1619,8 @@ not written in Bash or sh."
     (setq-local treesit-font-lock-feature-list
                 '(( comment function)
                   ( command declaration-command keyword string)
-                  ( builtin-variable constant heredoc number variable)
+                  ( builtin-variable constant heredoc number
+                    string-interpolation variable)
                   ( bracket delimiter misc-punctuation operator)))
     (setq-local treesit-font-lock-settings
                 sh-mode--treesit-settings)
@@ -3289,6 +3290,12 @@ See `sh-mode--treesit-other-keywords' and
    :language 'bash
    '([(string) (raw_string)] @font-lock-string-face)
 
+   :feature 'string-interpolation
+   :language 'bash
+   :override t
+   '((command_substitution) @sh-quoted-exec
+     (string (expansion (variable_name) @font-lock-variable-name-face)))
+
    :feature 'heredoc
    :language 'bash
    '([(heredoc_start) (heredoc_body)] @sh-heredoc)