question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FR] TypeScriptReact syntax highlighting (tsx)

See original GitHub issue

Currently, only .ts extensions get syntax highlighting, whereas .tsx files get none. Support for .tsx files is built into language-typescript, so it seems like this would be an easy one to add here https://github.com/refined-bitbucket/refined-bitbucket/blob/dev/src/syntax-highlight/language-ext.js#L65

Is adding support for .tsx as simple as adding '.tsx': 'language-typescript', after the line referenced above? And if so, would you accept a PR for this feature?

Thank you for this extension! We just started using it on our team and love it so far!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:21 (21 by maintainers)

github_iconTop GitHub Comments

2reactions
atdragocommented, Feb 10, 2018

If I have some time I’ll use that code sample to see if I can submit a PR to PrismJS to fix that.

Apologies, man! I read this and thought you wanted me to tell you how the TS highlighting could be improved. 🤭

I went back and checked again. I loaded the extension from your branch in one window, then opened a different window, disabled the extension from your branch and re-enabled the one from the store, then cleared my cache and loaded up a PR in that window. Refreshed a few times just to be sure, but your version is definitely an improvement and preferable over 3.5.0. It includes the fix I mentioned above with Component<ComponentProps>, and also added highlighting for elements within the JSX. You can see in the screenshots above that <React.Fragment> and <div> get highlighted. In 3.5.0, elements aren’t getting highlighted at all. (The issue I mentioned with <RadioPillBox above I think is actually because the attributes are not on the same line, but that’s neither here nor there. 🙃)

So, to answer your question, it looks like the new version of PrismJS is loaded correctly! Thanks again so much for your work on this! 😄

1reaction
atdragocommented, Feb 12, 2018

Looks great, @reyronald! Thanks again! 😊

Read more comments on GitHub >

github_iconTop Results From Across the Web

React JSX syntax highlighting for vim and Typescript - GitHub
Syntax highlighting and indentation for JSX in Typescript ( typescriptreact filetypes). vim-jsx-typescript works with the built-in typescript syntax ...
Read more >
How to get TypeScript JSX (TSX) syntax highlighting in neovim
What is the simplest way to get syntax highlighting for tsx files? neovim · Share.
Read more >
Modern TypeScript and React Development in Vim - Thoughtbot
Highlighting for large files. Sometimes syntax highlighting can get out of sync in large JSX and TSX files. This was happening too often...
Read more >
Provide syntax highlighting for TypeScript React files - GitLab
I've opened an issue with (rouge)[https://github.com/jneen/rouge/issues/516] as well. Whilst #13372 added support for plain TypeScript files, ...
Read more >
Vim for TypeScript and React in 2020 | by Vanya Yani - Medium
Syntax highlighting (*.ts and *.tsx files); Go to definition (open another file where a symbol is defined); Refactoring (context-aware find and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found