all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 60167@debbugs.gnu.org
Cc: "Jostein Kjønigsen" <jostein@secure.kjonigsen.net>, casouri@gmail.com
Subject: bug#60167: 30.0.50; [PATCH]: Fix wrong capture in typescript-ts-mode
Date: Sat, 17 Dec 2022 20:15:17 +0100	[thread overview]
Message-ID: <87bko1u9iy.fsf@thornhill.no> (raw)

[-- Attachment #1: Type: text/plain, Size: 332 bytes --]


Hi there!

We've had a small regression after
fbf0d3b796ac1b891be35b642878a1fd412ee5ea, and this patch fixes that.
Yuan, want to apply after Josteins agrees on this fix?  There's an
example of the currently failing code in the commit message.  There's
also a small whitespace fix inside - I hope that's ok.

Thanks guys :-)

Theo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-wrong-capture-in-typescript-ts-mode.patch --]
[-- Type: text/x-diff, Size: 1841 bytes --]

From 931e96cd042aefe2807329de84751aa1a9e45bbb Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <theo@thornhill.no>
Date: Sat, 17 Dec 2022 20:07:59 +0100
Subject: [PATCH] Fix wrong capture in typescript-ts-mode

An example of the issue could be:

    <Menu.Item>
        {({ active }) => (
          link
            ? <Link to={link}> {text}</Link>
            : <a href="#" onClick={onClick}>{text}</a>
        )}
    </Menu.Item>

Here 'link' as well as a lot of the other constructs inside of the
parenthesized expression will be font-locked with
'font-lock-variable-name-face'.  We only want to capture the
identifier.

* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings): Make the variable capture
only capture the identifier, and not the whole expression.
---
 lisp/progmodes/typescript-ts-mode.el | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index e7bd65c5e2..5eb810dd1d 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -231,7 +231,7 @@ typescript-ts-mode--font-lock-settings
      (arguments (identifier) @font-lock-variable-name-face)
 
      (parenthesized_expression (identifier) @font-lock-variable-name-face)
-     (parenthesized_expression (_ (identifier)) @font-lock-variable-name-face))
+     (parenthesized_expression (_ (identifier) @font-lock-variable-name-face)))
 
    :language language
    :override t
@@ -316,10 +316,7 @@ typescript-ts-mode--font-lock-settings
    :language language
    :feature 'escape-sequence
    :override t
-   '((escape_sequence) @font-lock-escape-face)
-
-
-   ))
+   '((escape_sequence) @font-lock-escape-face)))
 
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))
-- 
2.34.1


             reply	other threads:[~2022-12-17 19:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-17 19:15 Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-12-17 23:37 ` bug#60167: 30.0.50; [PATCH]: Fix wrong capture in typescript-ts-mode Yuan Fu
2022-12-18  6:25   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-18  8:08 ` Yuan Fu

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=87bko1u9iy.fsf@thornhill.no \
    --to=bug-gnu-emacs@gnu.org \
    --cc=60167@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=jostein@secure.kjonigsen.net \
    --cc=theo@thornhill.no \
    /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.