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

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

vicasas
Copy link
Contributor

@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
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

Note: this PR will not be merged until close to when the next release is made. See here for more details.

@lildude lildude added this pull request to the merge queue Nov 25, 2024
Merged via the queue into github-linguist:main with commit bc6e2c8 Nov 25, 2024
5 checks passed
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
2 participants