It might just be because of how the tree-sitter-bash grammar defines heredoc strings.
This are the steps to reproduce the issue on sh-mode:
;; build emacs from head of feature/tree-sitter branch
;; apply the attached patch.
;; launch emacs with: emacs -nw -Q
;;Write the forms bellow on *scratch* buffer)
(require 'treesit)
(add-to-list 'treesit-settings '(sh-mode t t))
(find-file "/tmp/heredoc-issue.sh")
;; contents of /tmp/heredoc-issue.sh file (also attached)
#!/usr/bin/env bash
cat <<EOF
heredoc string
EOF
echo "<<HELLO>>"
;; Then execute the commands below
ESC < Â Â Â Â Â Â Â Â Â ;; beginning-of-buffer
C-s           ;; isearch-forward
heredoc         ;; self-insert-command * 7
RET Â Â Â Â Â Â Â Â Â Â ;; newline
C-a           ;; move-beginning-of-line
C-k           ;; kill-line
C-n           ;; next-line (At this point the echo command after EOF is fontified as heredoc string)
C-_ Â Â Â Â Â Â Â Â Â Â ;; undo (After a short delay, the whole buffer is correctly fontified)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4