Fork me on GitHub
#emacs
<
2020-02-19
>
Piotr Brzeziński11:02:21

Hey! Did anyone here manage to get syntax highlighting in .tsx files working? I’m using doom emacs and it works almost fine.

Piotr Brzeziński11:02:32

This is the only part I’m missing. The TSX part isn’t highlighted (components structure), but everything else in the file is, like ->

David Schmidt20:02:08

If you figure this out, please let me know. I’m working on trying to get the same thing set up (but in spacemacs). Also, does your indentation get totally messed up when you do a newline inside of actual tsx tags?

Piotr Brzeziński13:02:23

@UR070V08P I just noticed your message. It doesn’t get totally messed up but it’s acting super random for some reason. An answer I got from the creator of doom emacs yesterday:

By default, we use web-mode for tsx files, since typescript-mode has no support for them (last I checked). You can force it to use it anyway with (add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode)) in your config.el. Completion may work then, but you may have other issues that way
so I’m not sure if there’s a reliable way of working with tsx. I’m about to check if that change works.

Piotr Brzeziński13:02:12

(No luck unfortunately)

Piotr Brzeziński13:02:10

Anyway, if you find an answer to this, please do share it. I think I’m giving up on the highlighting in tsx for now ¯\(ツ)