all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#67730: [PATCH] Add font-locking for shebangs in js-ts-mode and typescript-ts-mode
@ 2023-12-09 19:44 Noah Peart
  2023-12-10  2:53 ` Dmitry Gutov
  0 siblings, 1 reply; 2+ messages in thread
From: Noah Peart @ 2023-12-09 19:44 UTC (permalink / raw)
  To: 67730


[-- 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#67730: [PATCH] Add font-locking for shebangs in js-ts-mode and typescript-ts-mode
  2023-12-09 19:44 bug#67730: [PATCH] Add font-locking for shebangs in js-ts-mode and typescript-ts-mode Noah Peart
@ 2023-12-10  2:53 ` Dmitry Gutov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Gutov @ 2023-12-10  2:53 UTC (permalink / raw)
  To: Noah Peart, 67730-done

Version: 29.2

On 09/12/2023 21:44, Noah Peart wrote:
> 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.

Thanks! Installed.

Note that both commit messages exceeded the allowed 78, so I had to 
amend them by hand.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-10  2:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-09 19:44 bug#67730: [PATCH] Add font-locking for shebangs in js-ts-mode and typescript-ts-mode Noah Peart
2023-12-10  2:53 ` Dmitry Gutov

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.