all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noah Peart <noah.v.peart@gmail.com>
To: 67730@debbugs.gnu.org
Subject: bug#67730: [PATCH] Add font-locking for shebangs in js-ts-mode and typescript-ts-mode
Date: Sat, 9 Dec 2023 11:44:19 -0800	[thread overview]
Message-ID: <CAPVBTSf6F0pXZp=C2szwE3+iX=w3YwV2o=a2QwbwP-mHxisHgQ@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 290 bytes --]

Tags: patch


* Bug: `js-ts-mode` and `typescript-ts-mode` are missing font-locking
rules for hashbang lines.

Recipe to reproduce:
Open a buffer and insert

    #!/usr/bin/env node

Run `M-x js-ts-mode` and `M-x typescript-ts-mode` to see no font-locking
is applied to the hash bang line.

[-- Attachment #1.2: Type: text/html, Size: 354 bytes --]

[-- Attachment #2: js-ts-mode-fontify-hash-bang.patch --]
[-- Type: text/x-patch, Size: 802 bytes --]

From 1b15ed1c8657f84f55f57411682eb34d39848533 Mon Sep 17 00:00:00 2001
From: nverno <noah.v.peart@gmail.com>
Date: Sat, 9 Dec 2023 11:28:15 -0800
Subject: [PATCH] Add font-locking for hash-bang lines in js-ts-mode

* lisp/progmodes/js.el(js--treesit-font-lock-settings): Add font-lock for hash bang
line.
---
 lisp/progmodes/js.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index b3a0f5a7c04..44eda03f7ce 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3497,7 +3497,7 @@ js--treesit-font-lock-settings
 
    :language 'javascript
    :feature 'comment
-   '((comment) @font-lock-comment-face)
+   '([(comment) (hash_bang_line)] @font-lock-comment-face)
 
    :language 'javascript
    :feature 'constant
-- 
2.34.1


[-- Attachment #3: typescript-ts-mode-fontify-hash-bang.patch --]
[-- Type: text/x-patch, Size: 941 bytes --]

From 619e548dc81512d239ce4f73b6d38a38120539ea Mon Sep 17 00:00:00 2001
From: nverno <noah.v.peart@gmail.com>
Date: Sat, 9 Dec 2023 11:35:44 -0800
Subject: [PATCH] Add font-locking for hash-bang lines in typescript-ts-mode.

* lisp/progmodes/typescript-ts-mode.el(typescript-ts-mode--font-lock-settings): Add
font-lock for hash bang line.
---
 lisp/progmodes/typescript-ts-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index 7998b3740b6..7f0b7236301 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -205,7 +205,7 @@ typescript-ts-mode--font-lock-settings
   (treesit-font-lock-rules
    :language language
    :feature 'comment
-   `((comment) @font-lock-comment-face)
+   `([(comment) (hash_bang_line)] @font-lock-comment-face)
 
    :language language
    :feature 'constant
-- 
2.34.1


             reply	other threads:[~2023-12-09 19:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-09 19:44 Noah Peart [this message]
2023-12-10  2:53 ` bug#67730: [PATCH] Add font-locking for shebangs in js-ts-mode and typescript-ts-mode Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPVBTSf6F0pXZp=C2szwE3+iX=w3YwV2o=a2QwbwP-mHxisHgQ@mail.gmail.com' \
    --to=noah.v.peart@gmail.com \
    --cc=67730@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.