GNU bug report logs -
#73978
31.0.50; Text syntax applied on too many things in tsx-ts-mode
Previous Next
Reported by: Yuan Fu <casouri <at> gmail.com>
Date: Thu, 24 Oct 2024 04:08:02 UTC
Severity: normal
Found in version 31.0.50
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> ReactDOM.render(
> <div>
> <h1>Hello, Welcome to React and TypeScript-!-</h1>
> </div>,
> document.getElementById("root")
> );
>
> C-M-f moves point to
>
> ReactDOM.render(
> <div>
> <h1>Hello, Welcome to React and TypeScript</h1-!->
> </div>,
> document.getElementById("root")
> );
>
> But maybe this is a different problem.
This can be fixed by the following patch that copied the syntax of < and >
from sgml-make-syntax-table:
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index 09f29a4ac65..21672d2d9c1 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -692,7 +694,11 @@ tsx-ts--syntax-propertize-captures
ne t)
(put-text-property
(match-beginning 0) (match-end 0)
- 'syntax-table (string-to-syntax ".")))))))))
+ 'syntax-table (string-to-syntax
+ (cond
+ ((equal (match-string 0) "<") "(<")
+ ((equal (match-string 0) ">") "(>")
+ (t ".")))))))))))
(if (treesit-ready-p 'tsx)
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode)))
This bug report was last modified 133 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.