Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update heuristics to fallback to TSX language if .tsx file is not XML #7049

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vicasas
Copy link

@vicasas vicasas commented Sep 19, 2024

Description

This PR fixes the syntax highlighting issue for .tsx files in the TSX language. Previously, the heuristic required detecting a React import pattern in the code. However, in recent versions of React, importing React is no longer necessary, which often resulted in the file being treated as plain text.

The behavior has now been updated to first check for matches with XML languages. If no match is found, it will assume the file is a TSX.

Closes #7039

Checklist:

  • I am fixing a misclassified language
    • I have included a new sample for the misclassified language:
      • Sample source(s):
        • [URL to each sample source, if applicable]
      • Sample license(s):
    • I have included a change to the heuristics to distinguish my language from others using the same extension.

@vicasas vicasas requested a review from a team as a code owner September 19, 2024 13:42
@lildude lildude changed the title Fix syntax highlighting for .tsx files in the TSX language Update heuristics to fallback to TSX language if .tsx file is not XML Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Syntax highlighting doesn't work well on files with .tsx extension
1 participant