llemaitre19 / jtsx

Extends Emacs JSX/TSX built-in support.
GNU General Public License v3.0
55 stars 2 forks source link

lack of syntax highlighting in js code nested in jsx grammar #9

Open liuyinz opened 1 month ago

liuyinz commented 1 month ago

As mentioned in https://github.com/llemaitre19/jtsx/discussions/8#discussioncomment-9555619, due to derived from js-ts-mode, jtsx-jsx-mode lack of highlighing when render js code in jsx {}, maybe extra rules need to be applied just as js-jsx-mode

llemaitre19 commented 1 month ago

js-ts-mode has the same syntax highlighting , but it's for js file, so there is no need to highlight jsx by default. jtsx-jsx-mode is for jsx, I mean that need extra enhancement highlight for jsx.

No, js-ts-mode is intented to be used for both js and jsx.

js-ts-mode is a rewriting of js-mode (js-jsx-mode is just a small wrapper around js-mode that adds a very basic implementation of jsx comments) that uses Tree-sitter as syntax parser, especially for syntax highlighting.

jtsx modes are based on Emacs Tree-sitter built-in modes to take advantage of Tree-sitter capabilities, e.g. for refactoring features. jtsx-jsx-mode can't derive from js-jsx-mode for these reasons.

I invite you to send a bug report to Emacs core team describing the lacks of syntax highlighting you notice in js-ts-mode (versus js-mode).