aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodor Thornhill2022-12-17 20:07:59 +0100
committerYuan Fu2022-12-17 16:30:46 -0800
commit5b2e6d04ce271cca2de944f8f5c07c005da33e37 (patch)
treefaff636d065879783fbe7ee6a77e2c6b7906ebb6
parentcb8ccdd26702606710258e2e08bd1fc35bbc1674 (diff)
downloademacs-5b2e6d04ce271cca2de944f8f5c07c005da33e37.tar.gz
emacs-5b2e6d04ce271cca2de944f8f5c07c005da33e37.zip
Fix wrong capture in typescript-ts-mode (bug#60167)
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.
-rw-r--r--lisp/progmodes/typescript-ts-mode.el7
1 files changed, 2 insertions, 5 deletions
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index 890d0a81348..69616351ce3 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -231,7 +231,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
231 (arguments (identifier) @font-lock-variable-name-face) 231 (arguments (identifier) @font-lock-variable-name-face)
232 232
233 (parenthesized_expression (identifier) @font-lock-variable-name-face) 233 (parenthesized_expression (identifier) @font-lock-variable-name-face)
234 (parenthesized_expression (_ (identifier)) @font-lock-variable-name-face)) 234 (parenthesized_expression (_ (identifier) @font-lock-variable-name-face)))
235 235
236 :language language 236 :language language
237 :override t 237 :override t
@@ -316,10 +316,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
316 :language language 316 :language language
317 :feature 'escape-sequence 317 :feature 'escape-sequence
318 :override t 318 :override t
319 '((escape_sequence) @font-lock-escape-face) 319 '((escape_sequence) @font-lock-escape-face)))
320
321
322 ))
323 320
324;;;###autoload 321;;;###autoload
325(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) 322(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))